{
  "openapi": "3.0.0",
  "paths": {
    "/employees": {
      "get": {
        "operationId": "ListEmployees",
        "summary": "[Both] List employees in this workspace - e.g. for the approval-chain approver picker",
        "parameters": [
          {
            "name": "role",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "buyer",
                "supplier"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EmployeeSummary"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "employees"
        ]
      }
    },
    "/api-keys": {
      "get": {
        "operationId": "ListApiKeys",
        "summary": "[Both, admin] List API keys",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeySummary"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "api-keys"
        ]
      },
      "post": {
        "operationId": "CreateApiKey",
        "summary": "[Both, admin] Create an API key",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "api-keys"
        ]
      }
    },
    "/api-keys/{keyId}/revoke": {
      "post": {
        "operationId": "RevokeApiKey",
        "summary": "[Both, admin] Revoke an API key",
        "parameters": [
          {
            "name": "keyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "api-keys"
        ]
      }
    },
    "/cloud-connections": {
      "get": {
        "operationId": "ListCloudConnections",
        "summary": "[Buyer] List cloud provider connections. With `limit` (1–200): one page, `{ items, nextCursor? }`, oldest first - pass `cursor` back for the next page. Without it: every connection, as before (unbounded; a workspace with thousands of bulk-connected accounts should page). 'view' on suppliers or on invoices.",
        "parameters": [
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCloudConnectionsResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      },
      "post": {
        "operationId": "CreateCloudConnection",
        "summary": "[Buyer] Connect a cloud provider account ('create' on suppliers)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCloudConnectionInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudConnection"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      }
    },
    "/cloud-connections/aws/init": {
      "post": {
        "operationId": "InitAwsCloudConnection",
        "summary": "[Buyer] Start connecting an AWS account - returns the values to paste into the setup script, reusing the caller's own unfinished draft (and its external ID) if one exists. 'create' on suppliers.",
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AwsCloudConnectionInit"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      }
    },
    "/cloud-connections/{provider}/init": {
      "post": {
        "operationId": "InitCloudConnection",
        "summary": "[Buyer] Start connecting a provider whose real connector is switched on (gcp, azure, oci) - returns the per-connection values its setup script pins, reusing the caller's own unfinished draft if one exists. 404 while the provider is demo-only. 'create' on suppliers.",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      }
    },
    "/cloud-connections/{provider}/supplier": {
      "post": {
        "operationId": "AddCloudProviderAsSupplier",
        "summary": "[Buyer] Add a cloud provider (aws, gcp, azure, oci) to the suppliers list without connecting an account - nothing is read from the provider, so nothing is billed in the buyer's cloud account. Idempotent: returns the provider's existing supplier row when there is one. Connecting later links to the same row. 409 SUPPLIER_ALREADY_LISTED when a supplier with that name already has an onboarding under way or approved.",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddCloudProviderAsSupplierResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      }
    },
    "/cloud-connections/azure/discover": {
      "post": {
        "operationId": "DiscoverAzureBillingScopes",
        "summary": "[Buyer] Azure, when its connector is on: prove the tenant ID and app (client) ID the setup script printed, with an app-only token for this connection's own federated-credential audience, and read the given Microsoft Customer Agreement billing account and billing profile with it (the account list is empty for an app that holds only Billing profile reader). Only the person who started the setup may call it, and it counts against the same attempt limit and cooldown as verify. 404 while Azure is demo-only. 'create' on suppliers.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscoverAzureScopesInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      }
    },
    "/cloud-connections/{id}": {
      "delete": {
        "operationId": "DisconnectCloudConnection",
        "summary": "[Buyer] Disconnect a cloud account (logged-in users only, 'edit' on suppliers). Deletes the connection with everything Pleaxy stored for it (for Oracle Cloud, its encrypted API key) and records who disconnected it; for Oracle Cloud the response names the key fingerprint to delete from user pleaxy-billing. A setup still in progress can only be cancelled by the person who started it (403 otherwise).",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudConnectionDisconnected"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      }
    },
    "/cloud-connections/{id}/sync": {
      "post": {
        "operationId": "SyncCloudConnection",
        "summary": "[Buyer] Manually sync one connected cloud account's billing data now (rate-limited). 'create' on suppliers or 'edit' on invoices.",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CloudConnection"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "cloud-connections"
        ]
      }
    },
    "/settlement/autonomy": {
      "get": {
        "operationId": "GetAutonomySettings",
        "summary": "[Buyer] Get autonomous-settlement settings",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutonomySettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "settlement"
        ]
      },
      "patch": {
        "operationId": "UpdateAutonomySettings",
        "summary": "[Buyer] Update autonomous-settlement settings",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutonomySettingsInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutonomySettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "settlement"
        ]
      }
    },
    "/approval-chains/{process}": {
      "get": {
        "operationId": "GetApprovalChainSettings",
        "summary": "[Buyer] Get the configured approval chain for a process",
        "parameters": [
          {
            "name": "process",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalChainSettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "approval-settings"
        ]
      },
      "patch": {
        "operationId": "UpdateApprovalChainSettings",
        "summary": "[Buyer] Configure the approval chain for a process - its stages, a link to another process's chain, or `useDefault: true` for the region-administrator default. Needs a signed-in session.",
        "parameters": [
          {
            "name": "process",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateApprovalChainInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalChainSettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "approval-settings"
        ]
      }
    },
    "/request-types": {
      "get": {
        "operationId": "ListRequestTypes",
        "summary": "[Buyer] The workspace's request types in picker order, each with its intake form; active ones unless includeInactive=true",
        "parameters": [
          {
            "name": "includeInactive",
            "required": false,
            "in": "query",
            "description": "true: also the inactive types (for the settings page).",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RequestType"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "request-types"
        ]
      }
    },
    "/request-types/{typeId}": {
      "get": {
        "operationId": "GetRequestType",
        "summary": "[Buyer] One request type, active or not, with its intake form",
        "parameters": [
          {
            "name": "typeId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestType"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "request-types"
        ]
      }
    },
    "/automation-rules/{process}": {
      "get": {
        "operationId": "GetAutomationRules",
        "summary": "[Buyer] Get the configured automation rules for a process, and whether the plan lets auto-approve rules run",
        "parameters": [
          {
            "name": "process",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRuleSetView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "automation-rules"
        ]
      },
      "patch": {
        "operationId": "UpdateAutomationRules",
        "summary": "[Buyer] Replace the automation rules for a process, in priority order. Needs a signed-in session; auto-approve rules need the Autonomous plan.",
        "parameters": [
          {
            "name": "process",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutomationRulesInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRuleSet"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "automation-rules"
        ]
      }
    },
    "/supplier-connections/{connectionId}/feed-attempts": {
      "get": {
        "operationId": "ListFeedAttempts",
        "summary": "[Both] The feed attempt log for one of your connections: every call to its automated-invoice route or its validate twin that reached the connection, newest first, 50 a page (`?before=` the last row's cursor for the next). Both sides see the same rows. 404 when the connection isn't yours",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedAttemptsPage"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-connections"
        ]
      }
    },
    "/supplier-connections/directory/browse": {
      "get": {
        "operationId": "BrowseSupplierDirectory",
        "summary": "[Buyer] Browse the suppliers that chose to be found on Pleaxy, to find one you don't work with yet: all of them, or by `category` (a Pleaxy category id such as `software`), by `segment` (a two-digit UN standard code such as `43`; a category's suppliers are found under its segments too) and by `q`, part of a name. Each has its listed regions with the `directoryId` it is invited by in Pleaxy, what it says it sells, `verified` when Pleaxy confirmed who it is, `sponsored` when it pays to be shown first, and `connectionId` when it is already one of your suppliers. Up to 3 sponsored suppliers that match come first, then A to Z; 60 companies a page, the next from `nextOffset`; `total` counts every match. Never a contact email. Everything a supplier lists is its own claim unless `verified`",
        "parameters": [
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Where the page starts: the nextOffset of the page before. Default 0.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "segment",
            "required": false,
            "in": "query",
            "description": "A two-digit UN standard (UNSPSC) segment code, e.g. 43.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "required": false,
            "in": "query",
            "description": "A Pleaxy supplier category id, e.g. software.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "required": false,
            "in": "query",
            "description": "Part of a company name, 2 to 200 characters.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierDirectoryPage"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-connections"
        ]
      }
    },
    "/supplier-connections/{connectionId}/currencies": {
      "put": {
        "operationId": "SetSupplierCurrencies",
        "summary": "[Buyer] Set \"Bills in\" (billingCurrency, a supplier with no Pleaxy account only) and \"Pay in\" (paymentCurrency) for this supplier: the defaults for its new orders and invoices. Absent leaves a field, null removes it. Existing documents keep their currencies. 400 BILLING_CURRENCY_SUPPLIER_OWNED for a supplier with an account; 400 PAYMENT_CURRENCY_NOT_ACCEPTED when it doesn't accept that currency. The supplier never sees either.",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetConnectionCurrenciesInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetSupplierCurrenciesResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-connections"
        ]
      }
    },
    "/supplier-connections/{connectionId}/invoice-feed": {
      "put": {
        "operationId": "SetInvoiceFeed",
        "summary": "[Buyer] Turn this supplier's automated invoices on or off - whether it may send invoices to you with an invoices:feed API key (POST .../invoices/connections/:connectionId). On from the moment you approve the supplier; turning it off refuses the very next one, and invoices already received stay. Approved connections only (400 COUNTERPARTY_NOT_ACTIVE). Human session only.",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetInvoiceFeedInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetInvoiceFeedResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-connections"
        ]
      }
    },
    "/notifications": {
      "get": {
        "operationId": "ListNotifications",
        "summary": "[Both] List notifications (the 50 most recent)",
        "parameters": [
          {
            "name": "audience",
            "required": true,
            "in": "query",
            "description": "Must match the caller's own role in this workspace.",
            "schema": {
              "enum": [
                "buyer",
                "supplier"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Notification"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ]
      }
    },
    "/notifications/inbox": {
      "get": {
        "operationId": "ListNotificationsPage",
        "summary": "[Both] List notifications a page at a time, newest first",
        "parameters": [
          {
            "name": "audience",
            "required": true,
            "in": "query",
            "description": "Must match the caller's own role in this workspace.",
            "schema": {
              "enum": [
                "buyer",
                "supplier"
              ],
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "The previous response's nextCursor, to continue from where it stopped.",
            "schema": {
              "maxLength": 512,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 20,
              "type": "number",
              "format": "double"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationPage"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ]
      }
    },
    "/notifications/{notificationId}/read": {
      "post": {
        "operationId": "MarkNotificationRead",
        "summary": "[Both] Mark a notification as read",
        "parameters": [
          {
            "name": "notificationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ]
      }
    },
    "/notifications/read-all": {
      "post": {
        "operationId": "MarkAllNotificationsRead",
        "summary": "[Both] Mark all notifications as read",
        "parameters": [
          {
            "name": "audience",
            "required": true,
            "in": "query",
            "description": "Must match the caller's own role in this workspace.",
            "schema": {
              "enum": [
                "buyer",
                "supplier"
              ],
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "description": "The previous response's nextCursor, to continue from where it stopped.",
            "schema": {
              "maxLength": 512,
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarkAllNotificationsReadResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ]
      }
    },
    "/notifications/reminder-settings": {
      "get": {
        "operationId": "GetReminderSettings",
        "summary": "[Supplier] Get reminder settings",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReminderSettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ]
      },
      "patch": {
        "operationId": "UpdateReminderSettings",
        "summary": "[Supplier] Update reminder settings",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateReminderSettingsInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReminderSettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "notifications"
        ]
      }
    },
    "/profile": {
      "get": {
        "operationId": "GetOrgProfile",
        "summary": "[Both] Get your organization's profile",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetOrgProfileResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "org-profiles"
        ]
      },
      "patch": {
        "operationId": "UpdateOrgProfile",
        "summary": "[Both] Update your organization's profile (administrators only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrgProfileInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgProfile"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "org-profiles"
        ]
      }
    },
    "/buyer": {
      "get": {
        "operationId": "GetBuyerWorkspace",
        "summary": "[Buyer] Get the buyer workspace snapshot - optionally scoped to a createdAt range via ?from=&to=. ?lists=none returns purchaseOrders and invoices empty, without reading them (page them with ListPurchaseOrdersPage and ListInvoicesPage), and the rest as usual. ?lists=active returns only the ones still in play - not canceled, closed, rejected or paid POs; unpaid invoices, and ones rejected in the last 30 days and not yet replaced - with recentPurchaseOrders and recentInvoices, the newest 10 of each.",
        "parameters": [
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or after this are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or before this are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lists",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetBuyerWorkspaceResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "workspaces"
        ]
      }
    },
    "/supplier": {
      "get": {
        "operationId": "GetSupplierWorkspace",
        "summary": "[Supplier] Get the supplier workspace snapshot - optionally scoped to a createdAt range via ?from=&to=. ?lists=none returns incomingPOs and supplierInvoices empty, without reading them (page them with ListPurchaseOrdersPage and ListInvoicesPage). ?lists=active returns only the ones still in play (as GetBuyerWorkspace), with recentIncomingPOs and recentSupplierInvoices, the newest 10 of each.",
        "parameters": [
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or after this are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or before this are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lists",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSupplierWorkspaceResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "workspaces"
        ]
      }
    },
    "/purchase-orders": {
      "get": {
        "operationId": "ListPurchaseOrders",
        "summary": "[Both] List purchase orders - optionally scoped to a createdAt range via ?from=&to=. A Supplier caller gets a reduced view (see GetPurchaseOrder).",
        "parameters": [
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or after this are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or before this are returned.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListPurchaseOrdersItem"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      },
      "post": {
        "operationId": "CreatePurchaseOrder",
        "summary": "[Buyer] Create a purchase order",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePurchaseOrderInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}": {
      "get": {
        "operationId": "GetPurchaseOrder",
        "summary": "[Both] Get a single purchase order. A Supplier caller gets a reduced view - no costCenter/budgetOwner/buyerName/notes, no AWS sync state, and approval collapsed to a bare status. A Supplier whose id two buyers both issued gets 409 PO_ID_AMBIGUOUS and picks one with ?buyer=<buyer Workspace ID>.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPurchaseOrderResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      },
      "patch": {
        "operationId": "UpdatePurchaseOrder",
        "summary": "[Buyer] Update a purchase order's bookkeeping metadata - not available once it's closed/canceled/paid",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePurchaseOrderInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/pdf": {
      "get": {
        "operationId": "GetPurchaseOrderPdf",
        "summary": "[Both] Get the purchase order as a PDF - the supplier's copy whoever asks (no cost center, budget owner, notes or approvals), to download, print or forward. Takes the same ?buyer= qualifier as GetPurchaseOrder. Send `Accept: application/pdf`, or the deployed API returns the body base64-encoded.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/submit": {
      "post": {
        "operationId": "SubmitPurchaseOrderDraft",
        "summary": "[Buyer] Submit a draft purchase order for approval",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/cancel": {
      "post": {
        "operationId": "CancelPurchaseOrder",
        "summary": "[Buyer] Cancel a purchase order",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelPurchaseOrderInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/close": {
      "post": {
        "operationId": "ClosePurchaseOrder",
        "summary": "[Buyer] Manually close out a purchase order",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/cost-center": {
      "post": {
        "operationId": "ChangeFinishedPurchaseOrderCostCenter",
        "summary": "[Buyer, administrator] Rebook a closed, paid or canceled purchase order to another cost center, with a reason. Only the cost center changes; the change is kept on the order (`costCenterChanges`). An open order changes its cost center with PATCH instead.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeFinishedCostCenterInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/approve": {
      "post": {
        "operationId": "ApprovePurchaseOrder",
        "summary": "[Buyer] Approve a purchase order - only the current stage's assigned approver may call this",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/reject": {
      "post": {
        "operationId": "RejectPurchaseOrder",
        "summary": "[Buyer] Reject a purchase order - only the current stage's assigned approver may call this",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/approval/reassign": {
      "post": {
        "operationId": "ReassignPurchaseOrderApprovalStage",
        "summary": "[Buyer, administrator] Reassign one pending approval step of this order to a different named employee. An approval step is actionable only by the employee it names, so this is the only way to move a step whose approver is gone or unassigned.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReassignApprovalStageInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/purchase-orders/{poId}/flip-to-invoice": {
      "post": {
        "operationId": "FlipPurchaseOrderToInvoice",
        "summary": "[Supplier] Convert an approved purchase order into an invoice. When two buyers issued the same PO id, add ?buyer=<buyer Workspace ID> (409 PO_ID_AMBIGUOUS otherwise).",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderSupplierView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-orders"
        ]
      }
    },
    "/exchange-rates": {
      "get": {
        "operationId": "GetExchangeRates",
        "summary": "[Buyer] The currencies this workspace's orders, invoices and suppliers use, each with today's reference rate into your currency. `?currency=` adds one more currency's row. Used only for approval and spend checks; amounts are never converted. Signed-in session only: the rate provider's terms don't allow programmatic access to its rates. Rates by Exchange Rate API.",
        "parameters": [
          {
            "name": "currency",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExchangeRatesView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "exchange-rates"
        ]
      },
      "put": {
        "operationId": "SetExchangeRateWarning",
        "summary": "[Buyer] Set how far (percent, 0–100) an invoice's stated rate may be from the reference rate before the invoice is flagged. Default 5. Administrators only, signed-in session only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetWarningPctInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetExchangeRateWarningResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "exchange-rates"
        ]
      }
    },
    "/reference-rate": {
      "get": {
        "operationId": "GetReferenceRate",
        "summary": "[Buyer, Supplier] The reference rate for 1 `from` in `to` on `date` (YYYY-MM-DD, default today), or the latest of the 3 days before it. Returns `{ reference }`, absent when there's no rate. A suggestion for the New invoice form only; the invoice records whatever rate is submitted. Signed-in session only. Rates By Exchange Rate API.",
        "parameters": [
          {
            "name": "date",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetReferenceRateResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "exchange-rates"
        ]
      }
    },
    "/invoices/connections/{connectionId}": {
      "post": {
        "operationId": "SubmitFeedInvoice",
        "summary": "[Supplier] Submit an invoice - or a credit note: UBL <CreditNote>, a cXML credit memo, or JSON with documentType \"credit_note\" - to one connected buyer from an automated feed (JSON, UBL 2.1 or cXML). API key with the invoices:feed scope only; the buyer must turn on automated invoices for the connection.",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFeedInvoiceInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitFeedInvoiceResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/connections/{connectionId}/validate": {
      "post": {
        "operationId": "ValidateFeedInvoice",
        "summary": "[Supplier] Check an invoice document against one connected buyer exactly as SubmitFeedInvoice would, writing nothing: no invoice, no number reservation, no notification. Same key, scope, formats and refusals; the buyer's switch is reported (feedEnabled) instead of enforced; 200 test calls per connection per day.",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFeedInvoiceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateFeedInvoiceResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices": {
      "get": {
        "operationId": "ListInvoices",
        "summary": "[Both] List invoices - optionally scoped to a createdAt range via ?from=&to=. ?documentType=credit_note lists credit notes instead, ?documentType=all both, newest first; every item carries documentType (default invoice). A Buyer caller gets the invoices it received; a Supplier caller gets the invoices it issued to its buyers, in a reduced view (see GetInvoice).",
        "parameters": [
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or after this are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "ISO 8601 date/timestamp - only items created on or before this are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentType",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListInvoicesItem"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      },
      "post": {
        "operationId": "CreateInvoice",
        "summary": "[Both] Record an invoice - or, with \"documentType\": \"credit_note\" and the body of CreateCreditNote, a credit note. JSON with connectionId: an invoice for one active counterparty (a buyer for one of its suppliers, including an off-platform cloud provider from GET .../invoices/counterparties; a supplier for one of its buyers, signed-in session only). The server computes the total from the line items, stores it in the buyer's workspace, and whoever entered it can't approve, resolve, export or record payment for it unless a signed-in person is the only one in the workspace who could; paying it through Stripe always takes someone else. cXML or UBL (buyer only): a supplier's document as received. JSON with supplier and amount and no connectionId (buyer only): deprecated, accepted until v2. A Supplier API key gets 400 SUPPLIER_DIRECT_INVOICE_RETIRED.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManualInvoiceInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateInvoiceResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/counterparties": {
      "get": {
        "operationId": "ListInvoiceCounterparties",
        "summary": "[Both] Active counterparties the caller can invoice through POST .../invoices with a connectionId - connection id, display name, the buyer's currency, and the open POs between exactly that pair; a Supplier caller also gets the buyer's regionName. One row per counterparty; a Buyer caller can pass ?perConnection=true to list every approved connection instead, each with approvedAt, feedReadiness and the feed's figures (feedAcceptedCount, feedLastAcceptedAt, feedValidCount, feedLastValidAt) and, when a supplier has several, multipleConnections. Without ?perConnection a Buyer caller also gets its off-platform suppliers: any supplier in its list with no Pleaxy account yet, invited or not (offPlatform: true, cloudProvider for a cloud provider, no POs). For those, currency is only the default: the invoice takes its own currency. Human session only.",
        "parameters": [
          {
            "name": "perConnection",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInvoiceCounterpartiesResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}": {
      "get": {
        "operationId": "GetInvoice",
        "summary": "[Both] Get a single invoice, or with a credit note's id (CN-…) that credit note; documentType says which. A Supplier caller gets a reduced view - no approval workflow detail (requester/stages/history/autonomy, collapsed to a bare status), no usageAmount/tolerancePct (the buyer's matching internals), no submittedBy. A Supplier whose id two buyers both issued gets 409 INVOICE_ID_AMBIGUOUS and picks one with ?buyer=<buyer Workspace ID>. A Buyer caller also gets, on a replaced invoice, replacement (whether its credit notes cover it in full), and on a replacement, uncreditedOriginals (credit and rebill).",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/reconciliation": {
      "get": {
        "operationId": "GetInvoiceReconciliation",
        "summary": "[Buyer] An invoice's match result as the UCP vendor capability ai.pleaxy.procurement.reconciliation returns it (https://pleaxy.ai/docs/mcp#ucp): the order, contract and usage records it was checked against, each check group's result, every failure by check name with Pleaxy's code and figures, and the first failure in a fixed order. Read-only: it changes nothing. Codes and figures only, no plain-language text. Pleaxy stores failures, not passes, so a group says no_failures_recorded where its check runs only when its data is there.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceReconciliationResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/replaces": {
      "post": {
        "operationId": "AddInvoiceReplacementLinks",
        "summary": "[Buyer] Name the invoices this invoice replaces (credit and rebill, credit notes spec §20), when that wasn't known as it was entered: { invoiceIds }, 1–20 invoices or debit notes from the same supplier. Each original then lists it in replacedByInvoiceIds; links already there are kept. 404 REPLACES_NOT_FOUND, 400 REPLACES_INVALID, 409 REPLACEMENT_CHANGED.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddReplacementLinksInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddInvoiceReplacementLinksResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/replaces/{originalId}": {
      "delete": {
        "operationId": "RemoveInvoiceReplacementLink",
        "summary": "[Buyer] Undo a replacement link entered wrongly (credit notes spec §20), on both invoices. The rejected invoice an invoice corrects on its purchase order stays linked.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "originalId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveInvoiceReplacementLinkResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/run-match": {
      "post": {
        "operationId": "RunInvoiceMatch",
        "summary": "[Buyer] Match an invoice: against the provider's usage for a cloud provider's order (Pleaxy runs that match itself as the invoice arrives; call this when it couldn't, e.g. no figure was in yet); otherwise against its PO and contract (2-way) and, on a 3-way order, what was received. On an invoice held as a discrepancy against its PO or contract (discrepancyReason: controls), checks it again against the PO and contract as they stand now: still over, its controlFindings are brought up to date; within them, it goes back to the match it would have been created with. Only against an approved PO.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/resolve-discrepancy": {
      "post": {
        "operationId": "ResolveInvoiceDiscrepancy",
        "summary": "[Buyer] Resolve a matching discrepancy - an unverified invoice needs a signed-in person, not an API key",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/approve": {
      "post": {
        "operationId": "ApproveInvoice",
        "summary": "[Buyer] Approve an invoice - only the current stage's assigned approver may call this",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/reject": {
      "post": {
        "operationId": "RejectInvoice",
        "summary": "[Buyer] Reject an invoice with a reason the supplier sees - only the current stage's assigned approver may call this, or, for an unverified/discrepancy invoice with no approval chain yet, any buyer with invoices:edit. Human session only: an API key gets 403 HUMAN_APPROVAL_REQUIRED. Rejecting a PO-backed invoice reopens its purchase order for a corrected invoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RejectInvoiceInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/bank-account": {
      "get": {
        "operationId": "GetInvoiceBankAccount",
        "summary": "[Both] Whether this invoice's payment waits on its supplier's bank account (supplier risk): hold is first_payment (the billing lane's account isn't approved yet) or differs_from_file (the invoice names other details than the approved account); absent when it can be paid. A Buyer caller also gets the lane's account on file (numbers masked) and supplierKey. Exporting it for payment waits; recording a payment made elsewhere and paying through Pleaxy don't. Takes the same ?buyer= as GetInvoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceBankAccountResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/approval/reassign": {
      "post": {
        "operationId": "ReassignInvoiceApprovalStage",
        "summary": "[Buyer, administrator] Reassign one pending approval step of this invoice to a different named employee. An approval step is actionable only by the employee it names, so this is the only way to move a step whose approver is gone or unassigned.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReassignApprovalStageInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/payment-record": {
      "post": {
        "operationId": "RecordPayment",
        "summary": "[Buyer] Record a payment the buyer already made outside Pleaxy, in full: { method: ach|wire|check|card|other, paymentDate: YYYY-MM-DD, reference }, optionally with a remittance for the supplier: { remittance: { note?, file?: { fileId, fileName } } } (see SendRemittance). Pleaxy moves no money and doesn't check the payment happened; the supplier is notified and gets a remittance advice marked as recorded by the buyer. The date can't be later than today in the workspace's time zone or before the invoice date. An amount is refused (400). Repeating the same details returns 200 with alreadyRecorded: true; different details are 409 PAYMENT_ALREADY_RECORDED. A replaced invoice its credit notes don't cover in full is 409 REPLACED_UNCREDITED until you send confirmReplaced: true: paying it as well as its replacement pays twice. Human session only: an API key gets 403 HUMAN_SESSION_REQUIRED.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordPaymentInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordPaymentResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      },
      "delete": {
        "operationId": "WithdrawPaymentRecord",
        "summary": "[Buyer] Withdraw a payment record: { confirm: true }. The invoice reads as unpaid again, the supplier is told, and any later remittance advice is marked Revised or Withdrawn. It doesn't cancel or reverse any payment. 409 NO_PAYMENT_RECORD when there is none. Human session only.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/payment-records": {
      "post": {
        "operationId": "RecordPayments",
        "summary": "[Buyer] Record payments your ERP or bank feed already made outside Pleaxy - wires, checks, ACH, card - so each supplier gets its payment notice, remittance advice and sync event without anyone retyping it: { payments: [{ invoiceId, method, paymentDate, reference, note?, ...RecordPayment's currency and withholding fields }] }, 1-50 per call. Each payment follows RecordPayment's rules and is answered on its own: { results: [{ invoiceId, outcome: recorded|already_recorded|refused, status, code?, message?, messageId?, params? }], recorded, alreadyRecorded, refused }, always 200 once the body is valid. Repeating a payment is safe (already_recorded). An invoice approved by an API key is still refused. Up to 500 payments per key per UTC day; past that each payment is refused with 429 RATE_LIMITED. Every call that records a payment raises a payments_recorded_by_key notification in the workspace naming the key and the invoices, so a payment nobody made is seen and withdrawn. API key with the payments:record scope only, minted with a procurementRole that can edit invoices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordPaymentsBatchInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordPaymentsResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/payment-export": {
      "post": {
        "operationId": "ExportInvoicesForPayment",
        "summary": "[Buyer] Export approved, unpaid invoices as CSV for your own payment run, due date first, up to 1,000. Send { invoiceIds: [...] } to export only those (a row's Export for payment); without it, every eligible invoice. A replaced invoice its credit notes don't cover in full is left out of a full export, and is 409 REPLACED_UNCREDITED when named until you send confirmReplaced: true (credit and rebill). Each exported invoice is locked until its payment is recorded or the export is withdrawn. Send paymentDate (YYYY-MM-DD, today or later: the day your run pays) to take early-payment discounts: an invoice whose deadline is on or after that date is exported at its amount due less the discount when takeEarlyPaymentDiscounts is true (default: the workspace's setting), and the file adds payment_date, early_payment_discount, early_payment_deadline and remittance_info (a line for the payment's reference); a run dated after the deadline pays the full amount. 400 PAYMENT_RUN_DATE_INVALID for a date in the past or over a year ahead. Headers: X-Pleaxy-Export-Id, X-Pleaxy-Export-Count, X-Pleaxy-Export-Truncated, X-Pleaxy-Export-Discounted (how many take a discount). 422 NOTHING_TO_EXPORT when none are eligible. No bank details. Human session only.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentExportInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/payment-exports/{exportId}": {
      "get": {
        "operationId": "GetPaymentExport",
        "summary": "[Buyer] Download an export again: the same CSV, rebuilt from the invoices still exported under that export ID. 404 EXPORT_NOT_FOUND when none are.",
        "parameters": [
          {
            "name": "exportId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/payment-export": {
      "delete": {
        "operationId": "WithdrawPaymentExport",
        "summary": "[Buyer] Withdraw an invoice's export: { confirmNotPaid: true }. It goes back to Approved but can't be exported or recorded again until the next business day, and the next export marks it previously_exported_at. Pleaxy can't see or cancel anything in your own payment tool. Human session only.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/remittance-advice": {
      "get": {
        "operationId": "GetRemittanceAdvice",
        "summary": "[Both] The remittance advice for a recorded payment, as a PDF: marked as recorded by the buyer and not made through Pleaxy. Marked Revised after a re-record, Withdrawn after a withdrawal. 404 NO_PAYMENT_RECORD when none was recorded. Takes the same ?buyer= qualifier as GetInvoice. Send `Accept: application/pdf`.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/remittance-upload": {
      "post": {
        "operationId": "RequestRemittanceUpload",
        "summary": "[Buyer] A presigned URL to upload a proof of payment (a bank's transfer receipt) for an approved or paid invoice: { contentType: application/pdf|image/png|image/jpeg }. PUT the file to uploadUrl with that Content-Type within 5 minutes, up to maxBytes (10 MB), then send its fileId with SendRemittance or RecordPayment's remittance. An upload nothing attaches is deleted after a couple of days. Human session only.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestRemittanceUploadInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestRemittanceUploadResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/remittance": {
      "get": {
        "operationId": "GetInvoiceRemittance",
        "summary": "[Both] The payment signal for an invoice, for the supplier's cash application: status unpaid|recorded|processing|paid_through_pleaxy|withdrawn, or failed with failedAt (a buyer caller only: its latest payment through Pleaxy failed), and once paid the method (ach, wire, check, card, other; credit or nothing_due when Pleaxy closed it; stripe), paymentDate, reference, adviceVersion, an early-payment discount the buyer took (earlyPaymentDiscount), what was withheld, netPaid after both, a payment in another currency, and the remittances the buyer sent (notes, proofs of payment: download one with GetRemittanceFile). The same as cXML or UBL: GetInvoiceRemittanceDocument. Never who at the buyer recorded it. Takes the same ?buyer= as GetInvoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemittanceView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      },
      "post": {
        "operationId": "SendRemittance",
        "summary": "[Buyer] Send the supplier a remittance for a paid invoice: { note?, file?: { fileId, fileName } }, at least one. The note (up to 1,000 characters) goes in the supplier's notification, which its Slack or Teams channel also gets when routed there; the file is a proof of payment uploaded with RequestRemittanceUpload. Up to 20 per invoice. 409 REMITTANCE_NEEDS_PAYMENT before a payment is recorded. Human session only.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendRemittanceInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/remittances/{remittanceId}/file": {
      "get": {
        "operationId": "GetRemittanceFile",
        "summary": "[Both] A link, valid for 5 minutes, to the proof of payment a remittance carries: { url, fileName, contentType }. 404 REMITTANCE_NOT_FOUND when the remittance has no file. Takes the same ?buyer= qualifier as GetInvoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "remittanceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetRemittanceFileResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/invoices/{invoiceId}/remind": {
      "post": {
        "operationId": "RemindInvoice",
        "summary": "[Supplier] Send a reminder for an invoice waiting on approval, or a payment reminder for an approved, unpaid one. At most one a day per invoice. When two buyers issued the same invoice id, add ?buyer=<buyer Workspace ID> (409 INVOICE_ID_AMBIGUOUS otherwise).",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceSupplierView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/bank-accounts/review": {
      "get": {
        "operationId": "ListBankAccountsToApprove",
        "summary": "[Buyer] Suppliers' bank accounts waiting for approval: a billing lane's first account (status unverified) or a change (status changing, with pendingChange). Invoices paid to them wait until they are approved. Numbers masked to the last four.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BankAccountView"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "bank-accounts"
        ]
      }
    },
    "/bank-accounts/suppliers/{connectionId}": {
      "get": {
        "operationId": "ListSupplierBankAccounts",
        "summary": "[Buyer] A supplier's bank accounts on file, one per billing lane (payee and currency): details masked to the last four, status unverified|verified|changing, how each was approved (approval.verification: supplier_confirmed|buyer_approved|paid_before, approval.check.method) and the last 10 events.",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BankAccountView"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "bank-accounts"
        ]
      }
    },
    "/screening/review": {
      "get": {
        "operationId": "ListScreeningMatches",
        "summary": "[Buyer] Suppliers whose sanctions screening has a possible match to review (status possible_match) or a confirmed one (confirmed_match). Payments to them wait; a supplier with a confirmed match takes no new orders or buyer-entered invoices. Empty while screening is off.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SupplierScreening"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "screening"
        ]
      }
    },
    "/screening/suppliers/{connectionId}": {
      "get": {
        "operationId": "GetSupplierScreening",
        "summary": "[Buyer] A supplier's sanctions screening: { enabled, screening? } with status clear|possible_match|confirmed_match, the names screened (subjects: its name, an earlier name, its bank accounts' payees), the list versions, and matches - each the listed entry it resembles (list, names, countries, programmes), the score, and its state open|dismissed|confirmed|closed with who decided and why.",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSupplierScreeningResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "screening"
        ]
      }
    },
    "/ai-providers": {
      "get": {
        "operationId": "ListAiProviders",
        "summary": "[Buyer] The workspace's direct AI provider connections (OpenAI, Anthropic, Mistral, Snowflake): status, last sync, and the key's last four characters - never the key. 'view' on suppliers or on invoices.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AiProvider"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-providers"
        ]
      },
      "post": {
        "operationId": "CreateAiProvider",
        "summary": "[Buyer] Connect a direct AI provider whose connector is switched on. OpenAI, Anthropic and Mistral take a read-only admin key, checked with one read before anything is saved and then stored KMS-encrypted; Snowflake gets a key pair Pleaxy generates, returned pending with its public key to assign to the service user (sync then finishes connecting). Seat tools read only the month's active users for the seat check: Cursor (an Admin API key), Slack (a workspace admin's xoxp- user token with the admin scope) and Zoom (a Server-to-Server OAuth app: `zoom.accountId` and `zoom.clientId`, the client secret as key). Usage-billed suppliers read only the month's billed total, for the invoice check: Datadog (`datadog.site` and `datadog.apiKey`, a service account's application key scoped to usage_read and billing_read as key), Twilio (`twilio.accountSid` and `twilio.keySid`, a restricted key's secret with Usage Records read as key), MongoDB Atlas (`mongodb.orgId` and `mongodb.clientId`, an Organization Billing Viewer service account's client secret as key), Confluent Cloud (`confluent.keyId`, a BillingAdmin service account's Cloud API key secret as key) and Vercel (`vercel.teamId`, a team-scoped token as key). Confluent and Vercel offer no read-only billing credential: theirs can also change billing settings, and Pleaxy only reads with it. Seats the provider's pre-created supplier row. Counts toward the plan's provider limit. 'create' on suppliers.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAiProviderInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiProvider"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-providers"
        ]
      }
    },
    "/ai-providers/{id}": {
      "delete": {
        "operationId": "DeleteAiProvider",
        "summary": "[Buyer] Disconnect a direct AI provider: the connection and its encrypted key are deleted; its AI lines stay as history. Revoke the key at the provider too. Logged-in users only, 'edit' on suppliers.",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAiProviderResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-providers"
        ]
      }
    },
    "/ai-providers/{id}/sync": {
      "post": {
        "operationId": "SyncAiProvider",
        "summary": "[Buyer] Read a direct AI provider's cost and usage reports now (at most every 15 minutes); a pending Snowflake key pair is verified first. 'create' on suppliers or 'edit' on invoices.",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiProvider"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-providers"
        ]
      }
    },
    "/ai-providers/{provider}/supplier": {
      "post": {
        "operationId": "AddAiProviderSupplier",
        "summary": "[Buyer] Add an AI invoicer (openai, anthropic, mistral, cohere, xai, openrouter, snowflake, databricks, coreweave, lambda, nebius, crusoe, cursor, github, microsoft, slack, zoom) to the suppliers list without connecting: its pre-created supplier row, pending invite. Idempotent; connecting later links to the same row. 409 SUPPLIER_ALREADY_LISTED when a supplier of that name already has a relationship under way. 'create' on suppliers.",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddAiProviderSupplierResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-providers"
        ]
      }
    },
    "/ai-invoicers": {
      "get": {
        "operationId": "ListAiInvoicers",
        "summary": "[Buyer] The AI invoicers Pleaxy pre-creates as suppliers: names, the legal entities they invoice from by region, billing currencies, billing kinds, invoice sender domains, and whether each can be connected. 'view' on suppliers or on invoices.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListAiInvoicersItem"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-providers"
        ]
      }
    },
    "/budget-control": {
      "get": {
        "operationId": "GetBudgetControl",
        "summary": "[Buyer] Whether budgets are checked (off, warn or block) and over what period (month, quarter or year)",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BudgetControlSettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "budget-control"
        ]
      },
      "patch": {
        "operationId": "UpdateBudgetControl",
        "summary": "[Buyer] Change budget control. Applies to orders and requests submitted or approved from now on. Needs a signed-in session.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBudgetControlInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BudgetControlSettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "budget-control"
        ]
      }
    },
    "/budget-control/status": {
      "get": {
        "operationId": "GetBudgetStatus",
        "summary": "[Buyer] Budget, committed (approved orders not yet invoiced), actual (approved invoices) and remaining per cost center for the current period",
        "parameters": [
          {
            "name": "costCenter",
            "required": false,
            "in": "query",
            "description": "One cost center; every budgeted one when absent.",
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "name": "date",
            "required": false,
            "in": "query",
            "description": "A day (YYYY-MM-DD) in the period to report; today when absent.",
            "schema": {
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetBudgetStatusResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "budget-control"
        ]
      }
    },
    "/budget-control/check": {
      "post": {
        "operationId": "CheckBudget",
        "summary": "[Buyer] Preview the budget check for an amount on a cost center, against its budget in the amount's currency: within, over, no_budget or off. Writes nothing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BudgetCheckInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BudgetCheck"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "budget-control"
        ]
      }
    },
    "/credit-notes": {
      "get": {
        "operationId": "ListCreditNotes",
        "summary": "[Both] List credit notes: a Buyer caller gets the ones it received, a Supplier caller the ones it issued, each with what's left to apply (remaining).",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCreditNotesResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      },
      "post": {
        "operationId": "CreateCreditNote",
        "summary": "[Both] Issue a credit note against the invoice it corrects (invoiceId) or a counterparty (connectionId); a buyer records one it received the same way, optionally from a document Pleaxy read (sourceImportId). Its total is computed from its lines and tax. One that corrects an invoice and isn't for more than it is accepted at once; otherwise the buyer accepts or rejects it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCreditNoteInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCreditNoteResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/credit-notes/settings": {
      "get": {
        "operationId": "GetCreditSettlement",
        "summary": "[Buyer] Who settles accepted credits: pleaxy (applied to invoices here) or accounting_system (exported for your ERP to clear). chosen: false when it's the default.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCreditSettlementResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      },
      "put": {
        "operationId": "SetCreditSettlement",
        "summary": "[Buyer] Choose who settles accepted credits. 409 CREDITS_APPLIED_TO_UNPAID when moving to accounting_system while credits sit on unpaid invoices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditSettlementInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetCreditSettlementResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/credit-notes/{creditNoteId}": {
      "get": {
        "operationId": "GetCreditNote",
        "summary": "[Both] One credit note, with what it corrects, the PO balance it gave back, where its money went and what's left of it.",
        "parameters": [
          {
            "name": "creditNoteId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCreditNoteResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/credit-notes/{creditNoteId}/pdf": {
      "get": {
        "operationId": "GetCreditNotePdf",
        "summary": "[Both] The credit note's own PDF, as attached when it was issued or the document it was recorded from. 404 CREDIT_NOTE_NO_PDF when it has none (hasPdf is false). Send `Accept: application/pdf`, or the deployed API returns the body base64-encoded.",
        "parameters": [
          {
            "name": "creditNoteId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/credit-notes/{creditNoteId}/accept": {
      "post": {
        "operationId": "AcceptCreditNote",
        "summary": "[Buyer] Accept a credit note. A correction gives PO balance back; when Pleaxy settles credits, it's applied to the unpaid invoice it corrects.",
        "parameters": [
          {
            "name": "creditNoteId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuyerCreditNoteView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/credit-notes/{creditNoteId}/reject": {
      "post": {
        "operationId": "RejectCreditNote",
        "summary": "[Buyer] Reject a credit note waiting for acceptance, with a reason the supplier reads.",
        "parameters": [
          {
            "name": "creditNoteId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RejectCreditNoteInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuyerCreditNoteView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/credit-notes/{creditNoteId}/void": {
      "post": {
        "operationId": "VoidCreditNote",
        "summary": "[Supplier] Void a credit note the buyer hasn't decided on yet. Its number stays used.",
        "parameters": [
          {
            "name": "creditNoteId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierCreditNoteView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/invoices/{invoiceId}/available-credits": {
      "get": {
        "operationId": "ListAvailableCredits",
        "summary": "[Buyer] Accepted credits from the invoice's supplier in its currency, oldest first, each with a suggested amount; pending ones to accept; and whether the invoice can take credits.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAvailableCreditsResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/invoices/{invoiceId}/credit-applications": {
      "post": {
        "operationId": "ApplyCredits",
        "summary": "[Buyer] Apply accepted credit notes to an invoice, all or none, up to what it owes; an approved invoice covered in full is marked paid by credit. 409 when credits are settled in your accounting system.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyCreditsInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyCreditsResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/invoices/{invoiceId}/credit-applications/{applicationId}": {
      "delete": {
        "operationId": "RemoveCreditApplication",
        "summary": "[Buyer] Take a credit back off an invoice that isn't exported or paid. It goes back to its credit note.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "applicationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveCreditApplicationResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "credit-notes"
        ]
      }
    },
    "/purchase-orders/{poId}/fulfillment": {
      "get": {
        "operationId": "GetPurchaseOrderFulfillment",
        "summary": "[Both] What the supplier said about an order: { confirmation?, confirmations, shipNotices, shippedByLine, expectedDeliveryDate? }. confirmation is the latest (outcome accepted|backordered|changed|partial|rejected, lines with status accept|backordered|change|reject, qty, unitPrice, dates and reason, and the buyer's decision on a changed one: applied or declined); shipNotices are the shipments (status planned|shipped|canceled, carrier, trackingNumber, trackingUrl, lines); shippedByLine adds up what shipped, canceled and planned shipments left out. A ship notice is never a receipt: what arrives is confirmed with a goods receipt. Takes the same ?buyer= as GetPurchaseOrder.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderFulfillment"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/purchase-orders/{poId}/confirmations": {
      "post": {
        "operationId": "ConfirmPurchaseOrder",
        "summary": "[Supplier] Confirm an order, as a cXML ConfirmationRequest would: { type: accept|backordered|detail|reject, confirmId?, deliveryDate?, note?, lines?: [{ lineNo, status: accept|backordered|change|reject, qty?, unitPrice?, substitute?: { supplierPartId, name }, shipmentDate?, deliveryDate?, reason? }] }. accept, backordered and reject speak for the whole order; detail names its lines, and a line it leaves out is accepted as ordered. A change offers another quantity (qty, the new total for the line), unit price (in the order's currency) or item (substitute: a part number in your published catalog makes it that catalog item) on a line ordered by quantity; one that matches the order is an acceptance. Answers the stored confirmation with its outcome: accepted, backordered, changed (for the buyer to apply with ApplyConfirmationChanges or decline), partial (some lines refused) or rejected. The buyer's requester and receiver are told when the outcome changes, and the buyer's sync feed gets purchase_order.confirmed. The order itself doesn't change: a refused order is the buyer's to cancel. Only an order still awaiting fulfillment, not one already billed in full; 409 ORDER_NOT_OPEN otherwise. Takes the same ?buyer= as GetPurchaseOrder. An API key needs the orders:fulfill scope.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderConfirmationInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderConfirmation"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/purchase-orders/{poId}/confirmations/{confirmationId}/apply": {
      "post": {
        "operationId": "ApplyConfirmationChanges",
        "summary": "[Buyer] Take the new quantities and unit prices in the supplier's latest confirmation (outcome changed) into the order: { purchaseOrder, confirmation }. An ordinary line edit, as UpdatePurchaseOrder: the order gets a new version, goes back to approval when its rules say so, and the supplier hears po_changed. 409 CONFIRMATION_SUPERSEDED when the supplier confirmed again since, CONFIRMATION_DECIDED when it was already applied or declined, NO_CHANGES, or ORDER_NOT_OPEN.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "confirmationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyConfirmationChangesResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/purchase-orders/{poId}/confirmations/{confirmationId}/decline": {
      "post": {
        "operationId": "DeclineConfirmationChanges",
        "summary": "[Buyer] Keep the order as it is instead of the supplier's new quantities and prices: { reason? } (500 characters, shown to the supplier). Answers the confirmation with its decision; the supplier is told (po_changes_declined). The same 409s as ApplyConfirmationChanges.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "confirmationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeclineConfirmationChangesInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderConfirmation"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/purchase-orders/{poId}/ship-notices": {
      "post": {
        "operationId": "SendShipNotice",
        "summary": "[Supplier] Tell the buyer a shipment is on its way (an advance ship notice, as a cXML ShipNoticeRequest would): { shipmentId, status?: shipped|planned|canceled, shipmentDate?, deliveryDate?, carrier?, trackingNumber?, trackingUrl? (https), note?, lines: [{ lineNo, qty }] }. Only goods lines (lineType goods) ordered by quantity ship; a service line is confirmed with a service entry sheet. Sending a shipmentId again replaces that shipment; status canceled withdraws it (404 SHIPMENT_NOT_FOUND if there is none) and needs no lines. The buyer's requester and receiver are told of a new shipment or a new status, and the buyer's sync feed gets purchase_order.shipped. Never a receipt: the buyer still confirms what arrives. Only an open order (awaiting_fulfillment or invoiced), except to withdraw; 409 ORDER_NOT_OPEN otherwise. Takes the same ?buyer= as GetPurchaseOrder. An API key needs the orders:fulfill scope.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateShipNoticeInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipNotice"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/sync/events": {
      "get": {
        "operationId": "ListSyncEvents",
        "summary": "[Both] What changed, oldest first, to keep another system in step: { events: [{ id, at, type, documentType, documentId, buyerWorkspaceId? }], nextCursor, hasMore }. A supplier gets purchase_order.issued|changed|canceled|rejected, invoice.received|approved|rejected|paid|payment_withdrawn|remittance_sent|credit_applied, invoice.updated (the buyer holds the invoice for review, or the hold is over: GetInvoiceStatus says which) and credit_note.accepted|rejected; a buyer gets invoice.received and credit_note.received (a supplier sent one), invoice.updated (an approval step approved it, including an automatic approval, it was rejected, or its supplier confirmed bank details or reported it), invoice.payment (a payment was recorded or withdrawn, credit or a zero amount settled it, or a payment through Pleaxy succeeded, failed or was released: read GetInvoiceRemittance), purchase_order.updated (approved, rejected or canceled), and purchase_order.confirmed / purchase_order.shipped (the supplier confirmed or shipped against it: read GetPurchaseOrderFulfillment). An event names the document only: read it with GetPurchaseOrder, GetPurchaseOrderDocument, GetInvoiceStatus or GetInvoiceRemittance (pass buyerWorkspaceId as ?buyer=). Pass nextCursor back as ?after= on the next call; call again at once while hasMore is true. ?limit= 1-500 (default 100). Events are kept 30 days and delivered at least once; the newest 5 seconds wait for the next call. A buyer sees only the document types its procurement role can view.",
        "parameters": [
          {
            "name": "after",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncEventPage"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/purchase-orders/{poId}/document": {
      "get": {
        "operationId": "GetPurchaseOrderDocument",
        "summary": "[Both] An issued purchase order as a document another system takes in: ?format=cxml (the default: a cXML OrderRequest, type new, update from version 2, delete once canceled) or ?format=ubl (a UBL 2.1 Order, or an OrderCancellation once canceled). The supplier's copy whoever asks, as GetPurchaseOrderPdf. Takes the same ?buyer= as GetPurchaseOrder. 409 ORDER_NOT_ISSUED for a draft, an order in approval or a rejected one.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ubl",
                "cxml"
              ]
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/invoices/{invoiceId}/document": {
      "get": {
        "operationId": "GetInvoiceDocument",
        "summary": "[Both] An invoice as a UBL 2.1 Invoice (?format=ubl, the default and only format), for the buyer's ERP to book or the supplier's archive: the lines, document-level discounts and charges, tax and withholdings, prepayments, the supplier's payment instructions, the PO and contract it bills. The supplier's view whoever asks: no matching, findings or approvals. Takes the same ?buyer= as GetInvoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ubl"
              ]
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/invoices/{invoiceId}/status": {
      "get": {
        "operationId": "GetInvoiceStatus",
        "summary": "[Both] Where an invoice stands, for the system that sent it or the one that pays it: status received|in_process|under_query|approved|payment_in_progress|paid|rejected|duplicate, with responseCode (UNCL4343: AB, IP, UQ, AP, RE, PD), cxmlStatus, queryReason, the rejection's reason, amountDue and dueDate. The same as cXML or UBL: GetInvoiceStatusDocument. The supplier's view whoever asks. Takes the same ?buyer= as GetInvoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceStatusView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/invoices/{invoiceId}/status/document": {
      "get": {
        "operationId": "GetInvoiceStatusDocument",
        "summary": "[Both] GetInvoiceStatus as a document: ?format=cxml (the default: a cXML StatusUpdateRequest with an InvoiceStatus) or ?format=ubl (a UBL 2.1 ApplicationResponse with the Peppol Invoice Response codes). Takes the same ?buyer= as GetInvoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ubl",
                "cxml"
              ]
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/invoices/{invoiceId}/remittance/document": {
      "get": {
        "operationId": "GetInvoiceRemittanceDocument",
        "summary": "[Both] GetInvoiceRemittance as a document: ?format=cxml (the default: a cXML PaymentRemittanceRequest) or ?format=ubl (a UBL 2.1 RemittanceAdvice). 409 NO_PAYMENT until a payment is recorded or has gone through. Takes the same ?buyer= as GetInvoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ubl",
                "cxml"
              ]
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "ListWebhooks",
        "summary": "[Both, admin] Your side's webhook endpoints and the event types they can take: { endpoints: [{ id, url, description, events, enabled, secretHint, lastAttemptAt, lastStatus, lastErrorCode, lastSuccessAt, failedDeliveries }], eventTypes }. Never the signing secret.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWebhooksResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      },
      "post": {
        "operationId": "CreateWebhook",
        "summary": "[Both, admin] Add an endpoint: { url, description?, events? }. Every event of those types (all of your side's when events is left out) is POSTed to it as JSON - ListSyncEvents' event plus workspaceId and documentPath - signed in the Pleaxy-Signature header (t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<body>\">) with the secret returned here, once. A 2xx within 10 seconds is delivered; anything else is retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h, then given up. Up to 5 per side. Signed-in administrators only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWebhookResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/webhooks/{webhookId}": {
      "delete": {
        "operationId": "DeleteWebhook",
        "summary": "[Both, admin] Remove an endpoint. Deliveries still waiting for it are given up.",
        "parameters": [
          {
            "name": "webhookId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": ""
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      },
      "patch": {
        "operationId": "UpdateWebhook",
        "summary": "[Both, admin] Change an endpoint's url, description or events, or pause and resume it with enabled. Resuming clears its count of failed deliveries.",
        "parameters": [
          {
            "name": "webhookId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/webhooks/{webhookId}/secret": {
      "post": {
        "operationId": "RotateWebhookSecret",
        "summary": "[Both, admin] A new signing secret for an endpoint, returned this once; the old one stops signing at once.",
        "parameters": [
          {
            "name": "webhookId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateWebhookSecretResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/webhooks/{webhookId}/test": {
      "post": {
        "operationId": "TestWebhook",
        "summary": "[Both, admin] Send the endpoint a signed ping now, once: { ok, status?, errorCode?, durationMs }.",
        "parameters": [
          {
            "name": "webhookId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestWebhookResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/webhooks/{webhookId}/deliveries": {
      "get": {
        "operationId": "ListWebhookDeliveries",
        "summary": "[Both, admin] An endpoint's last 50 deliveries, newest first: { deliveries: [{ eventId, type, status: pending|delivered|failed, attempts, createdAt, nextAttemptAt, lastAttemptAt, lastStatus, lastErrorCode, deliveredAt }] }. Kept 30 days.",
        "parameters": [
          {
            "name": "webhookId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWebhookDeliveriesResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "document-sync"
        ]
      }
    },
    "/purchase-requests": {
      "get": {
        "operationId": "ListPurchaseRequests",
        "summary": "[Buyer] Purchase requests the caller can see, newest first: their own, everyone's with purchase order access, and any waiting on them",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "draft",
                "pending_approval",
                "approved",
                "sourcing",
                "ordered",
                "rejected",
                "canceled"
              ],
              "type": "string"
            }
          },
          {
            "name": "mine",
            "required": false,
            "in": "query",
            "description": "true: only the caller's own requests.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "awaitingMe",
            "required": false,
            "in": "query",
            "description": "true: only the requests waiting on the caller's approval (the approvals queue).",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PurchaseRequest"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      },
      "post": {
        "operationId": "CreatePurchaseRequest",
        "summary": "[Buyer] Ask for something: saved as a draft, or submitted for approval with `submit: true`. Any workspace member.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePurchaseRequestInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseRequest"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/files/upload-url": {
      "post": {
        "operationId": "RequestPurchaseRequestFileUpload",
        "summary": "[Buyer] A presigned URL to upload the answer to a request form's 'file' question (PDF, image, Word, Excel, CSV or text, up to 25 MB). PUT the file there, then save the answer with the returned fileId. Any workspace member, before or after the request exists.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestFileUploadInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestPurchaseRequestFileUploadResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/{requestId}": {
      "get": {
        "operationId": "GetPurchaseRequest",
        "summary": "[Buyer] One purchase request, with its approval chain, budget check and the order it became",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseRequest"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      },
      "patch": {
        "operationId": "UpdatePurchaseRequest",
        "summary": "[Buyer] The requester changes a draft, or a request waiting for approval (which sends it back through approval)",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePurchaseRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseRequest"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/{requestId}/files/{fileId}": {
      "get": {
        "operationId": "GetPurchaseRequestFile",
        "summary": "[Buyer] A short-lived link to a file answering one of the request's questions, for whoever may see the request",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fileId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPurchaseRequestFileResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/{requestId}/submit": {
      "post": {
        "operationId": "SubmitPurchaseRequest",
        "summary": "[Buyer] The requester submits a draft for approval. Refused (409) over budget when budgets are enforced.",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseRequest"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/{requestId}/approve": {
      "post": {
        "operationId": "ApprovePurchaseRequest",
        "summary": "[Buyer] Approve a purchase request - only the current step's approver, signed in",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovePurchaseRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseRequest"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/{requestId}/reject": {
      "post": {
        "operationId": "RejectPurchaseRequest",
        "summary": "[Buyer] Reject a purchase request with a reason - only the current step's approver",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RejectPurchaseRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseRequest"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/{requestId}/cancel": {
      "post": {
        "operationId": "CancelPurchaseRequest",
        "summary": "[Buyer] The requester, or an administrator, withdraws a request until it is ordered",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseRequest"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/purchase-requests/{requestId}/convert": {
      "post": {
        "operationId": "ConvertPurchaseRequest",
        "summary": "[Buyer] Order an approved request: a purchase order from its lines, supplier, cost center, GL account and quote, each overridable. Within what was approved it keeps the request's approval.",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertPurchaseRequestInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertPurchaseRequestResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "purchase-requests"
        ]
      }
    },
    "/approvals": {
      "get": {
        "operationId": "ListApprovals",
        "summary": "[Buyer] List every purchase order and invoice in this region currently at a stage this employee can act on, plus the ones this employee has already approved or rejected",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalQueue"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "approvals"
        ]
      }
    },
    "/ai-spend": {
      "get": {
        "operationId": "GetAiSpend",
        "summary": "[Buyer] AI spend for a period (YYYY-MM, default this month), grouped by invoicer (default), vendor, model or costCenter: month to date, forecast, last month and the change, usage by meter, and beside each invoicer the open purchase order lines raised to it with what is left. Amounts stay in each invoicer's billing currency; totals are one entry per currency. 'view' on suppliers or on invoices.",
        "parameters": [
          {
            "name": "period",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupBy",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiSpendResponse"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/lines": {
      "get": {
        "operationId": "ListAiUsageLines",
        "summary": "[Buyer] The normalised AI usage lines behind the figures, newest day first, one page at a time (limit 1-500, default 100; pass nextCursor back as cursor). Filter by invoicerId, vendor, model or costCenter. Unmapped usage types keep their raw names with vendor unknown. 'view' on suppliers or on invoices.",
        "parameters": [
          {
            "name": "period",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoicerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "model",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "costCenter",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiUsageLinesPage"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/check": {
      "post": {
        "operationId": "CheckAiSpend",
        "summary": "[Buyer] Whether the period's AI forecast for an invoicer, a purchase order or a cost center fits what its open purchase order lines (and the cost center's budget) have left: fits, over, no_po or no_budget. Nothing is saved and nothing blocks. Name at least one of invoicerId, costCenter and poId. 'view' on suppliers or on invoices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckAiSpendInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiSpendCheckResponse"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-rate-cards": {
      "get": {
        "operationId": "ListAiRateCards",
        "summary": "[Buyer] The public list prices Pleaxy keeps for AI models, by invoicer, vendor, model, meter and region, with effective dates and the pricing page each was taken from. With on (YYYY-MM-DD), only the entry in force that day. A price change is a new entry, never an edit. 'view' on suppliers or on invoices.",
        "parameters": [
          {
            "name": "invoicer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "model",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "on",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AiRateCardEntry"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/po-lines": {
      "get": {
        "operationId": "SuggestAiPoLines",
        "summary": "[Buyer] Purchase order lines for one invoicer's AI usage in a period (default the last closed month): one per model and meter, last month's volume rounded up, priced at the active contract term's rate (or its discount off list), else the list price today, else what the month was billed at - with priceSource saying which. Nothing is saved: the order form or the Assistant raises the PO. 'view' on purchase orders.",
        "parameters": [
          {
            "name": "invoicerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiPoLineSuggestions"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/next-period/{poId}": {
      "post": {
        "operationId": "RaiseNextAiPeriod",
        "summary": "[Buyer] Drafts the same order for the month after its lines': each AI line's quantity is the forecast from this month's usage so far (its own quantity when there is none yet), every other line as it is. Returns the draft purchase order; submitting it goes through the usual approval. 'create' on purchase orders.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/recommendations": {
      "get": {
        "operationId": "GetAiRecommendations",
        "summary": "[Buyer] Recommendations: the AI spend no open order covers in a period (default this month) - an invoicer with no order raised to it (no_po), or a forecast past what its orders have left (over_po), with the gap a new order needs and any draft (draftPoIds) or order waiting on approval (pendingPoIds) already raised for it; accounts, the same for whole cloud accounts (all their spend, from the provider's current estimate, this month only; an account's AI spend is part of it, so never add the two) - and cheaper ways to buy last month's usage: batch (the most moving interactive tokens to the batch rate would save), cache (what each further 10% of input read from the cache saves) and reserve (GPU-hours used at a steady floor most days, with the GPUs that floor keeps busy; no price, the contract decides it). Amounts in each invoicer's currency. 'view' on suppliers or on invoices.",
        "parameters": [
          {
            "name": "period",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiRecommendations"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/draft-orders": {
      "post": {
        "operationId": "DraftAiOrders",
        "summary": "[Buyer] Drafts an order for each invoicer named, for the period (default this month): one line per model and meter of last month's usage at the contract rate (else the list price), each quantity the forecast from this month so far, scaled to the gap when open orders already cover part of it. With scope account, a cloud account from accounts gets one amount line instead (everything the account bills, up to the gap, to the month's end). Returns the drafts and, for an invoicer with nothing to base an order on or no supplier on the list, why it was skipped. Drafts go through the usual approval when submitted. 'create' on purchase orders.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DraftAiOrdersInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiDraftOrdersResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/commitments": {
      "get": {
        "operationId": "ListAiCommitments",
        "summary": "[Buyer] The Commitments tab: each active contract term with a committed spend or reserved capacity, with what the synced AI usage has used of it, what's left and (for spend) the pace to the term's end; and each prepaid credit purchase order line with what its invoices have drawn. 'view' on suppliers or on invoices.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AiCommitmentView"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/renewal-rule": {
      "get": {
        "operationId": "GetAiRenewalRule",
        "summary": "[Buyer] The renewal automation rule: whether next month's AI orders are drafted from the forecast, from which day of the month, whether this month's uncovered spend is drafted too, and their last runs. 'view' on purchase orders.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiRenewalRule"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      },
      "put": {
        "operationId": "SetAiRenewalRule",
        "summary": "[Buyer] Switches the renewal automation rule on or off: on or after dayOfMonth (1-28, default 25), once a month, Pleaxy drafts next month's order for each open order with AI lines, at the forecast, as the person who switched it on. With draftUncovered, it also drafts an order for this month's spend no order covers, once per provider or account a month, from the 3rd, and tells that person the drafts are ready. Drafts are never submitted: a person reviews them and they go through the usual approval. Logged-in users only, 'create' on purchase orders.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAiRenewalRuleInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiRenewalRule"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/attribution": {
      "get": {
        "operationId": "GetAiAttribution",
        "summary": "[Buyer] The attribution rules that map a provider dimension (tag, label, project, workspace, api_key, inference_profile, resource_group, compartment, cluster) to a cost center, in order - first match wins - with what each matched in the period, what no rule matched and the dimension values behind it. 'view' on suppliers or on invoices.",
        "parameters": [
          {
            "name": "period",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiAttributionResponse"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      },
      "put": {
        "operationId": "SetAiAttribution",
        "summary": "[Buyer] Replaces every attribution rule, in order, from the version read (409 when someone saved since). A tag or label rule needs its key; the cost center must be one of the workspace's. An AWS tag or Google Cloud label rule makes the next sync split that account's AI lines by it. 'edit' on purchase orders.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAiAttributionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiAttributionResponse"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/cost-centers": {
      "get": {
        "operationId": "ListAiCostCenters",
        "summary": "[Buyer] Each cost center's budget, committed and actual (budget control's figures) with the month's attributed AI usage as accruing and its forecast, in the budget's currency, the percent with the forecast, and the alert threshold sent; plus what is unattributed. 'view' on purchase orders.",
        "parameters": [
          {
            "name": "period",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiCostCentersResponse"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/seats": {
      "get": {
        "operationId": "ListAiSeatCounts",
        "summary": "[Buyer] The seat products' active users recorded for a month (default this month): what seat invoice lines and seat commitments are held to. 'view' on suppliers or on invoices.",
        "parameters": [
          {
            "name": "period",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AiSeatCount"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      },
      "put": {
        "operationId": "SetAiSeatCount",
        "summary": "[Buyer] Records a seat product's active users for a month, as the identity provider (Okta, Entra, Google Workspace, ...) or the provider's admin console reports them - from a person, a script or an agent; Pleaxy reads no identity provider itself. An invoice billing more seats than that is a finding. 'edit' on invoices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAiSeatCountInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiSeatCount"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/focus-exports": {
      "get": {
        "operationId": "ListFocusExports",
        "summary": "[Buyer] Whether FOCUS export is on for the workspace, and its exports of the last 7 days, newest first (at most 20): range, FOCUS version, rows and documents. 'view' on invoices.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusExportList"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      },
      "post": {
        "operationId": "CreateFocusExport",
        "summary": "[Buyer] Export the workspace's invoices, debit notes and accepted credit notes for billing periods from..to (YYYY-MM, at most 36 months) as a FOCUS Cost and Usage dataset in CSV (version 1.2 by default, or 1.4), with a metadata file. One row per line, tax entry and adjustment; credit notes negative; amounts in each document's currency. include=non_cloud leaves out cloud and AI providers' invoices. Returns download links valid 15 minutes; the files are kept 7 days. 'view' on invoices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFocusExportInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusExport"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-exports/{exportId}": {
      "get": {
        "operationId": "GetFocusExport",
        "summary": "[Buyer] One FOCUS export of the last 7 days, with fresh download links for its CSV and metadata (valid 15 minutes). 'view' on invoices.",
        "parameters": [
          {
            "name": "exportId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusExport"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources": {
      "get": {
        "operationId": "ListFocusSources",
        "summary": "[Buyer] Whether FOCUS import is on, and the workspace's FOCUS sources - uploads, an AWS Data Exports FOCUS export, an Azure Cost Management FOCUS export, Google Cloud's FOCUS table, Oracle Cloud's FOCUS reports or an S3-compatible bucket - each with its last run (months read, rows, skipped rows by reason, or why it failed), the months stored and the most common tag keys. 'view' on invoices.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListFocusSourcesResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      },
      "post": {
        "operationId": "CreateFocusSource",
        "summary": "[Buyer] Add a FOCUS source: kind aws_s3 (with connectionId of an AWS connection and aws: bucket, prefix, region), azure_blob, gcp_bigquery, oci or s3_compatible. A cloud's source becomes its connection's AI lines source, replacing the connector's own AI read. Pleaxy reads it daily, and now with SyncFocusSource. 'edit' on invoices; a signed-in person only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFocusSourceInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusSourceView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources/issuers": {
      "get": {
        "operationId": "ListFocusIssuers",
        "summary": "[Buyer] Every invoice issuer in the stored FOCUS months (the last three per source) with its billed totals by currency and the supplier it maps to - by a person, or by its well-known name (AWS, Microsoft, Google, Oracle) - or none. 'view' on invoices.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FocusIssuerView"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources/issuers/{issuer}": {
      "put": {
        "operationId": "MapFocusIssuer",
        "summary": "[Buyer] Map a FOCUS invoice issuer to one of the workspace's suppliers (supplierConnectionId), or forget the mapping (null). 'edit' on invoices.",
        "parameters": [
          {
            "name": "issuer",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MapFocusIssuerInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FocusIssuerView"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources/uploads": {
      "post": {
        "operationId": "CreateFocusUpload",
        "summary": "[Buyer] Start a FOCUS file upload (.csv or .csv.gz, up to 500 MB): returns a presigned PUT URL valid a few minutes and the upload's id. PUT the file with the returned content type, then call CompleteFocusUpload. 'edit' on invoices.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFocusUploadInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateFocusUploadResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources/uploads/{uploadId}/complete": {
      "post": {
        "operationId": "CompleteFocusUpload",
        "summary": "[Buyer] The upload is in place: Pleaxy reads it in the background; the uploads source's last run shows the result. 'edit' on invoices.",
        "parameters": [
          {
            "name": "uploadId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusSourceView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources/{sourceId}": {
      "get": {
        "operationId": "GetFocusSource",
        "summary": "[Buyer] One FOCUS source with its last run. 'view' on invoices.",
        "parameters": [
          {
            "name": "sourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusSourceView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      },
      "delete": {
        "operationId": "DeleteFocusSource",
        "summary": "[Buyer] Remove a FOCUS source with the months and AI lines it stored; its connection's own AI read resumes. 'edit' on invoices; a signed-in person only.",
        "parameters": [
          {
            "name": "sourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteFocusSourceResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources/{sourceId}/periods/{period}": {
      "get": {
        "operationId": "GetFocusSourcePeriod",
        "summary": "[Buyer] One stored month of a FOCUS source: totals by currency, each invoice by number (by category and service), spend by cost center (from the tag attribution rules) and by issuer. 'view' on invoices.",
        "parameters": [
          {
            "name": "sourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetFocusSourcePeriodResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/focus-sources/{sourceId}/sync": {
      "post": {
        "operationId": "SyncFocusSource",
        "summary": "[Buyer] Read a FOCUS source now, in the background, re-reading the months it holds. 'edit' on invoices.",
        "parameters": [
          {
            "name": "sourceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FocusSourceView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "focus"
        ]
      }
    },
    "/ai-spend/limits": {
      "get": {
        "operationId": "ListAiSpendLimits",
        "summary": "[Buyer] The limits credentials (one per invoicer, never the key) and each order line's ceiling at its provider (amount, month, state, what reading it back gave, every write), and for each connected AWS account the values the limits template asks for: Pleaxy's account ID and the connection's External ID. 'view' on purchase orders.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAiSpendLimitsResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/limits/{poId}/{lineNo}": {
      "put": {
        "operationId": "SetAiSpendLimit",
        "summary": "[Buyer] Sets an approved order line's amount as its invoicer's spending ceiling for the month (AWS Budgets, an OpenAI project limit, an Anthropic workspace limit, a Google Cloud budget or spend cap, an Azure budget), reads it back and records the write. Refused below the month to date, with the figures. Raising the line raises it; closing the order removes it. An agent's call is a request the person confirms. 'edit' on purchase orders.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineNo",
            "required": true,
            "in": "path",
            "schema": {
              "type": "number",
              "format": "double"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAiSpendLimitInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiSpendLimit"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      },
      "delete": {
        "operationId": "RemoveAiSpendLimit",
        "summary": "[Buyer] Removes the ceiling Pleaxy set for an order line (only one Pleaxy named) and records it. 'edit' on purchase orders.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineNo",
            "required": true,
            "in": "path",
            "schema": {
              "type": "number",
              "format": "double"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiSpendLimit"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/ai-spend/limit-credentials/{invoicerId}": {
      "put": {
        "operationId": "SetAiLimitCredential",
        "summary": "[Buyer] The separate write credential for one invoicer's ceilings - an AWS limits role, a Google Cloud limits service account, an Azure limits app, or an OpenAI or Anthropic admin key - checked with one read before it is saved. Never the read-only connection's. Logged-in users only, 'edit' on suppliers.",
        "parameters": [
          {
            "name": "invoicerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAiLimitCredentialInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiLimitCredential"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      },
      "delete": {
        "operationId": "RemoveAiLimitCredential",
        "summary": "[Buyer] Removes an invoicer's limits credential: Pleaxy sets no more ceilings there; the read-only connection stays as it was. Remove the role or key at the provider too. Logged-in users only, 'edit' on suppliers.",
        "parameters": [
          {
            "name": "invoicerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveAiLimitCredentialResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "ai-spend"
        ]
      }
    },
    "/sourcing-events": {
      "get": {
        "operationId": "ListSourcingEvents",
        "summary": "[Buyer] The workspace's RFQs, newest first, with answer counts and (unless sealed) the lowest total",
        "parameters": [
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "draft",
                "open",
                "closed",
                "awarded",
                "canceled"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BuyerSourcingEventSummary"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "sourcing"
        ]
      },
      "post": {
        "operationId": "CreateSourcingEvent",
        "summary": "[Buyer] Start an RFQ as a draft: blank, or `{ fromRequestId }` from an approved request with no order, whose lines, cost center, GL account, needed-by and files are copied (the request moves to `sourcing`)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSourcingEventInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuyerSourcingEventView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "sourcing"
        ]
      }
    },
    "/sourcing-events/{rfqId}": {
      "get": {
        "operationId": "GetSourcingEvent",
        "summary": "[Buyer] One RFQ. While open and sealed: each invitee's state and when it answered, never prices or files",
        "parameters": [
          {
            "name": "rfqId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuyerSourcingEventView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "sourcing"
        ]
      }
    },
    "/sourcing-events/{rfqId}/comparison": {
      "get": {
        "operationId": "GetSourcingComparison",
        "summary": "[Buyer] The answers side by side: per line each price and total (lowest marked), totals, lead times against needed-by, terms, risk and onboarding; with criteria the weighted total, with evaluators their averages and spread (hidden from an evaluator until its own scorecard is in). `?round=n` shows an earlier round (default the latest). Refused while the current round is sealed",
        "parameters": [
          {
            "name": "rfqId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "round",
            "required": false,
            "in": "query",
            "description": "Phase 4 §1: the round to show, from 1. Default: the latest.",
            "schema": {
              "minimum": 1,
              "maximum": 99,
              "type": "number",
              "format": "double"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourcingComparison"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "sourcing"
        ]
      }
    },
    "/supplier-risk": {
      "get": {
        "operationId": "ListSupplierRisk",
        "summary": "[Buyer] Each supplier's risk: level ok|attention|blocked (blocked = a confirmed sanctions match; never a score), and its rows - bank (accounts waiting for approval), screening (status), flaggedAnswers (count) and missingDocuments (the questions' labels), each with a state ok|attention|blocked|none. A screening that isn't flagged shows as none here; read one supplier for its full screening and bank status.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SupplierRisk"
                  }
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-risk"
        ]
      }
    },
    "/supplier-risk/{connectionId}": {
      "get": {
        "operationId": "GetSupplierRisk",
        "summary": "[Buyer] One supplier's risk, by its connection id: as ListSupplierRisk, with bank.status none|approved|waiting|changing and the screening's status and checkedAt.",
        "parameters": [
          {
            "name": "connectionId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupplierRisk"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "supplier-risk"
        ]
      }
    },
    "/purchase-orders/{poId}/emails": {
      "get": {
        "operationId": "ListPurchaseOrderEmails",
        "summary": "[Both] The order's own email address and the emails that reached it, newest first: { address?, emails: [{ id, from, subject, receivedAt, trust: verified|unverified, kind: cxml|text, outcome: applied|draft|held|noAction|test|failed|ignored, reasonCode?, reason?, summary?, text?, attachments, draft?, result?, decision? }] }. A supplier replying to the order email, or its system sending a cXML ConfirmationRequest or ShipNoticeRequest, reaches this address. A verified sender's cXML document is recorded at once (applied); a plain email is read by the Pleaxy Assistant into a draft confirmation or ship notice, and an unverified sender's cXML document is held, both for someone to record with RecordPurchaseOrderEmail. address is absent until the order is issued, or when email-in is off. Takes the same ?buyer= as GetPurchaseOrder.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderEmails"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/purchase-orders/{poId}/emails/{emailId}/record": {
      "post": {
        "operationId": "RecordPurchaseOrderEmail",
        "summary": "[Both] Record an email's draft (outcome draft or held) as the supplier's order confirmation or ship notice, from email, with the same checks as ConfirmPurchaseOrder and SendShipNotice. Answers the email with its decision. 409 EMAIL_DECIDED once recorded or dismissed, NOTHING_TO_RECORD for any other outcome; the fulfillment refusals (ORDER_NOT_OPEN, an unknown line) as those routes give them.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "emailId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundEmail"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/purchase-orders/{poId}/emails/{emailId}/dismiss": {
      "post": {
        "operationId": "DismissPurchaseOrderEmail",
        "summary": "[Both] Leave the order as it is instead of recording what an email asks. Answers the email with its decision. 409 EMAIL_DECIDED once recorded or dismissed.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "emailId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundEmail"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "fulfillment"
        ]
      }
    },
    "/invoices/{invoiceId}/activity": {
      "get": {
        "operationId": "GetInvoiceActivity",
        "summary": "[Both] An invoice's activity, oldest first: its arrival, checks, matches, approval steps, rejection, payments, reminders and comments. Each entry has a `kind` and structured `data`, never prose. A Supplier caller gets its arrival, outcome, recorded payments, reminders and shared comments only. Takes GetInvoice's ?buyer=.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceActivityResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "activity"
        ]
      }
    },
    "/invoices/{invoiceId}/comments": {
      "get": {
        "operationId": "ListInvoiceComments",
        "summary": "[Both] Comments on an invoice, oldest first: your side's internal ones and every shared one. Takes GetInvoice's ?buyer=.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInvoiceCommentsResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "activity"
        ]
      },
      "post": {
        "operationId": "AddInvoiceComment",
        "summary": "[Both] Comment on an invoice - internal to your team, or shared with the other side. A Supplier's comments are always shared. `mentions` notifies people in your own workspace. Human session only.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommentInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "activity"
        ]
      }
    },
    "/invoices/{invoiceId}/comments/{commentId}": {
      "delete": {
        "operationId": "DeleteInvoiceComment",
        "summary": "[Both] Take back your own comment on an invoice: its text is removed, the thread keeps that a comment was made. Human session only.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "commentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "activity"
        ]
      }
    },
    "/purchase-orders/{poId}/comments": {
      "get": {
        "operationId": "ListPurchaseOrderComments",
        "summary": "[Both] Comments on a purchase order, oldest first: your side's internal ones and every shared one. Takes GetPurchaseOrder's ?buyer=.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListPurchaseOrderCommentsResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "activity"
        ]
      },
      "post": {
        "operationId": "AddPurchaseOrderComment",
        "summary": "[Both] Comment on a purchase order - as AddInvoiceComment. Human session only.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommentInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "activity"
        ]
      }
    },
    "/purchase-orders/{poId}/comments/{commentId}": {
      "delete": {
        "operationId": "DeletePurchaseOrderComment",
        "summary": "[Both] Take back your own comment on a purchase order. Human session only.",
        "parameters": [
          {
            "name": "poId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "commentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buyer",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentView"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "activity"
        ]
      }
    },
    "/settlement/billing": {
      "get": {
        "operationId": "GetBilling",
        "summary": "[Buyer] Current plan, subscription state, and purchasable plans",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingSummary"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "billing"
        ]
      }
    },
    "/invoices/{invoiceId}/stripe-payment": {
      "get": {
        "operationId": "GetStripePayment",
        "summary": "[Buyer] Whether this invoice can be paid through Pleaxy with Stripe: { available, reason?, state?, paymentMethodType?, quote? }. `quote` is { amount, fee, total, currency } in dollars: the buyer covers Stripe's bank-transfer fee (0.8%, capped at $5) so the supplier receives the full invoice amount. `reason` explains why not (not_configured, not_approved, payment_locked, supplier_not_on_pleaxy, supplier_not_connected, unsupported_currency, amount_too_small). `state` is the current Stripe payment: checkout_open, processing (a bank transfer clearing) or succeeded. `earlyPayment` is { percent, amount, deadline, quote } while a payment started today still earns the invoice's early-payment discount (quote: what the buyer pays taking it), or { ..., taken: true } on a payment that took it.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripePaymentStatus"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      },
      "post": {
        "operationId": "StartStripePayment",
        "summary": "[Buyer] Pay this approved invoice in full through Pleaxy with Stripe: { url } of a Stripe Checkout page (US bank transfer only), on the supplier's own Stripe account. The buyer pays the invoice plus Stripe's fee, so the supplier receives the full invoice amount; Pleaxy charges nothing and never holds the money. The invoice is locked while Checkout is open (up to an hour) and marked paid when Stripe confirms it. Send ?earlyPaymentDiscount=true to take the invoice's early-payment discount: allowed when today (the workspace's date the payment is initiated, not the day the bank transfer settles) is on or before its deadline, else 400 EARLY_PAYMENT_DEADLINE_PASSED or NO_EARLY_PAYMENT_DISCOUNT; the charge is then the amount due less the discount, plus Stripe's fee on that. Resumes an open Checkout (one opened with the other discount choice is expired and replaced); a replaced invoice its credit notes don't cover is 409 REPLACED_UNCREDITED unless ?confirmReplaced=true; answers { state } with no url when a payment is already processing or done. 422 STRIPE_* when this invoice can't be paid this way. Human session only.",
        "parameters": [
          {
            "name": "invoiceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "confirmReplaced",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "earlyPaymentDiscount",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartStripePaymentResult"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "invoices"
        ]
      }
    },
    "/usage-alerts": {
      "get": {
        "operationId": "GetUsageAlerts",
        "summary": "[Buyer] Usage anomaly alerts: the workspace's setting and what the rules find right now - an AI model, AI invoicer, cloud account or service above its own trend, or the month's projection breaking a contract's cap, tier or commitment - each with its figures, its text (titleMessageId/bodyMessageId and params) and sentAt when this month's notification went out. Writes nothing. 'view' on suppliers or on invoices.",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAlertsResponse"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "usage-alerts"
        ]
      }
    },
    "/usage-alerts/settings": {
      "patch": {
        "operationId": "UpdateUsageAlertSettings",
        "summary": "[Buyer] Turn usage anomaly alerts on or off, set their sensitivity (low, medium, high), or set the minimum a finding must reach in a currency. The workspace administrator only, signed in.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUsageAlertSettingsInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAlertSettings"
                }
              }
            }
          },
          "default": {
            "description": "An error: 4xx for the caller to fix, 5xx otherwise.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "tags": [
          "usage-alerts"
        ]
      }
    }
  },
  "info": {
    "title": "Pleaxy API",
    "description": "PO-to-payment lifecycle: purchase orders, usage-based matching, settlement. Each endpoint is tagged **[Buyer]**, **[Supplier]**, or **[Both]** for which side of the workspace calls it. To say which side you act as, put a Workspace ID in the path: `<regionId>.buyer` or `<regionId>.supplier`. With a bare region id, someone who holds both a buyer and a supplier profile in that region acts as the buyer.",
    "version": "0.3.0",
    "contact": {},
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "tags": [],
  "servers": [
    {
      "url": "https://api.pleaxy.ai/v1/workspaces/{workspaceId}",
      "description": "One workspace's API. The SDK clients build this from baseUrl and workspaceId.",
      "variables": {
        "workspaceId": {
          "default": "WORKSPACE_ID",
          "description": "Company profile → Workspace ID in the Pleaxy console."
        }
      }
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      },
      "session": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "type": "http"
      }
    },
    "schemas": {
      "CreateApiKeyInput": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Human-readable label, e.g. \"Billing agent - prod\""
          },
          "procurementRole": {
            "type": "string",
            "enum": [
              "administrator",
              "read-only",
              "contracts-and-suppliers",
              "relationships",
              "requisitions",
              "finance",
              "agent"
            ],
            "description": "Buyer-side procurement authority the key grants. Defaults to `read-only`. `agent` is for an AI agent or integration that raises purchase orders and enters invoices: it reads contracts, suppliers and questionnaires, and changes no approval rule, auto-approval or billing. Minting requires `edit` on `approvalSettings` (i.e. an administrator). Ignored for supplier-side keys."
          },
          "supplierRole": {
            "type": "string",
            "enum": [
              "administrator",
              "accounts-receivable",
              "sales",
              "fulfillment",
              "read-only"
            ],
            "description": "Supplier-side keys: the role the key acts with, as people have - administrator, accounts-receivable, sales, fulfillment or read-only. Defaults to `read-only`. invoices:feed needs a role that edits invoices (administrator, accounts-receivable); orders:fulfill one that edits orders (administrator, fulfillment). Ignored for buyer-side keys."
          },
          "scopes": {
            "type": "array",
            "description": "Extra abilities, each for one side (the other side's scope is a 400). Supplier: `invoices:feed` lets the key submit invoices to a connected buyer through POST .../invoices/connections/:connectionId; `orders:fulfill` lets it confirm orders and send ship notices, through POST .../purchase-orders/:poId/confirmations and .../ship-notices or as cXML to POST /v1/cxml/fulfillment. Buyer: `payments:record` lets the key record payments made outside Pleaxy through POST .../invoices/payment-records, and needs a procurementRole that can edit invoices. A scoped key keeps every other ability of its side. Only an administrator can mint a scoped key.",
            "items": {
              "type": "string",
              "enum": [
                "invoices:feed",
                "payments:record",
                "orders:fulfill"
              ]
            }
          }
        },
        "required": [
          "label"
        ]
      },
      "CreateCloudConnectionInput": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "accountLabel": {
            "type": "string"
          },
          "detail": {
            "type": "string",
            "description": "Buyer-typed account identifier for a demo (simulated) connection - required for azure, optional for gcp/oci. Ignored by a real connector: AWS derives the account ID from AssumeRole, GCP the billing account ID from the export, OCI shows the verified tenancy."
          },
          "roleArn": {
            "type": "string",
            "description": "AWS only, required - the IAM Role ARN the buyer created in their own account (via the CloudFormation/CDK/CLI script from POST .../cloud-connections/aws/init) and pasted back here."
          },
          "awsConnectionId": {
            "type": "string",
            "description": "AWS only, required - the connectionId returned by POST .../cloud-connections/aws/init, linking this verify call back to the externalId generated server-side for that pending connection. Never the externalId itself - that's looked up server-side, never trusted from the client."
          },
          "gcpConnectionId": {
            "type": "string",
            "description": "Google Cloud only, when its connector is on - the connectionId returned by POST .../cloud-connections/gcp/init. The binding itself is looked up server-side, never taken from the client."
          },
          "gcpProjectNumber": {
            "type": "string",
            "description": "Google Cloud only - the export project's number (digits)."
          },
          "gcpServiceAccountEmail": {
            "type": "string",
            "description": "Google Cloud only - the service account the setup script created, in the export project."
          },
          "gcpExportTable": {
            "type": "string",
            "description": "Google Cloud only - project.dataset.gcp_billing_export_v1_XXXXXX_XXXXXX_XXXXXX (standard usage cost export)."
          },
          "ociConnectionId": {
            "type": "string",
            "description": "OCI only, when its connector is on - the connectionId returned by POST .../cloud-connections/oci/init. The key pair is looked up server-side, never taken from the client."
          },
          "ociTenancyOcid": {
            "type": "string",
            "description": "OCI only - the tenancy OCID (ocid1.tenancy.oc1..…)."
          },
          "ociUserOcid": {
            "type": "string",
            "description": "OCI only - the OCID of the pleaxy-billing user the setup script created (ocid1.user.oc1..…)."
          },
          "ociHomeRegion": {
            "type": "string",
            "enum": [
              "af-casablanca-1",
              "af-johannesburg-1",
              "ap-batam-1",
              "ap-chuncheon-1",
              "ap-delhi-1",
              "ap-hyderabad-1",
              "ap-kulai-2",
              "ap-melbourne-1",
              "ap-mumbai-1",
              "ap-osaka-1",
              "ap-seoul-1",
              "ap-singapore-1",
              "ap-singapore-2",
              "ap-sydney-1",
              "ap-tokyo-1",
              "ca-montreal-1",
              "ca-toronto-1",
              "eu-amsterdam-1",
              "eu-frankfurt-1",
              "eu-madrid-1",
              "eu-madrid-3",
              "eu-marseille-1",
              "eu-milan-1",
              "eu-paris-1",
              "eu-stockholm-1",
              "eu-turin-1",
              "eu-zurich-1",
              "il-jerusalem-1",
              "me-abudhabi-1",
              "me-dubai-1",
              "me-jeddah-1",
              "me-riyadh-1",
              "mx-monterrey-1",
              "mx-queretaro-1",
              "sa-bogota-1",
              "sa-santiago-1",
              "sa-saopaulo-1",
              "sa-valparaiso-1",
              "sa-vinhedo-1",
              "uk-cardiff-1",
              "uk-london-1",
              "us-ashburn-1",
              "us-chicago-1",
              "us-phoenix-1",
              "us-saltlake-2",
              "us-sanjose-1"
            ],
            "description": "OCI only - the tenancy's home region, one of the regions POST .../oci/init lists."
          },
          "azureConnectionId": {
            "type": "string",
            "description": "Azure only, when its connector is on - the connectionId returned by POST .../cloud-connections/azure/init. The audience is looked up server-side, never taken from the client."
          },
          "azureBillingAccountId": {
            "type": "string",
            "description": "Azure only - the billing account of the scope picked from POST .../azure/discover: an MCA account (<guid>:<guid>_YYYY-MM-DD) or an Enterprise Agreement enrollment number."
          },
          "azureBillingProfileId": {
            "type": "string",
            "description": "Azure only - the billing profile picked from POST .../azure/discover. Left out for an Enterprise Agreement enrollment."
          },
          "azureTenantId": {
            "type": "string",
            "description": "Not accepted here: verify uses only the tenant ID that POST .../azure/discover proved. Declared so that a request carrying it is refused (400) rather than silently stripped."
          },
          "azureClientId": {
            "type": "string",
            "description": "Not accepted here, like azureTenantId: verify uses only the app (client) ID discover proved."
          },
          "supplierContactEmail": {
            "type": "string"
          },
          "dataSources": {
            "type": "array",
            "description": "What Pleaxy may read through this connection: `invoices` (finalized invoices) and/or `current_cost` (month-to-date cost). Omitted: both. Pleaxy never calls the provider for a source left out, including on a manual sync - some providers bill the customer per request for current-period cost (AWS Cost Explorer).",
            "items": {
              "type": "string",
              "enum": [
                "invoices",
                "current_cost"
              ]
            }
          }
        },
        "required": [
          "provider",
          "accountLabel"
        ]
      },
      "DiscoverAzureScopesInput": {
        "type": "object",
        "properties": {
          "azureConnectionId": {
            "type": "string",
            "description": "The connectionId returned by POST .../cloud-connections/azure/init. The audience is looked up server-side, never taken from the client."
          },
          "azureTenantId": {
            "type": "string",
            "description": "The Microsoft Entra tenant the app was registered in (GUID)."
          },
          "azureClientId": {
            "type": "string",
            "description": "The app registration's Application (client) ID (GUID)."
          },
          "azureBillingAccountId": {
            "type": "string",
            "description": "The billing account ID: a Microsoft Customer Agreement account (<guid>:<guid>_YYYY-MM-DD), or an Enterprise Agreement enrollment number (digits). Read directly: an app with only Billing profile reader can't list billing accounts."
          },
          "azureBillingProfileId": {
            "type": "string",
            "description": "Microsoft Customer Agreement only: the billing profile ID the app has Billing profile reader on. Left out (or empty) for an Enterprise Agreement enrollment."
          }
        },
        "required": [
          "azureConnectionId",
          "azureTenantId",
          "azureClientId",
          "azureBillingAccountId"
        ]
      },
      "InvoiceAutonomySettingsInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "maxAutoApproveAmount": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          }
        }
      },
      "UpdateAutonomySettingsInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "maxAutoApproveAmount": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          },
          "approvalThreshold": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          },
          "invoice": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/InvoiceAutonomySettingsInput"
              }
            ],
            "type": "object"
          }
        }
      },
      "ApprovalStageDefInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "approverEmployeeKey": {
            "type": "string",
            "description": "Employee key (Cognito sub) of the approver. Required and non-empty: a step is actionable only by the employee it names. There is no 'unassigned' step."
          },
          "highValueOnly": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "label",
          "approverEmployeeKey"
        ]
      },
      "ApprovalStepConditionInput": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "enum": [
              "amount",
              "supplier",
              "requester",
              "costCenter",
              "glCode",
              "requestType",
              "answer"
            ],
            "description": "The document variable to test."
          },
          "operator": {
            "type": "string",
            "enum": [
              "gt",
              "gte",
              "lt",
              "lte",
              "is",
              "is_not"
            ],
            "description": "gt/gte/lt/lte for amount; is/is_not for supplier, requester, costCenter, glCode, requestType and answer."
          },
          "value": {
            "description": "A number for amount (in the region's currency), a supplier Workspace ID for supplier, an employee key for requester, a code on the workspace's cost center list for costCenter, a GL account for glCode (the order's own, else its cost center's), a request type id (rt_...) for requestType, an option id for answer.",
            "oneOf": [
              {
                "type": "number",
                "format": "double"
              },
              {
                "type": "string"
              }
            ]
          },
          "questionId": {
            "type": "string",
            "maxLength": 120,
            "description": "answer only: the question tested, as <requestTypeId>/<fieldId> (a yes/no or choice question on that request type); value is one of its option ids (yes/no for a yes/no question). requestType and answer conditions go on the purchase_request flow only."
          }
        },
        "required": [
          "field",
          "operator",
          "value"
        ]
      },
      "ApprovalStageGroupDefInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "parallel",
              "sequential"
            ]
          },
          "label": {
            "type": "string",
            "description": "Human label for the group as a whole, e.g. 'Risk review' - falls back to stage labels joined when absent."
          },
          "stages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStageDefInput"
            }
          },
          "conditions": {
            "description": "Include this step only when every condition matches the document. Absent or empty = always. The chain must keep at least one step with no conditions.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStepConditionInput"
            }
          }
        },
        "required": [
          "id",
          "mode",
          "stages"
        ]
      },
      "UpdateApprovalChainInput": {
        "type": "object",
        "properties": {
          "useDefault": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Replace the chain with the region's default: one step, 'Region administrator', naming the region's owning administrator (or the first administrator by name). Can't be combined with groups, stages or linkedTo."
          },
          "linkedTo": {
            "type": "string",
            "enum": [
              "purchase_order",
              "invoice_payment"
            ],
            "description": "Link this process's chain to another process's configured groups, instead of having its own"
          },
          "stages": {
            "description": "Legacy flat shape, one sequential stage per step - still accepted for backward compatibility. Prefer `groups`; sending this persists as an equivalent single-stage-per-group chain. When sent, must have at least one stage - an empty chain would mean zero human approval.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStageDefInput"
            }
          },
          "groups": {
            "description": "Sequential across groups, parallel (AND-all-required) within a group. When sent, must have at least one group - an empty chain would mean zero human approval.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStageGroupDefInput"
            }
          }
        }
      },
      "AutomationRuleConditionInput": {
        "type": "object",
        "properties": {
          "supplierWorkspaceId": {
            "type": "string",
            "description": "The supplier account the rule applies to, as its Workspace ID (e.g. `reg_01k5….supplier`)."
          },
          "supplierContains": {
            "type": "string",
            "description": "Legacy: supplier-name substring. Matches only documents whose supplier has no account; use supplierWorkspaceId for any supplier on Pleaxy."
          },
          "maxAmount": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          }
        }
      },
      "AutomationRuleInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Omit to create a new rule - the server assigns an id."
          },
          "label": {
            "type": "string"
          },
          "conditions": {
            "$ref": "#/components/schemas/AutomationRuleConditionInput"
          },
          "autoApprove": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "label",
          "conditions",
          "autoApprove",
          "enabled"
        ]
      },
      "UpdateAutomationRulesInput": {
        "type": "object",
        "properties": {
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRuleInput"
            }
          }
        },
        "required": [
          "rules"
        ]
      },
      "SetConnectionCurrenciesInput": {
        "type": "object",
        "properties": {
          "billingCurrency": {
            "type": "string",
            "nullable": true,
            "description": "\"Bills in\": the currency a supplier with no Pleaxy account invoices you in, the default for new orders and invoices to it. Refused for a supplier with an account, whose own currencies rule. null removes it (your currency is then the default)."
          },
          "paymentCurrency": {
            "type": "string",
            "nullable": true,
            "description": "\"Pay in\": the currency you usually pay this supplier in, the default payment currency on its new invoices. For a supplier with an account, one it accepts. null removes it."
          }
        }
      },
      "SetInvoiceFeedInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "true lets this supplier send invoices with an invoices:feed API key; false stops the next one"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "FileAnswerInput": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string",
            "description": "The fileId the upload-url route returned"
          },
          "fileName": {
            "type": "string",
            "maxLength": 255
          },
          "contentType": {
            "type": "string"
          }
        },
        "required": [
          "fileId",
          "fileName",
          "contentType"
        ]
      },
      "UpdateReminderSettingsInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "idleDays": {
            "type": "number",
            "minimum": 1,
            "format": "double"
          }
        }
      },
      "PostalAddressInput": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string",
            "maxLength": 200
          },
          "line2": {
            "type": "string",
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "region": {
            "type": "string",
            "maxLength": 100
          },
          "postalCode": {
            "type": "string",
            "maxLength": 32
          },
          "country": {
            "type": "string"
          }
        },
        "required": [
          "line1",
          "country"
        ]
      },
      "ElectronicAddressInput": {
        "type": "object",
        "properties": {
          "scheme": {
            "type": "string"
          },
          "value": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "scheme",
          "value"
        ]
      },
      "EInvoicingSettingsInput": {
        "type": "object",
        "properties": {
          "contactName": {
            "type": "string",
            "maxLength": 200
          },
          "contactPhone": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^$|^[+()\\d\\s.\\/-]*\\d[+()\\d\\s.\\/-]*\\d[+()\\d\\s.\\/-]*\\d[+()\\d\\s.\\/-]*$"
          },
          "contactEmail": {
            "type": "string",
            "maxLength": 254
          },
          "electronicAddress": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/ElectronicAddressInput"
              }
            ],
            "type": "object"
          },
          "buyerReference": {
            "type": "string",
            "maxLength": 100
          }
        }
      },
      "UpdateOrgProfileInput": {
        "type": "object",
        "properties": {
          "sellsCategories": {
            "type": "array",
            "maxItems": 6,
            "description": "Supplier profiles only (ignored for a buyer): what you sell, as Pleaxy category ids. The whole list each time; [] clears it. While you are listed in the directory, buyers that don't know you find you by these, and under the UN segments each category belongs to.",
            "items": {
              "type": "string",
              "enum": [
                "cloud-ai",
                "software",
                "it-hardware",
                "it-services",
                "professional-services",
                "legal-finance",
                "marketing-creative",
                "staffing",
                "training",
                "facilities",
                "construction",
                "logistics",
                "travel-events",
                "office",
                "industrial",
                "electrical",
                "raw-materials",
                "packaging-print",
                "food",
                "healthcare",
                "safety-security",
                "vehicles",
                "utilities-energy",
                "agriculture"
              ]
            }
          },
          "sellsSegments": {
            "type": "array",
            "maxItems": 10,
            "description": "Supplier profiles only (ignored for a buyer): what you sell, as two-digit UN standard (UNSPSC) segment codes, e.g. 43. The whole list each time; [] clears it.",
            "items": {
              "type": "string",
              "enum": [
                "10",
                "11",
                "12",
                "13",
                "14",
                "15",
                "20",
                "21",
                "22",
                "23",
                "24",
                "25",
                "26",
                "27",
                "30",
                "31",
                "32",
                "39",
                "40",
                "41",
                "42",
                "43",
                "44",
                "45",
                "46",
                "47",
                "48",
                "49",
                "50",
                "51",
                "52",
                "53",
                "54",
                "55",
                "56",
                "57",
                "60",
                "64",
                "70",
                "71",
                "72",
                "73",
                "76",
                "77",
                "78",
                "80",
                "81",
                "82",
                "83",
                "84",
                "85",
                "86",
                "90",
                "91",
                "92",
                "93",
                "94",
                "95"
              ]
            }
          },
          "regionName": {
            "type": "string",
            "maxLength": 40
          },
          "companyName": {
            "type": "string",
            "maxLength": 200
          },
          "billingEmail": {
            "type": "string"
          },
          "billingAddress": {
            "type": "string",
            "maxLength": 500
          },
          "billingAddressParts": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/PostalAddressInput"
              }
            ],
            "type": "object"
          },
          "taxId": {
            "type": "string",
            "maxLength": 64
          },
          "currency": {
            "type": "string"
          },
          "otherCurrencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "paymentCurrencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "primaryContactName": {
            "type": "string"
          },
          "primaryContactEmail": {
            "type": "string"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "timeZone": {
            "type": "string"
          },
          "listedInDirectory": {
            "type": "boolean"
          },
          "locale": {
            "type": "string",
            "nullable": true,
            "enum": [
              "en",
              "es",
              "pt-BR",
              "de",
              "fr",
              "it"
            ]
          },
          "geographyPresetId": {
            "type": "string",
            "nullable": true,
            "enum": [
              "eu",
              "eea",
              "uk",
              "emea",
              "apac",
              "latam",
              "namer",
              "global",
              "continent-africa",
              "continent-antarctica",
              "continent-asia",
              "continent-europe",
              "continent-north-america",
              "continent-oceania",
              "continent-south-america"
            ]
          },
          "eInvoicing": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/EInvoicingSettingsInput"
              }
            ],
            "type": "object"
          }
        }
      },
      "PayerAccountRefInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "detail"
        ]
      },
      "BillToPartyInput": {
        "type": "object",
        "properties": {
          "companyName": {
            "type": "string",
            "maxLength": 200,
            "description": "The company the supplier invoices. Defaults to the buyer's company name."
          },
          "address": {
            "$ref": "#/components/schemas/PostalAddressInput"
          },
          "taxId": {
            "type": "string",
            "maxLength": 64,
            "description": "That company's tax id (VAT number, CUIT, EIN...). None when left out."
          }
        },
        "required": [
          "address"
        ]
      },
      "PunchoutRefInput": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "pattern": "^SS-[0-9A-F]{32}$",
            "example": "SS-0123456789ABCDEF0123456789ABCDEF"
          },
          "cartLineNo": {
            "type": "number",
            "minimum": 1,
            "maximum": 200,
            "format": "double"
          }
        },
        "required": [
          "sessionId",
          "cartLineNo"
        ]
      },
      "AiLineScopeInput": {
        "type": "object",
        "properties": {
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "openrouter",
              "mistral",
              "cohere",
              "xai",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ],
            "description": "Who bills the line: a cloud or an AI provider."
          },
          "vendor": {
            "type": "string",
            "enum": [
              "anthropic",
              "openai",
              "google",
              "meta",
              "mistral",
              "amazon",
              "microsoft",
              "cohere",
              "xai",
              "deepseek",
              "snowflake",
              "databricks",
              "nvidia",
              "unknown"
            ],
            "description": "The model's maker."
          },
          "model": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:\\/-]{0,119}$",
            "description": "The model id as billed, e.g. claude-sonnet-4-5 (GET /ai-rate-cards lists them)."
          },
          "meter": {
            "type": "string",
            "enum": [
              "input_tokens",
              "output_tokens",
              "cached_input_tokens",
              "cache_write_tokens",
              "batch_input_tokens",
              "batch_output_tokens",
              "images",
              "audio_seconds",
              "embeddings_tokens",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "model_units_hours",
              "cluster_hours",
              "other",
              "seats",
              "prepaid_credit"
            ],
            "description": "The meter; prepaid_credit for a prepaid credit purchase drawn down by the cost report."
          },
          "region": {
            "type": "string",
            "maxLength": 40,
            "description": "The region, where the model is priced by region."
          }
        },
        "required": [
          "invoicer",
          "vendor",
          "model",
          "meter"
        ]
      },
      "LineItemInput": {
        "type": "object",
        "properties": {
          "scopeType": {
            "type": "string",
            "enum": [
              "sku",
              "service",
              "account",
              "custom"
            ]
          },
          "scopeId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "lineType": {
            "type": "string",
            "enum": [
              "goods",
              "service"
            ],
            "description": "goods (delivered: shipped and confirmed on a goods receipt) or service (performed: confirmed on a service entry sheet, never shipped). Defaults to the catalog item's type, else to service for a service scope or a time unit and goods otherwise."
          },
          "ruleType": {
            "type": "string",
            "enum": [
              "quantity",
              "amount"
            ]
          },
          "unit": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          },
          "qty": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          },
          "nteAmount": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217. Optional - the server writes the order's currency on every line. If sent, it must be the order's currency (any case); another currency is a 400, since Pleaxy doesn't convert currencies."
          },
          "paymentTerms": {
            "type": "string",
            "maxLength": 40,
            "description": "The line's payment terms, e.g. \"Net 30\". Optional: left out (or blank), the line takes the default payment terms of the contract it was priced from or the order names (contractId), else the catalog item's, else \"Net 30\"."
          },
          "validFrom": {
            "type": "string"
          },
          "validUntil": {
            "type": "string"
          },
          "dueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "When the goods or the work on this line are due (YYYY-MM-DD), e.g. a statement-of-work milestone. On a 3-way order, its receiver is reminded when it passes with nothing received."
          },
          "customerLineNo": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._\\-\\/ ]{1,40}$",
            "description": "The buyer's own number for this line (e.g. from their ERP), up to 40 characters. Optional, like poNumber; stored and shown alongside the server's lineNo, never replacing it."
          },
          "quoteLineNo": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000,
            "description": "The line of the order's quote (quoteImportId) this line was filled from, when Pleaxy read the quote. Kept on the line; the app shows the line as priced from the supplier's quote unless a contract rate priced it.",
            "format": "double"
          },
          "sowLineNo": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000,
            "description": "The milestone or deliverable of the order's statement of work (sowImportId) this line was filled from, when Pleaxy read the SOW. Kept on the line, provenance only, like quoteLineNo.",
            "format": "double"
          },
          "punchoutRef": {
            "description": "The online-store cart line this line came from (store punchout spec D4). The server reads that cart's evidence and sets what the line is - its name, unit and part numbers - from it; only qty and unitPrice are yours.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PunchoutRefInput"
              }
            ]
          },
          "ai": {
            "description": "An AI line (AI spend controls): the invoicer, model vendor, model, meter and region it prices. A quantity line in the meter's unit (millions of tokens, hours); invoices' AI lines are matched to it by these, never by description.",
            "allOf": [
              {
                "$ref": "#/components/schemas/AiLineScopeInput"
              }
            ]
          }
        },
        "required": [
          "scopeType",
          "name",
          "ruleType",
          "unit",
          "unitPrice",
          "qty",
          "nteAmount",
          "validFrom",
          "validUntil"
        ]
      },
      "CreatePurchaseOrderInput": {
        "type": "object",
        "properties": {
          "poNumber": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._-]{1,40}$",
            "description": "Custom PO number to use as this PO's id instead of an auto-generated one (e.g. 'PO-2026-0042'). Must be unique within the region."
          },
          "supplier": {
            "type": "string",
            "description": "Supplier / counterparty name"
          },
          "matching": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way"
            ],
            "description": "How the order's invoices are matched: two_way against the order and its contract; three_way also against what was received (goods receipts and service entry sheets). Defaults to what the workspace's matching setting suggests (GET .../matching-policy). Refused for a cloud provider's order, which is matched against usage, and, when the setting lets only administrators change it, for anything but the default from anyone else."
          },
          "receiverEmployeeKey": {
            "type": "string",
            "maxLength": 100,
            "description": "Who confirms delivery: someone in this workspace, by employee key. Defaults to whoever raises the order. Used with three_way matching."
          },
          "supplierRegionId": {
            "type": "string",
            "description": "regionId of the onboarded supplier org this PO is issued to, if known. The buyer must hold an approved SupplierConnection to this supplier; the server rejects a region it isn't connected to. Links the PO to that org's real supplier workspace instead of just its free-text `supplier` name - see WorkspacesService.getSupplierWorkspace."
          },
          "supplierConnectionId": {
            "type": "string",
            "maxLength": 100,
            "description": "The id of a supplier on your Suppliers list (not rejected, not a cloud provider) this PO is for - see GET .../suppliers. One approved with a Pleaxy account is treated as its supplierRegionId. Any other (not invited yet, invited, onboarding) is named by its record: its invoices match the PO by id, the PO is emailed to its contact, and sending it invites a supplier not invited yet. The record's name replaces `supplier`. Not with supplierRegionId, provider or supplierContactEmail."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217: the currency the order is priced in. To a supplier with an account (supplierRegionId), one its region prices in, its main currency by default (400 PO_CURRENCY_NOT_OFFERED otherwise). To a cloud provider or a supplier not on Pleaxy yet, any code; by default that supplier's \"Bills in\" currency, else your workspace's. An order in a currency other than your workspace's goes through every approval step and is never auto-approved."
          },
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "payerAccounts": {
            "description": "Only with `provider`: this region's cloud connections of that provider the PO applies to, by `id`. A connection still being set up is refused. The PO stores each connection's own label and detail; any sent here are ignored.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayerAccountRefInput"
            }
          },
          "billToParty": {
            "description": "Who the supplier invoices, when it isn't the buyer's company profile billing details. Left out, the order copies those details as they are now (company name, billing address, tax id).",
            "allOf": [
              {
                "$ref": "#/components/schemas/BillToPartyInput"
              }
            ]
          },
          "billTo": {
            "type": "string",
            "maxLength": 500,
            "deprecated": true,
            "description": "Use `billToParty`. A one-line bill-to address for the buyer's company, kept as typed; ignored when `billToParty` is sent."
          },
          "costCenter": {
            "type": "string",
            "maxLength": 200,
            "description": "The cost center: when the workspace keeps a cost center list, a code or name on it (stored as the list's code; a closed one is refused); otherwise free text. An empty string clears it."
          },
          "glCode": {
            "type": "string",
            "maxLength": 40,
            "description": "The GL account (spend category) the order books to, when it isn't its cost center's. Approval steps can route by it. An empty string clears it."
          },
          "budgetOwner": {
            "type": "string"
          },
          "blanket": {
            "type": "boolean",
            "description": "A blanket order: billed as used, up to its amount. Its amount never uses the cost center's budget at once; expectedMonthly does, month by month, and its invoices as they are approved. Cloud-provider orders are blanket orders either way."
          },
          "expectedMonthly": {
            "type": "number",
            "minimum": 0,
            "description": "A blanket or cloud order's expected billing each month, in the order's currency: what its cost center's budget reserves for it.",
            "format": "double"
          },
          "buyerName": {
            "type": "string"
          },
          "supplierSite": {
            "type": "string"
          },
          "supplierContactEmail": {
            "type": "string",
            "maxLength": 254,
            "description": "Only for a supplier not on Pleaxy (no supplierRegionId or provider): their contact email. When the PO is sent (now, or when a draft is submitted), Pleaxy invites them - or links the supplier this workspace already has."
          },
          "notes": {
            "type": "string"
          },
          "contractId": {
            "type": "string",
            "maxLength": 60,
            "description": "One of this workspace's contracts this order falls under: active, and with the order's supplier (400 otherwise). Optional. Invoices against the order are checked against it."
          },
          "quoteImportId": {
            "type": "string",
            "maxLength": 20,
            "description": "The quote import (POST .../quote-imports) holding the supplier's quote this order is raised from. Its upload must have finished. Optional."
          },
          "sowImportId": {
            "type": "string",
            "maxLength": 20,
            "description": "The quote import (POST .../quote-imports) holding the statement of work this order is for: its scope, milestones and acceptance. Its upload must have finished. Optional, and independent of quoteImportId."
          },
          "draft": {
            "type": "boolean",
            "description": "Save as a draft instead of submitting for approval. Submit it later with SubmitPurchaseOrderDraft."
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItemInput"
            }
          }
        },
        "required": [
          "supplier",
          "lineItems"
        ]
      },
      "UpdatePurchaseOrderInput": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "description": "Drafts only, sent with lineItems: the currency the order is priced in. To a supplier with an account, one it prices in; otherwise any ISO 4217 code. A submitted PO keeps its currency."
          },
          "lineItems": {
            "description": "Replaces the PO's whole line-item set and recalculates its amount. The approval chain is rebuilt from scratch, discarding any sign-offs already collected.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItemInput"
            }
          },
          "billToParty": {
            "nullable": true,
            "description": "Who the supplier invoices, entered on the order; `null` copies the buyer's company profile billing details as they are now. Bookkeeping: never re-triggers approval.",
            "allOf": [
              {
                "$ref": "#/components/schemas/BillToPartyInput"
              }
            ],
            "type": "object"
          },
          "billTo": {
            "type": "string",
            "maxLength": 500,
            "deprecated": true,
            "description": "Use `billToParty`. A one-line bill-to address for the buyer's company, kept as typed; an empty string copies the company profile's. Ignored when `billToParty` is sent."
          },
          "costCenter": {
            "type": "string",
            "maxLength": 200,
            "description": "The cost center: when the workspace keeps a cost center list, a code or name on it (stored as the list's code; a closed one is refused); otherwise free text. An empty string clears it."
          },
          "glCode": {
            "type": "string",
            "maxLength": 40,
            "description": "The GL account (spend category) the order books to, when it isn't its cost center's. Approval steps can route by it. An empty string clears it."
          },
          "deliveryAddressId": {
            "type": "string",
            "maxLength": 64,
            "description": "Drafts only: the workspace delivery address an online store order ships to, copied onto the order at submit. An empty string goes back to the workspace default."
          },
          "budgetOwner": {
            "type": "string"
          },
          "blanket": {
            "type": "boolean",
            "description": "Mark a draft a blanket order (billed as used, up to its amount), or not. Only while it is a draft."
          },
          "expectedMonthly": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "A blanket or cloud order's expected billing each month, in its currency; null takes it off.",
            "format": "double"
          },
          "buyerName": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "contractId": {
            "type": "string",
            "nullable": true,
            "maxLength": 60,
            "description": "The contract this order falls under - one of this workspace's, active, with the order's supplier (400 otherwise); `null` removes it. Bookkeeping: never re-triggers approval."
          },
          "quoteImportId": {
            "type": "string",
            "nullable": true,
            "maxLength": 20,
            "description": "The quote import holding the supplier's quote this order is raised from; replaces the one attached, and `null` removes it. Bookkeeping, like `notes`."
          },
          "sowImportId": {
            "type": "string",
            "nullable": true,
            "maxLength": 20,
            "description": "The quote import holding the statement of work this order is for; replaces the one attached, and `null` removes it. Bookkeeping, like `notes`."
          }
        }
      },
      "CancelPurchaseOrderInput": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "ChangeFinishedCostCenterInput": {
        "type": "object",
        "properties": {
          "costCenter": {
            "type": "string",
            "maxLength": 100,
            "description": "The cost center to book the order to: an active one from the workspace's cost centers when it keeps a list."
          },
          "reason": {
            "type": "string",
            "maxLength": 500,
            "description": "Why it moves, kept on the order with who changed it and when."
          }
        },
        "required": [
          "costCenter",
          "reason"
        ]
      },
      "ReassignApprovalStageInput": {
        "type": "object",
        "properties": {
          "stageId": {
            "type": "string",
            "description": "Id of the pending stage to reassign. May be in any group, not only the current one."
          },
          "approverEmployeeKey": {
            "type": "string",
            "description": "Employee key (Cognito sub) of the new approver. Must be a buyer member of this workspace, and not the acting administrator."
          },
          "reason": {
            "type": "string",
            "maxLength": 280,
            "description": "Why the step was reassigned - shown in the approval history."
          }
        },
        "required": [
          "stageId",
          "approverEmployeeKey"
        ]
      },
      "SetWarningPctInput": {
        "type": "object",
        "properties": {
          "warningPct": {
            "type": "number",
            "description": "Percent, 0–100: how far an invoice's stated rate may be from the reference before it's flagged.",
            "minimum": 0,
            "maximum": 100,
            "format": "double"
          }
        },
        "required": [
          "warningPct"
        ]
      },
      "InvoiceAiLineInput": {
        "type": "object",
        "properties": {
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "openrouter",
              "mistral",
              "cohere",
              "xai",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ],
            "description": "Who bills the line: a cloud or an AI provider."
          },
          "vendor": {
            "type": "string",
            "enum": [
              "anthropic",
              "openai",
              "google",
              "meta",
              "mistral",
              "amazon",
              "microsoft",
              "cohere",
              "xai",
              "deepseek",
              "snowflake",
              "databricks",
              "nvidia",
              "unknown"
            ],
            "description": "The model's maker."
          },
          "model": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:\\/-]{0,119}$",
            "description": "The model id as billed, e.g. claude-sonnet-4-5 (GET /ai-rate-cards lists them)."
          },
          "meter": {
            "type": "string",
            "enum": [
              "input_tokens",
              "output_tokens",
              "cached_input_tokens",
              "cache_write_tokens",
              "batch_input_tokens",
              "batch_output_tokens",
              "images",
              "audio_seconds",
              "embeddings_tokens",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "model_units_hours",
              "cluster_hours",
              "other",
              "seats",
              "prepaid_credit"
            ],
            "description": "The meter; prepaid_credit for a prepaid credit purchase drawn down by the cost report."
          },
          "region": {
            "type": "string",
            "maxLength": 40,
            "description": "The region, where the model is priced by region."
          },
          "period": {
            "type": "string",
            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
            "description": "The month of usage the line bills, YYYY-MM. Defaults to the month before the invoice date."
          }
        },
        "required": [
          "invoicer",
          "vendor",
          "model",
          "meter"
        ]
      },
      "CreateManualInvoiceLineItemInput": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "qty": {
            "type": "number",
            "minimum": 0.000001,
            "maximum": 1000000,
            "description": "Greater than 0, at most 1,000,000",
            "format": "double"
          },
          "unitPrice": {
            "type": "number",
            "maximum": 1000000000,
            "description": "0 or more, at most 1,000,000,000. A reduction is a discount, never a negative price.",
            "minimum": 0,
            "format": "double"
          },
          "discount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "Total discount on this line, with no more decimal places than the buyer's currency allows (at most 2). It can't be more than qty × unitPrice + charge. The line amount is qty × unitPrice + charge − discount.",
            "format": "double"
          },
          "charge": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "Total charges on this line (freight, handling…), with no more decimal places than the buyer's currency allows (at most 2).",
            "format": "double"
          },
          "ai": {
            "description": "An AI line: the invoicer, model vendor, model, meter and region it bills, and the month of usage (YYYY-MM). qty is in the meter's unit (millions of tokens, hours). Held to the PO's AI line, the contract and the rate card.",
            "allOf": [
              {
                "$ref": "#/components/schemas/InvoiceAiLineInput"
              }
            ]
          }
        },
        "required": [
          "description",
          "qty",
          "unitPrice"
        ]
      },
      "InvoiceAdjustmentInput": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "discount",
              "charge"
            ]
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "What the discount or charge is for, 1–200 characters"
          },
          "amount": {
            "type": "number",
            "minimum": 0.01,
            "maximum": 1000000000000000,
            "description": "A positive amount, with no more decimal places than the buyer's currency allows (at most 2). `type` says whether it reduces or adds to the total.",
            "format": "double"
          }
        },
        "required": [
          "type",
          "description",
          "amount"
        ]
      },
      "BreakdownEntryInput": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "What the entry is, e.g. \"IVA\" or \"Percepción IIBB CABA\". 1–200 characters."
          },
          "amount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "0 or more, in the currency of the object it belongs to.",
            "format": "double"
          },
          "rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "A percentage, 0–100, when the entry has one (IVA 21). Omit for fixed amounts.",
            "format": "double"
          }
        },
        "required": [
          "description",
          "amount"
        ]
      },
      "InvoiceDeductionInput": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "prepayment",
              "credit"
            ],
            "description": "prepayment: the buyer already paid it (a deposit, an advance). credit: the seller applied a credit it holds (prepaid or promotional credits)."
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "What it is, e.g. \"30% deposit\" or \"AWS promotional credit\". 1–200 characters."
          },
          "amount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "More than 0, in the invoice's currency, including tax. With the withholdings, less than the invoice total.",
            "format": "double"
          },
          "sourceInvoiceId": {
            "type": "string",
            "maxLength": 64,
            "description": "Prepayment only: the paid Pleaxy invoice it was - a deposit on the same purchase order from the same supplier. Its payment reference and date are filled in, and the purchase order isn't drawn twice for it."
          },
          "reference": {
            "type": "string",
            "maxLength": 64,
            "description": "The payment's reference, or the seller's id for the credit. 1–64 characters. A prepayment needs this or sourceInvoiceId."
          },
          "paidOn": {
            "type": "string",
            "description": "Prepayment only: when it was paid, YYYY-MM-DD."
          }
        },
        "required": [
          "kind",
          "description",
          "amount"
        ]
      },
      "BreakdownGroupInput": {
        "type": "object",
        "properties": {
          "totalAmount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "format": "double"
          },
          "breakdown": {
            "description": "At most 20. Must sum to totalAmount.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          }
        },
        "required": [
          "totalAmount"
        ]
      },
      "AmountBreakdownInput": {
        "type": "object",
        "properties": {
          "subTotalAmount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "format": "double"
          },
          "discounts": {
            "$ref": "#/components/schemas/BreakdownGroupInput"
          },
          "fees": {
            "$ref": "#/components/schemas/BreakdownGroupInput"
          },
          "taxes": {
            "$ref": "#/components/schemas/BreakdownGroupInput"
          }
        }
      },
      "CurrencyExchangeDetailsInput": {
        "type": "object",
        "properties": {
          "sourceCurrencyCode": {
            "type": "string",
            "pattern": "^[A-Za-z]{3}$",
            "description": "The invoice's currency. Filled in when omitted."
          },
          "targetCurrencyCode": {
            "type": "string",
            "pattern": "^[A-Za-z]{3}$",
            "description": "This object's currencyCode. Filled in when omitted."
          },
          "rate": {
            "type": "number",
            "minimum": 1e-10,
            "description": "1 source = rate target, as printed on the invoice. Greater than 0.",
            "format": "double"
          },
          "rateDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "YYYY-MM-DD the rate applies to. Not in the future, and at most one day after the invoice date."
          },
          "rateSource": {
            "type": "string",
            "maxLength": 80,
            "description": "Where the rate comes from, as the invoice says, e.g. \"Banco Nación\" or \"AWS\". Up to 80 characters."
          }
        },
        "required": [
          "rate"
        ]
      },
      "CurrencyAmountInput": {
        "type": "object",
        "properties": {
          "currencyCode": {
            "type": "string",
            "pattern": "^[A-Za-z]{3}$",
            "description": "ISO 4217. Must differ from the invoice's currency."
          },
          "totalAmount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "Required on paymentCurrencyAmount: the amount owed in this currency. Optional on taxCurrencyAmount.",
            "format": "double"
          },
          "totalAmountBeforeTax": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "format": "double"
          },
          "amountBreakdown": {
            "description": "taxes.totalAmount is required on taxCurrencyAmount.",
            "allOf": [
              {
                "$ref": "#/components/schemas/AmountBreakdownInput"
              }
            ]
          },
          "currencyExchangeDetails": {
            "$ref": "#/components/schemas/CurrencyExchangeDetailsInput"
          }
        },
        "required": [
          "currencyCode",
          "currencyExchangeDetails"
        ]
      },
      "RemittanceInstructionsInput": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "bank_transfer",
              "ach",
              "wire",
              "check",
              "other"
            ],
            "description": "bank_transfer needs iban or accountNumber. wire needs iban or accountNumber, plus bic or routingNumber. ach needs accountNumber and a 9-digit ABA routingNumber. check needs mailingAddress. other needs notes."
          },
          "payeeName": {
            "type": "string",
            "maxLength": 140,
            "description": "The account holder, or the payee on a check. 1–140 characters."
          },
          "bankName": {
            "type": "string",
            "maxLength": 140,
            "description": "At most 140 characters"
          },
          "iban": {
            "type": "string",
            "maxLength": 50,
            "description": "Spaces allowed; stored uppercase without them. Must pass the IBAN check digits."
          },
          "accountNumber": {
            "type": "string",
            "maxLength": 40,
            "description": "Letters, digits, spaces and '-', at most 34 characters"
          },
          "bic": {
            "type": "string",
            "maxLength": 20,
            "description": "SWIFT/BIC, 8 or 11 characters"
          },
          "routingNumber": {
            "type": "string",
            "maxLength": 30,
            "description": "ABA routing number, sort code, BSB or similar: digits, spaces and '-', at most 20 characters"
          },
          "mailingAddress": {
            "type": "string",
            "maxLength": 300,
            "description": "Where to mail a check. At most 300 characters."
          },
          "paymentReference": {
            "type": "string",
            "maxLength": 140,
            "description": "What the buyer should quote with the payment. At most 140 characters."
          },
          "notes": {
            "type": "string",
            "maxLength": 500,
            "description": "Anything else the buyer needs to pay. At most 500 characters."
          }
        },
        "required": [
          "method",
          "payeeName"
        ]
      },
      "CreateFeedInvoiceInput": {
        "type": "object",
        "properties": {
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ],
            "description": "\"debit_note\" for an amendment that raises what an invoice asked for (credit notes spec §18): it names the invoice it amends and takes its buyer, supplier, currency and PO. \"invoice\" or absent: an invoice."
          },
          "amendsInvoiceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Debit note: the Pleaxy id of the invoice it amends (or amendsInvoiceNumber)."
          },
          "amendsInvoiceNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Debit note: the supplier's number of the invoice it amends, when the Pleaxy id isn't known (the feed's way)."
          },
          "replacesInvoiceIds": {
            "description": "A replacement invoice (credit and rebill, credit notes spec §20): the Pleaxy ids of the invoices and debit notes it replaces, 1–20, all from this supplier. Or replacesInvoiceNumbers.",
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 100,
              "minLength": 1
            }
          },
          "replacesInvoiceNumbers": {
            "description": "A replacement invoice: the supplier's numbers of the invoices it replaces, when the Pleaxy ids aren't known (the feed's way). 1–20.",
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          },
          "poId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "An open PO between exactly this buyer and supplier"
          },
          "invoiceNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Unique per supplier within the buyer's workspace, case-insensitively"
          },
          "invoiceDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "YYYY-MM-DD - not in the future, not more than 365 days back"
          },
          "dueInDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 365,
            "description": "0–365, default 30",
            "format": "double"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateManualInvoiceLineItemInput"
            }
          },
          "poLineNo": {
            "type": "number",
            "minimum": 1,
            "maximum": 100000,
            "description": "The purchase order line this invoice bills (its lineNo), when it is against a PO. An invoice bills one PO line, stated here and never on its lines, and all of its lines are held to it. Lines are never matched by description. Against a one-line PO, an invoice without one bills that line. Against a multi-line PO, an invoice naming no line makes it a discrepancy a person must resolve. A lineNo the PO doesn't have is refused. Not with billsNoPoLine.",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean",
            "description": "true when the invoice bills none of the PO's lines (an unordered extra, a one-off fee). It draws on the PO's balance only, and the invoice always needs a person's approval. Not with poLineNo. Shipping and handling usually belong in adjustments instead."
          },
          "adjustments": {
            "description": "Invoice-level discounts and charges, before tax. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustmentInput"
            }
          },
          "sourceImportId": {
            "type": "string",
            "pattern": "^ID-[0-9A-F]{8}$",
            "description": "Buyer only: the invoice import (POST .../invoice-imports) this invoice was recorded from. Its document is kept with the invoice when it is a PDF under 8 MB, and the import records the invoice."
          },
          "taxAmount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "Total tax on the invoice, as stated by the supplier. It is included in the invoice total. Pleaxy doesn't calculate tax.",
            "format": "double"
          },
          "taxBreakdown": {
            "description": "Tax by type in the invoice's currency, e.g. IVA 21% and a percepción. Must sum to taxAmount, which is then required. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          },
          "withholdings": {
            "description": "Amounts the invoice withholds from its total, in the invoice's currency, e.g. ISR retenido 10%. Positive; they reduce what's owed, never the total. Less than the total in all. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ],
            "description": "\"prepayment\" for an invoice that bills a deposit (UBL InvoiceTypeCode 386). Its payment can later be deducted from the final invoice."
          },
          "deductions": {
            "description": "What was already paid towards the invoice after tax: deposits and advances the buyer paid, and credits the seller applied. They reduce what's owed, never the total or its tax. With the withholdings, less than the total. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeductionInput"
            }
          },
          "paymentCurrencyAmount": {
            "description": "Only when the invoice names the amount owed in another currency (e.g. AWS billing in ARS): that amount, with the rate printed on the invoice. Leave it off when the invoice is converted at the payment-date rate. Pleaxy checks the figures against the rate and never converts anything itself.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CurrencyAmountInput"
              }
            ]
          },
          "taxCurrencyAmount": {
            "description": "Tax as stated in the legal currency of the buyer's country, when that isn't the invoice's currency. Needs taxAmount. Display only.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CurrencyAmountInput"
              }
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217, case-insensitive. Optional; absent means the buyer region's currency. For a connected supplier the buyer region's currency is always the one stored, and any other is refused. For an off-platform supplier (no Pleaxy account) it is the currency the invoice is in."
          },
          "remittanceInstructions": {
            "description": "Where the buyer should pay: stored with the invoice and never changed afterwards. The buyer is warned when the payee or account differs from this supplier's previous invoice.",
            "allOf": [
              {
                "$ref": "#/components/schemas/RemittanceInstructionsInput"
              }
            ]
          },
          "pdfBase64": {
            "type": "string",
            "description": "Base64-encoded PDF of the invoice"
          },
          "issuedInBillingSoftware": {
            "type": "boolean",
            "description": "The supplier says it issued this document in its own billing software, and attaches that software's PDF. Required of a supplier in Spain from 2027-01-01 (Veri*factu): Pleaxy records its invoices, it doesn't issue them (400 VERI_FACTU_RECORD_ONLY otherwise)."
          }
        },
        "required": [
          "invoiceNumber",
          "invoiceDate",
          "lineItems"
        ]
      },
      "AddReplacementLinksInput": {
        "type": "object",
        "properties": {
          "invoiceIds": {
            "description": "The Pleaxy ids of the invoices and debit notes this invoice replaces, from the same supplier. 1–20; links already there are kept.",
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 100,
              "minLength": 1
            }
          }
        },
        "required": [
          "invoiceIds"
        ]
      },
      "CreateManualInvoiceInput": {
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The SupplierConnection to invoice - see GET .../invoices/counterparties. A debit note may leave it out: it takes its original invoice's."
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ],
            "description": "\"debit_note\" for an amendment that raises what an invoice asked for (credit notes spec §18): it names the invoice it amends and takes its buyer, supplier, currency and PO. \"invoice\" or absent: an invoice."
          },
          "amendsInvoiceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Debit note: the Pleaxy id of the invoice it amends (or amendsInvoiceNumber)."
          },
          "amendsInvoiceNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Debit note: the supplier's number of the invoice it amends, when the Pleaxy id isn't known (the feed's way)."
          },
          "replacesInvoiceIds": {
            "description": "A replacement invoice (credit and rebill, credit notes spec §20): the Pleaxy ids of the invoices and debit notes it replaces, 1–20, all from this supplier. Or replacesInvoiceNumbers.",
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 100,
              "minLength": 1
            }
          },
          "replacesInvoiceNumbers": {
            "description": "A replacement invoice: the supplier's numbers of the invoices it replaces, when the Pleaxy ids aren't known (the feed's way). 1–20.",
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          },
          "poId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "An open PO between exactly this buyer and supplier"
          },
          "invoiceNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Unique per supplier within the buyer's workspace, case-insensitively"
          },
          "invoiceDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "YYYY-MM-DD - not in the future, not more than 365 days back"
          },
          "dueInDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 365,
            "description": "0–365, default 30",
            "format": "double"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateManualInvoiceLineItemInput"
            }
          },
          "poLineNo": {
            "type": "number",
            "minimum": 1,
            "maximum": 100000,
            "description": "The purchase order line this invoice bills (its lineNo), when it is against a PO. An invoice bills one PO line, stated here and never on its lines, and all of its lines are held to it. Lines are never matched by description. Against a one-line PO, an invoice without one bills that line. Against a multi-line PO, an invoice naming no line makes it a discrepancy a person must resolve. A lineNo the PO doesn't have is refused. Not with billsNoPoLine.",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean",
            "description": "true when the invoice bills none of the PO's lines (an unordered extra, a one-off fee). It draws on the PO's balance only, and the invoice always needs a person's approval. Not with poLineNo. Shipping and handling usually belong in adjustments instead."
          },
          "adjustments": {
            "description": "Invoice-level discounts and charges, before tax. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustmentInput"
            }
          },
          "sourceImportId": {
            "type": "string",
            "pattern": "^ID-[0-9A-F]{8}$",
            "description": "Buyer only: the invoice import (POST .../invoice-imports) this invoice was recorded from. Its document is kept with the invoice when it is a PDF under 8 MB, and the import records the invoice."
          },
          "taxAmount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "Total tax on the invoice, as stated by the supplier. It is included in the invoice total. Pleaxy doesn't calculate tax.",
            "format": "double"
          },
          "taxBreakdown": {
            "description": "Tax by type in the invoice's currency, e.g. IVA 21% and a percepción. Must sum to taxAmount, which is then required. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          },
          "withholdings": {
            "description": "Amounts the invoice withholds from its total, in the invoice's currency, e.g. ISR retenido 10%. Positive; they reduce what's owed, never the total. Less than the total in all. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ],
            "description": "\"prepayment\" for an invoice that bills a deposit (UBL InvoiceTypeCode 386). Its payment can later be deducted from the final invoice."
          },
          "deductions": {
            "description": "What was already paid towards the invoice after tax: deposits and advances the buyer paid, and credits the seller applied. They reduce what's owed, never the total or its tax. With the withholdings, less than the total. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeductionInput"
            }
          },
          "paymentCurrencyAmount": {
            "description": "Only when the invoice names the amount owed in another currency (e.g. AWS billing in ARS): that amount, with the rate printed on the invoice. Leave it off when the invoice is converted at the payment-date rate. Pleaxy checks the figures against the rate and never converts anything itself.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CurrencyAmountInput"
              }
            ]
          },
          "taxCurrencyAmount": {
            "description": "Tax as stated in the legal currency of the buyer's country, when that isn't the invoice's currency. Needs taxAmount. Display only.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CurrencyAmountInput"
              }
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217, case-insensitive. Optional; absent means the buyer region's currency. For a connected supplier the buyer region's currency is always the one stored, and any other is refused. For an off-platform supplier (no Pleaxy account) it is the currency the invoice is in."
          },
          "remittanceInstructions": {
            "description": "Where the buyer should pay: stored with the invoice and never changed afterwards. The buyer is warned when the payee or account differs from this supplier's previous invoice.",
            "allOf": [
              {
                "$ref": "#/components/schemas/RemittanceInstructionsInput"
              }
            ]
          },
          "pdfBase64": {
            "type": "string",
            "description": "Base64-encoded PDF of the invoice"
          },
          "issuedInBillingSoftware": {
            "type": "boolean",
            "description": "The supplier says it issued this document in its own billing software, and attaches that software's PDF. Required of a supplier in Spain from 2027-01-01 (Veri*factu): Pleaxy records its invoices, it doesn't issue them (400 VERI_FACTU_RECORD_ONLY otherwise)."
          }
        },
        "required": [
          "invoiceNumber",
          "invoiceDate",
          "lineItems"
        ]
      },
      "RejectInvoiceInput": {
        "type": "object",
        "properties": {
          "reasonCode": {
            "type": "string",
            "enum": [
              "amount_incorrect",
              "not_ordered_or_not_received",
              "duplicate",
              "missing_or_wrong_po",
              "wrong_billing_entity",
              "other"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 500,
            "description": "Shown to the supplier exactly as written, as plain text. Line breaks, control and invisible characters are removed; the minimum counts letters and numbers."
          }
        },
        "required": [
          "reasonCode",
          "reason"
        ]
      },
      "RemittanceFileInput": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "fileName": {
            "type": "string",
            "maxLength": 400
          }
        },
        "required": [
          "fileId",
          "fileName"
        ]
      },
      "SendRemittanceInput": {
        "type": "object",
        "properties": {
          "note": {
            "type": "string",
            "maxLength": 4000
          },
          "file": {
            "$ref": "#/components/schemas/RemittanceFileInput"
          }
        }
      },
      "RecordPaymentInput": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "ach",
              "wire",
              "check",
              "card",
              "other"
            ]
          },
          "paymentDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "reference": {
            "type": "string",
            "maxLength": 256
          },
          "amount": {
            "type": "number",
            "minimum": 0.01,
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "minimum": 1e-10,
            "format": "double"
          },
          "rateDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          },
          "earlyPaymentDiscount": {
            "type": "boolean"
          },
          "remittance": {
            "$ref": "#/components/schemas/SendRemittanceInput"
          },
          "confirmReplaced": {
            "type": "boolean"
          }
        },
        "required": [
          "method",
          "paymentDate",
          "reference"
        ]
      },
      "RecordPaymentItemInput": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string",
            "maxLength": 64
          },
          "note": {
            "type": "string",
            "maxLength": 4000
          },
          "method": {
            "type": "string",
            "enum": [
              "ach",
              "wire",
              "check",
              "card",
              "other"
            ]
          },
          "paymentDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "reference": {
            "type": "string",
            "maxLength": 256
          },
          "amount": {
            "type": "number",
            "minimum": 0.01,
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "minimum": 1e-10,
            "format": "double"
          },
          "rateDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          },
          "earlyPaymentDiscount": {
            "type": "boolean"
          },
          "confirmReplaced": {
            "type": "boolean"
          }
        },
        "required": [
          "invoiceId",
          "method",
          "paymentDate",
          "reference"
        ]
      },
      "RecordPaymentsBatchInput": {
        "type": "object",
        "properties": {
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordPaymentItemInput"
            }
          }
        },
        "required": [
          "payments"
        ]
      },
      "PaymentExportInput": {
        "type": "object",
        "properties": {
          "invoiceIds": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            }
          },
          "confirmReplaced": {
            "type": "boolean"
          },
          "paymentDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "takeEarlyPaymentDiscounts": {
            "type": "boolean"
          }
        }
      },
      "RequestRemittanceUploadInput": {
        "type": "object",
        "properties": {
          "contentType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "image/png",
              "image/jpeg"
            ]
          }
        },
        "required": [
          "contentType"
        ]
      },
      "CreditPriceInput": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "minimum": 0,
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "on_demand",
              "capacity",
              "commit"
            ]
          }
        },
        "required": [
          "amount",
          "currency",
          "kind"
        ]
      },
      "SnowflakeConnectionInput": {
        "type": "object",
        "properties": {
          "account": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{1,99}$"
          },
          "user": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_$]{1,255}$"
          },
          "warehouse": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_$]{1,255}$"
          },
          "role": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_$]{1,255}$"
          }
        },
        "required": [
          "account",
          "user",
          "warehouse"
        ]
      },
      "DatabricksConnectionInput": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "pattern": "^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.(cloud\\.databricks\\.com|gcp\\.databricks\\.com|azuredatabricks\\.net)$"
          },
          "clientId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9-]{8,64}$"
          },
          "warehouseId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{8,64}$"
          }
        },
        "required": [
          "host",
          "clientId",
          "warehouseId"
        ]
      },
      "GitHubConnectionInput": {
        "type": "object",
        "properties": {
          "org": {
            "type": "string",
            "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$"
          }
        },
        "required": [
          "org"
        ]
      },
      "ZoomConnectionInput": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{8,64}$"
          },
          "clientId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{8,64}$"
          }
        },
        "required": [
          "accountId",
          "clientId"
        ]
      },
      "DatadogConnectionInput": {
        "type": "object",
        "properties": {
          "site": {
            "type": "string",
            "enum": [
              "datadoghq.com",
              "us3.datadoghq.com",
              "us5.datadoghq.com",
              "datadoghq.eu",
              "ap1.datadoghq.com",
              "ap2.datadoghq.com",
              "uk1.datadoghq.com",
              "ddog-gov.com",
              "us2.ddog-gov.com"
            ]
          },
          "apiKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{20,100}$"
          }
        },
        "required": [
          "site",
          "apiKey"
        ]
      },
      "TwilioConnectionInput": {
        "type": "object",
        "properties": {
          "accountSid": {
            "type": "string",
            "pattern": "^AC[0-9a-fA-F]{32}$"
          },
          "keySid": {
            "type": "string",
            "pattern": "^SK[0-9a-fA-F]{32}$"
          }
        },
        "required": [
          "accountSid",
          "keySid"
        ]
      },
      "MongoDbConnectionInput": {
        "type": "object",
        "properties": {
          "orgId": {
            "type": "string",
            "pattern": "^[a-f0-9]{24}$"
          },
          "clientId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{8,80}$"
          }
        },
        "required": [
          "orgId",
          "clientId"
        ]
      },
      "ConfluentConnectionInput": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string",
            "pattern": "^[A-Z0-9]{12,32}$"
          }
        },
        "required": [
          "keyId"
        ]
      },
      "VercelConnectionInput": {
        "type": "object",
        "properties": {
          "teamId": {
            "type": "string",
            "pattern": "^team_[A-Za-z0-9]{8,64}$"
          }
        },
        "required": [
          "teamId"
        ]
      },
      "CreateAiProviderInput": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "maxLength": 40
          },
          "key": {
            "type": "string",
            "maxLength": 400
          },
          "snowflake": {
            "$ref": "#/components/schemas/SnowflakeConnectionInput"
          },
          "databricks": {
            "$ref": "#/components/schemas/DatabricksConnectionInput"
          },
          "github": {
            "$ref": "#/components/schemas/GitHubConnectionInput"
          },
          "zoom": {
            "$ref": "#/components/schemas/ZoomConnectionInput"
          },
          "datadog": {
            "$ref": "#/components/schemas/DatadogConnectionInput"
          },
          "twilio": {
            "$ref": "#/components/schemas/TwilioConnectionInput"
          },
          "mongodb": {
            "$ref": "#/components/schemas/MongoDbConnectionInput"
          },
          "confluent": {
            "$ref": "#/components/schemas/ConfluentConnectionInput"
          },
          "vercel": {
            "$ref": "#/components/schemas/VercelConnectionInput"
          },
          "creditPrice": {
            "$ref": "#/components/schemas/CreditPriceInput"
          }
        },
        "required": [
          "provider"
        ]
      },
      "UpdateBudgetControlInput": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "warn",
              "block"
            ],
            "description": "off: no check. warn: an order over budget goes ahead, never auto-approved, with a warning. block: it is refused."
          },
          "period": {
            "type": "string",
            "enum": [
              "month",
              "quarter",
              "year"
            ],
            "description": "The budget period a check uses: the fiscal month, quarter or year containing the day it runs."
          }
        }
      },
      "BudgetCheckInput": {
        "type": "object",
        "properties": {
          "costCenter": {
            "type": "string",
            "maxLength": 200,
            "description": "The cost center code (or name) the document books to. Without one there is nothing to check (no_budget)."
          },
          "amount": {
            "type": "number",
            "minimum": 0,
            "description": "The document's amount, in `currency`.",
            "format": "double"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency of `amount`."
          },
          "excludeOrderId": {
            "type": "string",
            "maxLength": 64,
            "description": "An existing order being edited, so it doesn't count against itself."
          },
          "blanket": {
            "type": "boolean",
            "description": "A blanket order (billed as used, up to `amount`): what is checked is `expectedMonthly` for the current period's months within its term, never `amount`."
          },
          "expectedMonthly": {
            "type": "number",
            "minimum": 0,
            "description": "With blanket: what the order is expected to bill each month, in `currency`.",
            "format": "double"
          },
          "validUntil": {
            "type": "string",
            "description": "With blanket: the last day it runs (YYYY-MM-DD), its lines' latest validUntil; open-ended when absent."
          }
        },
        "required": [
          "amount",
          "currency"
        ]
      },
      "CreditSettlementInput": {
        "type": "object",
        "properties": {
          "creditSettlement": {
            "type": "string",
            "enum": [
              "pleaxy",
              "accounting_system"
            ],
            "description": "pleaxy: accepted credits are applied to invoices here. accounting_system: they go out in the payment export for your ERP to clear."
          }
        },
        "required": [
          "creditSettlement"
        ]
      },
      "CreateCreditNoteInput": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The invoice it corrects. Its buyer, supplier, currency, PO and PO line are the credit note's. Give this or connectionId."
          },
          "connectionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The counterparty it's for, when it corrects no one invoice - see GET .../invoices/counterparties."
          },
          "externalCreditNoteNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "The supplier's own number for it: unique per supplier within the buyer, case-insensitively."
          },
          "issueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "YYYY-MM-DD - not in the future, not more than 365 days back"
          },
          "reason": {
            "type": "string",
            "enum": [
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "other",
              "early_payment_discount"
            ],
            "description": "returned_goods and price_adjustment give PO balance back once accepted; service_credit and rebate don't. early_payment_discount documents the early-payment discount the invoice's payment took: invoiceId required, its total exactly that discount, once per invoice; it is settled by that payment, so it leaves no credit to use (GET .../invoices/:invoiceId/early-payment-credit-note prepares one)."
          },
          "correctsBilling": {
            "type": "boolean",
            "description": "Reason \"other\" only: it corrects what was billed, so it gives PO balance back too."
          },
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "1–1000 characters, e.g. the return's RMA number."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217. Required without invoiceId; with one, it must be the invoice's."
          },
          "lineItems": {
            "description": "What is credited, before tax. 1–200 lines.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateManualInvoiceLineItemInput"
            }
          },
          "taxAmount": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000000,
            "description": "The tax credited, included in the credit note's total.",
            "format": "double"
          },
          "taxBreakdown": {
            "description": "Tax by type, summing to taxAmount. At most 20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BreakdownEntryInput"
            }
          },
          "pdfBase64": {
            "type": "string",
            "description": "Base64-encoded PDF of the credit note as issued, kept with it. Up to 8 MB."
          },
          "issuedInBillingSoftware": {
            "type": "boolean",
            "description": "The supplier says it issued this document in its own billing software, and attaches that software's PDF. Required of a supplier in Spain from 2027-01-01 (Veri*factu): Pleaxy records its invoices, it doesn't issue them (400 VERI_FACTU_RECORD_ONLY otherwise)."
          },
          "sourceImportId": {
            "type": "string",
            "pattern": "^ID-[0-9A-F]{8}$",
            "description": "Buyer only: the invoice import (POST .../invoice-imports) this credit note was recorded from - the supplier's credit note document Pleaxy read. Its document is kept with the credit note when it is a PDF under 8 MB, and the import records the credit note."
          }
        },
        "required": [
          "externalCreditNoteNumber",
          "issueDate",
          "reason",
          "lineItems"
        ]
      },
      "RejectCreditNoteInput": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Why, 1–1000 characters. The supplier reads it."
          }
        },
        "required": [
          "reason"
        ]
      },
      "CreditApplicationInput": {
        "type": "object",
        "properties": {
          "creditNoteId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "amount": {
            "type": "number",
            "minimum": 0.01,
            "maximum": 1000000000000000,
            "description": "More than 0, in the invoice's currency, at most what's left of the credit note.",
            "format": "double"
          }
        },
        "required": [
          "creditNoteId",
          "amount"
        ]
      },
      "ApplyCreditsInput": {
        "type": "object",
        "properties": {
          "applications": {
            "description": "All or none, in one write. 1–20.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditApplicationInput"
            }
          }
        },
        "required": [
          "applications"
        ]
      },
      "SubstituteItemInput": {
        "type": "object",
        "properties": {
          "supplierPartId": {
            "type": "string",
            "maxLength": 100
          },
          "name": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "supplierPartId",
          "name"
        ]
      },
      "OrderConfirmationLineInput": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "number",
            "minimum": 1,
            "format": "double"
          },
          "status": {
            "type": "string",
            "enum": [
              "accept",
              "backordered",
              "change",
              "reject"
            ]
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "substitute": {
            "$ref": "#/components/schemas/SubstituteItemInput"
          },
          "shipmentDate": {
            "type": "string"
          },
          "deliveryDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "maxLength": 300
          }
        },
        "required": [
          "lineNo",
          "status"
        ]
      },
      "CreateOrderConfirmationInput": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "accept",
              "backordered",
              "detail",
              "reject"
            ]
          },
          "confirmId": {
            "type": "string",
            "maxLength": 64
          },
          "deliveryDate": {
            "type": "string"
          },
          "note": {
            "type": "string",
            "maxLength": 1000
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderConfirmationLineInput"
            }
          }
        },
        "required": [
          "type"
        ]
      },
      "DeclineConfirmationChangesInput": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "ShipNoticeLineInput": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "number",
            "minimum": 1,
            "format": "double"
          },
          "qty": {
            "type": "number",
            "format": "double"
          }
        },
        "required": [
          "lineNo",
          "qty"
        ]
      },
      "CreateShipNoticeInput": {
        "type": "object",
        "properties": {
          "shipmentId": {
            "type": "string",
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "shipped",
              "planned",
              "canceled"
            ]
          },
          "shipmentDate": {
            "type": "string"
          },
          "deliveryDate": {
            "type": "string"
          },
          "carrier": {
            "type": "string",
            "maxLength": 100
          },
          "trackingNumber": {
            "type": "string",
            "maxLength": 100
          },
          "trackingUrl": {
            "type": "string",
            "maxLength": 2048
          },
          "note": {
            "type": "string",
            "maxLength": 1000
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipNoticeLineInput"
            }
          }
        },
        "required": [
          "shipmentId"
        ]
      },
      "CreateWebhookInput": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "description": "https:// address on a host name that answers a POST with a 2xx within 10 seconds."
          },
          "description": {
            "type": "string",
            "maxLength": 400,
            "description": "Up to 100 characters, to tell endpoints apart."
          },
          "events": {
            "description": "The event types to send (ListSyncEvents' types for your side). Leave out, or send [], for all of them.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "url"
        ]
      },
      "UpdateWebhookInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "false pauses deliveries (nothing is queued while paused); true resumes them."
          },
          "url": {
            "type": "string",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 400
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PurchaseRequestSupplierInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "The supplier's name, as the requester knows it."
          },
          "supplierConnectionId": {
            "type": "string",
            "maxLength": 64,
            "description": "A supplier on the workspace's supplier list."
          },
          "supplierRegionId": {
            "type": "string",
            "maxLength": 64,
            "description": "A connected supplier's workspace region."
          }
        },
        "required": [
          "name"
        ]
      },
      "PurchaseRequestLineInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "What is needed, e.g. 27-inch monitor."
          },
          "lineType": {
            "type": "string",
            "enum": [
              "goods",
              "service"
            ],
            "description": "goods (shipped, confirmed on a goods receipt) or service (work done, confirmed on a service entry sheet). Carried onto the order's line; absent, it is read from the line (a time unit is a service, anything else goods)."
          },
          "qty": {
            "type": "number",
            "minimum": 0.0001,
            "description": "How many.",
            "format": "double"
          },
          "unit": {
            "type": "string",
            "maxLength": 20,
            "description": "e.g. each, hour, month."
          },
          "unitPrice": {
            "type": "number",
            "minimum": 0,
            "description": "Roughly what one costs, in the request's currency.",
            "format": "double"
          }
        },
        "required": [
          "name",
          "qty",
          "unitPrice"
        ]
      },
      "PurchaseRequestAnswerInput": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string",
            "description": "QuestionnaireFieldDef.id of a kind === 'custom' field"
          },
          "textAnswer": {
            "type": "string",
            "description": "text, long_text, number (e.g. \"1250.5\") and date (YYYY-MM-DD) questions"
          },
          "selectedOptionIds": {
            "description": "yes_no (\"yes\"/\"no\"), single_choice and multi_choice questions - option ids",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "file": {
            "description": "file questions - upload first via POST .../questionnaire-files/upload-url",
            "allOf": [
              {
                "$ref": "#/components/schemas/FileAnswerInput"
              }
            ]
          }
        },
        "required": [
          "fieldId"
        ]
      },
      "CreatePurchaseRequestInput": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 200,
            "description": "What is needed, in a few words."
          },
          "description": {
            "type": "string",
            "maxLength": 4000,
            "description": "Why it is needed: the business reason. Required to submit."
          },
          "costCenter": {
            "type": "string",
            "maxLength": 200,
            "description": "The cost center (a code or name on the workspace's list, stored as its code). Required to submit when the workspace keeps a list."
          },
          "glCode": {
            "type": "string",
            "maxLength": 40,
            "description": "The GL account (spend category), when it isn't the cost center's."
          },
          "supplier": {
            "description": "A supplier the requester suggests.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PurchaseRequestSupplierInput"
              }
            ]
          },
          "lineItems": {
            "description": "What is needed, line by line (one line is fine for an estimate).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseRequestLineInput"
            }
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217; the workspace's currency when absent."
          },
          "neededBy": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "When it's needed, YYYY-MM-DD."
          },
          "quoteImportId": {
            "type": "string",
            "maxLength": 64,
            "description": "A quote uploaded through the quote import, to attach."
          },
          "notes": {
            "type": "string",
            "maxLength": 2000,
            "description": "Anything procurement should know."
          },
          "requestTypeId": {
            "type": "string",
            "maxLength": 16,
            "description": "The request type (GET /request-types). Required when the workspace has an active type. The type's GL account and line type fill in what the request leaves out."
          },
          "answers": {
            "description": "Answers to the type's questions, by fieldId. On an update, the whole set (omit to keep them). A draft may leave questions blank; submitting needs every required question the answers make visible.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseRequestAnswerInput"
            }
          },
          "submit": {
            "type": "boolean",
            "description": "true submits it for approval straight away; otherwise it is saved as a draft."
          }
        },
        "required": [
          "title",
          "lineItems"
        ]
      },
      "RequestFileUploadInput": {
        "type": "object",
        "properties": {
          "contentType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "image/png",
              "image/jpeg",
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
              "application/msword",
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
              "application/vnd.ms-excel",
              "text/csv",
              "text/plain"
            ],
            "description": "PDF, image, Word, Excel, CSV or text, up to 25 MB."
          }
        },
        "required": [
          "contentType"
        ]
      },
      "UpdatePurchaseRequestInput": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 200,
            "description": "What is needed, in a few words."
          },
          "description": {
            "type": "string",
            "maxLength": 4000,
            "description": "Why it is needed: the business reason. Required to submit."
          },
          "costCenter": {
            "type": "string",
            "maxLength": 200,
            "description": "The cost center (a code or name on the workspace's list, stored as its code). Required to submit when the workspace keeps a list."
          },
          "glCode": {
            "type": "string",
            "maxLength": 40,
            "description": "The GL account (spend category), when it isn't the cost center's."
          },
          "supplier": {
            "description": "A supplier the requester suggests.",
            "allOf": [
              {
                "$ref": "#/components/schemas/PurchaseRequestSupplierInput"
              }
            ]
          },
          "lineItems": {
            "description": "What is needed, line by line (one line is fine for an estimate).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseRequestLineInput"
            }
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217; the workspace's currency when absent."
          },
          "neededBy": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "When it's needed, YYYY-MM-DD."
          },
          "quoteImportId": {
            "type": "string",
            "maxLength": 64,
            "description": "A quote uploaded through the quote import, to attach."
          },
          "notes": {
            "type": "string",
            "maxLength": 2000,
            "description": "Anything procurement should know."
          },
          "requestTypeId": {
            "type": "string",
            "maxLength": 16,
            "description": "The request type (GET /request-types). Required when the workspace has an active type. The type's GL account and line type fill in what the request leaves out."
          },
          "answers": {
            "description": "Answers to the type's questions, by fieldId. On an update, the whole set (omit to keep them). A draft may leave questions blank; submitting needs every required question the answers make visible.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseRequestAnswerInput"
            }
          }
        }
      },
      "ApprovePurchaseRequestInput": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "number",
            "description": "The approval version the caller saw; refused with 409 if the request moved since.",
            "format": "double"
          }
        }
      },
      "RejectPurchaseRequestInput": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 1000,
            "description": "Why the request is rejected; the requester sees it."
          }
        },
        "required": [
          "reason"
        ]
      },
      "ConvertPurchaseRequestInput": {
        "type": "object",
        "properties": {
          "poNumber": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._-]{1,40}$",
            "description": "Custom PO number to use as this PO's id instead of an auto-generated one (e.g. 'PO-2026-0042'). Must be unique within the region."
          },
          "supplier": {
            "type": "string",
            "description": "Supplier / counterparty name"
          },
          "matching": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way"
            ],
            "description": "How the order's invoices are matched: two_way against the order and its contract; three_way also against what was received (goods receipts and service entry sheets). Defaults to what the workspace's matching setting suggests (GET .../matching-policy). Refused for a cloud provider's order, which is matched against usage, and, when the setting lets only administrators change it, for anything but the default from anyone else."
          },
          "receiverEmployeeKey": {
            "type": "string",
            "maxLength": 100,
            "description": "Who confirms delivery: someone in this workspace, by employee key. Defaults to whoever raises the order. Used with three_way matching."
          },
          "supplierRegionId": {
            "type": "string",
            "description": "regionId of the onboarded supplier org this PO is issued to, if known. The buyer must hold an approved SupplierConnection to this supplier; the server rejects a region it isn't connected to. Links the PO to that org's real supplier workspace instead of just its free-text `supplier` name - see WorkspacesService.getSupplierWorkspace."
          },
          "supplierConnectionId": {
            "type": "string",
            "maxLength": 100,
            "description": "The id of a supplier on your Suppliers list (not rejected, not a cloud provider) this PO is for - see GET .../suppliers. One approved with a Pleaxy account is treated as its supplierRegionId. Any other (not invited yet, invited, onboarding) is named by its record: its invoices match the PO by id, the PO is emailed to its contact, and sending it invites a supplier not invited yet. The record's name replaces `supplier`. Not with supplierRegionId, provider or supplierContactEmail."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217: the currency the order is priced in. To a supplier with an account (supplierRegionId), one its region prices in, its main currency by default (400 PO_CURRENCY_NOT_OFFERED otherwise). To a cloud provider or a supplier not on Pleaxy yet, any code; by default that supplier's \"Bills in\" currency, else your workspace's. An order in a currency other than your workspace's goes through every approval step and is never auto-approved."
          },
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "payerAccounts": {
            "description": "Only with `provider`: this region's cloud connections of that provider the PO applies to, by `id`. A connection still being set up is refused. The PO stores each connection's own label and detail; any sent here are ignored.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayerAccountRefInput"
            }
          },
          "billToParty": {
            "description": "Who the supplier invoices, when it isn't the buyer's company profile billing details. Left out, the order copies those details as they are now (company name, billing address, tax id).",
            "allOf": [
              {
                "$ref": "#/components/schemas/BillToPartyInput"
              }
            ]
          },
          "billTo": {
            "type": "string",
            "maxLength": 500,
            "deprecated": true,
            "description": "Use `billToParty`. A one-line bill-to address for the buyer's company, kept as typed; ignored when `billToParty` is sent."
          },
          "costCenter": {
            "type": "string",
            "maxLength": 200,
            "description": "The cost center: when the workspace keeps a cost center list, a code or name on it (stored as the list's code; a closed one is refused); otherwise free text. An empty string clears it."
          },
          "glCode": {
            "type": "string",
            "maxLength": 40,
            "description": "The GL account (spend category) the order books to, when it isn't its cost center's. Approval steps can route by it. An empty string clears it."
          },
          "budgetOwner": {
            "type": "string"
          },
          "blanket": {
            "type": "boolean",
            "description": "A blanket order: billed as used, up to its amount. Its amount never uses the cost center's budget at once; expectedMonthly does, month by month, and its invoices as they are approved. Cloud-provider orders are blanket orders either way."
          },
          "expectedMonthly": {
            "type": "number",
            "minimum": 0,
            "description": "A blanket or cloud order's expected billing each month, in the order's currency: what its cost center's budget reserves for it.",
            "format": "double"
          },
          "buyerName": {
            "type": "string"
          },
          "supplierSite": {
            "type": "string"
          },
          "supplierContactEmail": {
            "type": "string",
            "maxLength": 254,
            "description": "Only for a supplier not on Pleaxy (no supplierRegionId or provider): their contact email. When the PO is sent (now, or when a draft is submitted), Pleaxy invites them - or links the supplier this workspace already has."
          },
          "notes": {
            "type": "string"
          },
          "contractId": {
            "type": "string",
            "maxLength": 60,
            "description": "One of this workspace's contracts this order falls under: active, and with the order's supplier (400 otherwise). Optional. Invoices against the order are checked against it."
          },
          "quoteImportId": {
            "type": "string",
            "maxLength": 20,
            "description": "The quote import (POST .../quote-imports) holding the supplier's quote this order is raised from. Its upload must have finished. Optional."
          },
          "sowImportId": {
            "type": "string",
            "maxLength": 20,
            "description": "The quote import (POST .../quote-imports) holding the statement of work this order is for: its scope, milestones and acceptance. Its upload must have finished. Optional, and independent of quoteImportId."
          },
          "draft": {
            "type": "boolean",
            "description": "Save as a draft instead of submitting for approval. Submit it later with SubmitPurchaseOrderDraft."
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItemInput"
            }
          }
        }
      },
      "CheckAiSpendInput": {
        "type": "object",
        "properties": {
          "invoicerId": {
            "type": "string",
            "maxLength": 100
          },
          "costCenter": {
            "type": "string",
            "maxLength": 200
          },
          "poId": {
            "type": "string",
            "maxLength": 100
          },
          "period": {
            "type": "string",
            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
          }
        }
      },
      "DraftAiOrdersInput": {
        "type": "object",
        "properties": {
          "invoicerIds": {
            "description": "The invoicers (cloud accounts or AI provider connections) to draft an order for: the ones recommendations lists under uncovered.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "period": {
            "type": "string",
            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
            "description": "The month the orders cover, YYYY-MM. Default this month."
          },
          "scope": {
            "type": "string",
            "enum": [
              "ai",
              "account"
            ],
            "description": "ai (default): lines per model and meter for the AI usage. account: one amount line for everything the cloud account bills, for a cloud account recommendations lists under accounts."
          }
        },
        "required": [
          "invoicerIds"
        ]
      },
      "SetAiRenewalRuleInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether next month's AI orders are drafted from the forecast."
          },
          "dayOfMonth": {
            "type": "number",
            "minimum": 1,
            "maximum": 28,
            "description": "The day of the month (1-28) from which the drafts are raised. Default 25.",
            "format": "double"
          },
          "draftUncovered": {
            "type": "boolean",
            "description": "Whether Pleaxy also drafts an order for this month's spend no order covers (GetAiRecommendations' uncovered and accounts), once per provider or account a month, from the 3rd. Drafts only: a person reviews and submits them. Unchanged when absent."
          }
        },
        "required": [
          "enabled"
        ]
      },
      "AiAttributionRuleInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ar_[a-f0-9]{8}$",
            "description": "The rule's id, to keep it; a new rule gets one."
          },
          "invoicerId": {
            "type": "string",
            "maxLength": 80,
            "description": "Only this invoicer's lines (a cloud connection or AI provider id). Every invoicer when left out."
          },
          "dimension": {
            "type": "string",
            "enum": [
              "tag",
              "label",
              "project",
              "workspace",
              "api_key",
              "inference_profile",
              "resource_group",
              "compartment",
              "cluster"
            ]
          },
          "key": {
            "type": "string",
            "maxLength": 128,
            "description": "The tag or label key; tag and label only."
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "The value the line must carry for the dimension (and key)."
          },
          "costCenter": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "The cost center's code."
          }
        },
        "required": [
          "dimension",
          "value",
          "costCenter"
        ]
      },
      "SetAiAttributionInput": {
        "type": "object",
        "properties": {
          "rules": {
            "description": "Every rule, in order: first match wins. At most 200.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiAttributionRuleInput"
            }
          },
          "version": {
            "type": "number",
            "minimum": 0,
            "description": "The version the rules were read at (GetAiAttribution's version); 0 for the first save.",
            "format": "double"
          }
        },
        "required": [
          "rules",
          "version"
        ]
      },
      "SetAiSeatCountInput": {
        "type": "object",
        "properties": {
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "openrouter",
              "mistral",
              "cohere",
              "xai",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ],
            "description": "Who bills the seats."
          },
          "product": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9._-]{0,79}$",
            "description": "The seat product, as the order line names it (its ai.model), e.g. chatgpt-enterprise."
          },
          "period": {
            "type": "string",
            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
            "description": "The month, YYYY-MM."
          },
          "activeUsers": {
            "type": "number",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Active users in the identity provider that month: those holding a seat who signed in.",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "okta",
              "entra",
              "google_workspace",
              "jumpcloud",
              "provider_console",
              "manual"
            ]
          }
        },
        "required": [
          "invoicer",
          "product",
          "period",
          "activeUsers",
          "source"
        ]
      },
      "CreateFocusExportInput": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "enum": [
              "1.2",
              "1.4"
            ]
          },
          "include": {
            "type": "string",
            "enum": [
              "all",
              "non_cloud"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "parquet"
            ]
          }
        },
        "required": [
          "from",
          "to"
        ]
      },
      "MapFocusIssuerInput": {
        "type": "object",
        "properties": {
          "supplierConnectionId": {
            "type": "string",
            "nullable": true,
            "maxLength": 100
          }
        }
      },
      "CreateFocusUploadInput": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "fileName"
        ]
      },
      "FocusAwsSourceInput": {
        "type": "object",
        "properties": {
          "bucket": {
            "type": "string",
            "maxLength": 63
          },
          "prefix": {
            "type": "string",
            "maxLength": 400
          },
          "region": {
            "type": "string",
            "maxLength": 30
          }
        },
        "required": [
          "bucket",
          "region"
        ]
      },
      "FocusAzureSourceInput": {
        "type": "object",
        "properties": {
          "storageAccount": {
            "type": "string",
            "maxLength": 24
          },
          "container": {
            "type": "string",
            "maxLength": 63
          },
          "directory": {
            "type": "string",
            "maxLength": 400
          }
        },
        "required": [
          "storageAccount",
          "container"
        ]
      },
      "FocusGcpSourceInput": {
        "type": "object",
        "properties": {
          "table": {
            "type": "string",
            "maxLength": 300
          }
        },
        "required": [
          "table"
        ]
      },
      "FocusOciSourceInput": {
        "type": "object",
        "properties": {
          "region": {
            "type": "string",
            "maxLength": 40
          }
        },
        "required": [
          "region"
        ]
      },
      "FocusS3CompatibleSourceInput": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "maxLength": 200
          },
          "region": {
            "type": "string",
            "maxLength": 40
          },
          "bucket": {
            "type": "string",
            "maxLength": 63
          },
          "prefix": {
            "type": "string",
            "maxLength": 400
          },
          "accessKeyId": {
            "type": "string",
            "maxLength": 200
          },
          "secretAccessKey": {
            "type": "string",
            "maxLength": 400
          }
        },
        "required": [
          "endpoint",
          "region",
          "bucket",
          "accessKeyId",
          "secretAccessKey"
        ]
      },
      "CreateFocusSourceInput": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "aws_s3",
              "azure_blob",
              "gcp_bigquery",
              "oci",
              "s3_compatible"
            ]
          },
          "label": {
            "type": "string",
            "maxLength": 80
          },
          "connectionId": {
            "type": "string",
            "maxLength": 100
          },
          "aws": {
            "$ref": "#/components/schemas/FocusAwsSourceInput"
          },
          "azure": {
            "$ref": "#/components/schemas/FocusAzureSourceInput"
          },
          "gcp": {
            "$ref": "#/components/schemas/FocusGcpSourceInput"
          },
          "oci": {
            "$ref": "#/components/schemas/FocusOciSourceInput"
          },
          "s3": {
            "$ref": "#/components/schemas/FocusS3CompatibleSourceInput"
          }
        },
        "required": [
          "kind"
        ]
      },
      "SetAiSpendLimitInput": {
        "type": "object",
        "properties": {
          "invoicerId": {
            "type": "string",
            "maxLength": 80,
            "description": "The invoicer the order covers: a cloud connection or AI provider id with a limits credential."
          },
          "target": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,100}$",
            "description": "OpenAI: the project (proj_...). Anthropic: the workspace (wrkspc_...). Google Cloud: the project id, for a spend cap."
          },
          "deny": {
            "type": "boolean",
            "description": "Stop spend at the ceiling where the provider can (default true); false only alerts."
          }
        },
        "required": [
          "invoicerId"
        ]
      },
      "SetAiLimitCredentialInput": {
        "type": "object",
        "properties": {
          "roleArn": {
            "type": "string",
            "pattern": "^arn:aws:iam::\\d{12}:role\\/[\\w+=,.@\\/-]{1,512}$",
            "description": "AWS: the limits role the setup script created (budgets only), never the read-only billing role."
          },
          "executionRoleArn": {
            "type": "string",
            "pattern": "^arn:aws:iam::\\d{12}:role\\/[\\w+=,.@\\/-]{1,512}$",
            "description": "AWS, for a ceiling that stops spend: the budget action's execution role (trusting budgets.amazonaws.com)."
          },
          "denyPolicyArn": {
            "type": "string",
            "pattern": "^arn:aws:iam::(\\d{12}|aws):policy\\/[\\w+=,.@\\/-]{1,512}$",
            "description": "AWS: the deny policy the budget action attaches at 100%."
          },
          "roleNames": {
            "description": "AWS: the roles (names, not ARNs) the deny policy is attached to, e.g. the ones your apps call Bedrock with.",
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[\\w+=,.@-]{1,64}$"
            }
          },
          "serviceAccountEmail": {
            "type": "string",
            "description": "Google Cloud: the limits service account (Billing Account Costs Manager, plus spend caps where wanted)."
          },
          "clientId": {
            "type": "string",
            "pattern": "^[0-9a-fA-F-]{36}$",
            "description": "Azure: the limits app registration's client id (Cost Management Contributor on the billing profile)."
          },
          "key": {
            "type": "string",
            "maxLength": 400,
            "description": "OpenAI and Anthropic: a separate admin key for the limits, never the read key. Stored encrypted, never returned."
          },
          "notifyEmail": {
            "type": "string",
            "description": "Who the provider emails when a ceiling is reached (AWS budget actions, Azure budgets)."
          }
        }
      },
      "SourcingLineInput": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,40}$",
            "description": "The line's id, kept across edits so answers stay on it. Absent on a new line: the server gives one."
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "What is asked for, 1–200 characters."
          },
          "qty": {
            "type": "number",
            "minimum": 0.0001,
            "description": "How many.",
            "format": "double"
          },
          "unit": {
            "type": "string",
            "maxLength": 20,
            "description": "e.g. each, hour, month."
          },
          "neededBy": {
            "type": "string",
            "description": "When it is needed, YYYY-MM-DD. The comparison tells whether each answer's lead time meets it."
          },
          "notes": {
            "type": "string",
            "maxLength": 2000,
            "description": "Specifications or notes for suppliers, up to 2,000 characters."
          },
          "targetUnitPrice": {
            "type": "number",
            "minimum": 0,
            "description": "The buyer's target unit price. Buyer-only: never shown to a supplier.",
            "format": "double"
          }
        },
        "required": [
          "name",
          "qty"
        ]
      },
      "CreateSourcingEventInput": {
        "type": "object",
        "properties": {
          "fromRequestId": {
            "type": "string",
            "maxLength": 64,
            "description": "An approved purchase request with no order: its lines, cost center, GL account, needed-by and files are copied, and it moves to `sourcing`."
          },
          "title": {
            "type": "string",
            "maxLength": 200,
            "description": "1–200 characters. From a request: the request's title unless given."
          },
          "description": {
            "type": "string",
            "maxLength": 5000,
            "description": "What the suppliers are asked for, up to 5,000 characters."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217: the currency suppliers answer in. Default: the request's, else the workspace's."
          },
          "dueAt": {
            "type": "string",
            "description": "The answer deadline, an ISO timestamp; it must be in the future when the RFQ is sent. Default: 7 days from now."
          },
          "sealed": {
            "type": "boolean",
            "description": "Sealed (the default): until it closes, the buyer sees who answered and when, never prices or files."
          },
          "lines": {
            "description": "From a request: the request's lines unless given.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingLineInput"
            }
          },
          "costCenter": {
            "type": "string",
            "maxLength": 100
          },
          "glCode": {
            "type": "string",
            "maxLength": 100
          }
        }
      },
      "CommentMeetingInput": {
        "type": "object",
        "properties": {
          "topic": {
            "type": "string",
            "description": "What the meeting is about, on one line."
          },
          "durationMinutes": {
            "type": "number",
            "enum": [
              15,
              30,
              45
            ],
            "description": "How long the meeting lasts, in minutes.",
            "format": "double"
          },
          "timeZone": {
            "type": "string",
            "description": "Your time zone, as an IANA name such as Europe/Madrid."
          },
          "times": {
            "minItems": 2,
            "maxItems": 3,
            "description": "Two or three proposed start times, ISO 8601 with an offset, in the future.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "link": {
            "type": "string",
            "description": "An https link to the call."
          }
        },
        "required": [
          "topic",
          "durationMinutes",
          "timeZone",
          "times"
        ]
      },
      "CreateCommentInput": {
        "type": "object",
        "properties": {
          "body": {
            "type": "string",
            "maxLength": 2000,
            "description": "Plain text. Line breaks are kept; control, bidi and invisible characters are removed."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "internal",
              "shared"
            ],
            "description": "internal: your own team only. shared: the other side of the relationship reads and answers it too. A supplier's comments are always shared."
          },
          "mentions": {
            "maxItems": 10,
            "description": "Employee keys of people in your own workspace to notify.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "meeting": {
            "description": "Makes the comment a meeting request to the other company (shared only): `topic` (one line), `durationMinutes` (15, 30 or 45), `timeZone` (yours, IANA), `times` (two or three ISO 8601 starts with an offset, in the future) and an optional https `link` to the call. Starting one needs a paid plan; one open request per document.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CommentMeetingInput"
              }
            ]
          }
        },
        "required": [
          "body",
          "visibility"
        ]
      },
      "UpdateUsageAlertSettingsInput": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether usage anomaly alerts are sent. Off: nothing is sent; the spend page still shows what the rules find."
          },
          "sensitivity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "description": "high: 25% above the trend, 20% above last month, from 100 a month. medium (default): 50%, 30%, from 500. low: 100%, 50%, from 2,000. The minimum is in each subject's own currency, scaled for currencies like JPY (medium: JPY 75,000) unless the workspace set its own for that currency (minimums)."
          },
          "minimums": {
            "type": "object",
            "additionalProperties": {
              "type": "number",
              "nullable": true,
              "format": "double"
            },
            "example": {
              "USD": 1000,
              "JPY": 100000
            },
            "description": "The least a finding must add (or miss by) over a month, per currency the workspace is billed in (ISO 4217): used as set, whatever the sensitivity. Merged into what is stored; null for a currency goes back to its default."
          }
        }
      },
      "EmployeeSummary": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "canApprovePurchaseOrders": {
            "type": "boolean"
          },
          "canApproveInvoices": {
            "type": "boolean"
          }
        }
      },
      "ApiKeySummary": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string"
          },
          "regionId": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "procurementRole": {
            "type": "string",
            "enum": [
              "administrator",
              "read-only",
              "contracts-and-suppliers",
              "relationships",
              "requisitions",
              "finance",
              "agent"
            ]
          },
          "supplierRole": {
            "type": "string",
            "enum": [
              "administrator",
              "read-only",
              "accounts-receivable",
              "sales",
              "fulfillment",
              "member"
            ]
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "invoices:feed",
                "payments:record",
                "orders:fulfill"
              ]
            }
          },
          "label": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "revoked": {
            "type": "boolean"
          }
        }
      },
      "CloudConnectionPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CloudConnection"
            }
          },
          "nextCursor": {
            "type": "string"
          }
        }
      },
      "CloudConnection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "accountLabel": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "spend": {
            "type": "number",
            "format": "double"
          },
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "pending",
              "error"
            ]
          },
          "connectedAt": {
            "type": "string"
          },
          "setup": {
            "$ref": "#/components/schemas/CloudSetupView"
          },
          "bulk": {
            "$ref": "#/components/schemas/CloudBulkAccountView"
          },
          "roleArn": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "awsAccountId": {
            "type": "string"
          },
          "lastSyncedAt": {
            "type": "string"
          },
          "lastSyncStatus": {
            "type": "string",
            "enum": [
              "error",
              "ok",
              "throttled",
              "never"
            ]
          },
          "lastSyncError": {
            "type": "string"
          },
          "lastSyncErrorCode": {
            "type": "string",
            "enum": [
              "throttled",
              "access_revoked",
              "platform_config",
              "data_not_enabled",
              "unknown"
            ]
          },
          "aiSync": {
            "$ref": "#/components/schemas/CloudAiSyncState"
          },
          "focusSourceId": {
            "type": "string"
          },
          "dataSources": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "invoices",
                "current_cost"
              ]
            }
          },
          "billing": {
            "$ref": "#/components/schemas/CloudConnectionBilling"
          },
          "gcp": {
            "type": "object",
            "properties": {
              "billingAccountId": {
                "type": "string"
              },
              "providerId": {
                "type": "string"
              }
            }
          },
          "oci": {
            "type": "object",
            "properties": {
              "homeRegion": {
                "type": "string"
              },
              "keyFingerprint": {
                "type": "string"
              }
            }
          },
          "azure": {
            "type": "object",
            "properties": {
              "scopeDisplayName": {
                "type": "string"
              },
              "agreementType": {
                "type": "string",
                "enum": [
                  "MicrosoftCustomerAgreement",
                  "EnterpriseAgreement"
                ]
              }
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "CloudSetupView": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "resumable",
              "started_by_someone_else",
              "start_over",
              "unavailable",
              "verifying",
              "failed"
            ]
          },
          "expiresAt": {
            "type": "string"
          }
        }
      },
      "CloudBulkAccountView": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "list",
              "register"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "verifying",
              "failed"
            ]
          },
          "attempts": {
            "type": "number",
            "format": "double"
          },
          "nextAttemptAt": {
            "type": "string"
          },
          "failedAt": {
            "type": "string"
          },
          "costCenter": {
            "type": "string"
          }
        }
      },
      "CloudAiSyncState": {
        "type": "object",
        "properties": {
          "syncedAt": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "error",
              "ok",
              "throttled"
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "throttled",
              "access_revoked",
              "platform_config",
              "data_not_enabled",
              "unknown"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "CloudConnectionBilling": {
        "type": "object",
        "properties": {
          "finalizedInvoice": {
            "type": "object",
            "properties": {
              "periodLabel": {
                "type": "string"
              },
              "totalAmount": {
                "type": "number",
                "format": "double"
              },
              "asOf": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "enum": [
                  "aws_invoice",
                  "billing_export",
                  "mca_invoice",
                  "ea_balance",
                  "usage_api_closed_month",
                  "osp_invoice",
                  "focus_export",
                  "cost_explorer_month"
                ]
              },
              "amountPayable": {
                "type": "number",
                "format": "double"
              },
              "adjustments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "documentType": {
                      "type": "string",
                      "enum": [
                        "VoidNote",
                        "CreditNote"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "format": "double"
                    },
                    "currency": {
                      "type": "string"
                    }
                  }
                }
              },
              "lines": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CloudUsageLine"
                }
              }
            }
          },
          "previousFinalizedInvoice": {
            "type": "object",
            "properties": {
              "periodLabel": {
                "type": "string"
              },
              "totalAmount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "enum": [
                  "aws_invoice",
                  "billing_export",
                  "mca_invoice",
                  "ea_balance",
                  "usage_api_closed_month",
                  "osp_invoice",
                  "focus_export",
                  "cost_explorer_month"
                ]
              }
            }
          },
          "currentPeriodEstimate": {
            "type": "object",
            "properties": {
              "totalAmount": {
                "type": "number",
                "format": "double"
              },
              "forecastAmount": {
                "type": "number",
                "format": "double"
              },
              "asOf": {
                "type": "string"
              },
              "confidence": {
                "type": "string",
                "enum": [
                  "estimate_in_progress"
                ]
              },
              "currency": {
                "type": "string"
              },
              "services": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CloudServiceCost"
                }
              }
            }
          }
        }
      },
      "CloudUsageLine": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "project": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "CloudServiceCost": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AwsCloudConnectionInit": {
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string"
          },
          "platformAwsAccountId": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "cloudFormationTemplateUrl": {
            "type": "string"
          }
        }
      },
      "QuestionnaireFieldDef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "standard",
              "custom"
            ]
          },
          "docType": {
            "type": "string",
            "enum": [
              "w9",
              "w8ben",
              "coi",
              "bank_letter",
              "business_license"
            ]
          },
          "label": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "helpText": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "number",
              "text",
              "long_text",
              "yes_no",
              "single_choice",
              "multi_choice",
              "date",
              "file"
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionOption"
            }
          },
          "showIf": {
            "$ref": "#/components/schemas/QuestionCondition"
          },
          "section": {
            "type": "string"
          },
          "flagIf": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "QuestionOption": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "QuestionCondition": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string"
          },
          "anyOf": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "QuestionnaireResponseItem": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "auto_filled",
              "manual",
              "missing",
              "not_applicable"
            ]
          },
          "supplierDocumentId": {
            "type": "string"
          },
          "textAnswer": {
            "type": "string"
          },
          "selectedOptionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "file": {
            "$ref": "#/components/schemas/QuestionnaireFileAnswer"
          },
          "flagged": {
            "type": "boolean"
          }
        }
      },
      "QuestionnaireFileAnswer": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SupplierRegionRequest": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "LateFeeTerms": {
        "type": "object",
        "properties": {
          "graceDays": {
            "type": "number",
            "format": "double"
          },
          "basis": {
            "type": "string",
            "enum": [
              "contractual",
              "statutory"
            ]
          },
          "statute": {
            "type": "string",
            "enum": [
              "eu_late_payment_directive",
              "uk_late_payment_act"
            ]
          },
          "statuteCountry": {
            "type": "string"
          },
          "interest": {
            "type": "object",
            "properties": {
              "ratePct": {
                "type": "number",
                "format": "double"
              },
              "per": {
                "type": "string",
                "enum": [
                  "month",
                  "year"
                ]
              }
            }
          },
          "fixedCharge": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "EarlyPaymentStandingOffer": {
        "type": "object",
        "properties": {
          "percent": {
            "type": "number",
            "format": "double"
          },
          "daysBeforeDue": {
            "type": "number",
            "format": "double"
          },
          "updatedAt": {
            "type": "string"
          }
        }
      },
      "CloudConnectionDisconnected": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "ociKeyFingerprint": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "AutonomySettings": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "maxAutoApproveAmount": {
            "type": "number",
            "format": "double"
          },
          "approvalThreshold": {
            "type": "number",
            "format": "double"
          },
          "invoice": {
            "$ref": "#/components/schemas/InvoiceAutonomySettings"
          }
        }
      },
      "InvoiceAutonomySettings": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "maxAutoApproveAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ApprovalChainSettings": {
        "type": "object",
        "properties": {
          "process": {
            "type": "string",
            "enum": [
              "purchase_order",
              "invoice_payment",
              "service_entry_sheet",
              "purchase_request"
            ]
          },
          "linkedTo": {
            "type": "string",
            "enum": [
              "purchase_order",
              "invoice_payment"
            ]
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStageGroupDef"
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "default"
            ]
          },
          "defaultApproverIsAdmin": {
            "type": "boolean"
          },
          "requesterRule": {
            "type": "object",
            "properties": {
              "eligibleApproverCount": {
                "type": "number",
                "format": "double"
              }
            }
          }
        }
      },
      "ApprovalStageGroupDef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "parallel",
              "sequential"
            ]
          },
          "label": {
            "type": "string"
          },
          "stages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStageDef"
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStepCondition"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "ApprovalStageDef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "approverEmployeeKey": {
            "type": "string"
          },
          "approverName": {
            "type": "string"
          },
          "approverEmail": {
            "type": "string"
          },
          "highValueOnly": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "ApprovalStepCondition": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "enum": [
              "supplier",
              "amount",
              "requester",
              "costCenter",
              "glCode",
              "requestType",
              "answer"
            ]
          },
          "operator": {
            "type": "string",
            "enum": [
              "gt",
              "gte",
              "lt",
              "lte",
              "is",
              "is_not"
            ]
          },
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number",
                "format": "double"
              }
            ]
          },
          "questionId": {
            "type": "string"
          }
        }
      },
      "RequestType": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "order": {
            "type": "number",
            "format": "double"
          },
          "defaults": {
            "type": "object",
            "properties": {
              "glCode": {
                "type": "string"
              },
              "lineType": {
                "type": "string",
                "enum": [
                  "goods",
                  "service"
                ]
              }
            }
          },
          "supplierQuestionnaireId": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionnaireFieldDef"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "usedAt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "updatedBy": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "AutomationRuleSetView": {
        "type": "object",
        "properties": {
          "process": {
            "type": "string",
            "enum": [
              "purchase_order",
              "invoice_payment"
            ]
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRule"
            }
          },
          "autoApproveAllowed": {
            "type": "boolean"
          }
        }
      },
      "AutomationRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "conditions": {
            "$ref": "#/components/schemas/AutomationRuleCondition"
          },
          "autoApprove": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "AutomationRuleCondition": {
        "type": "object",
        "properties": {
          "supplierWorkspaceId": {
            "type": "string"
          },
          "supplierContains": {
            "type": "string"
          },
          "maxAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AutomationRuleSet": {
        "type": "object",
        "properties": {
          "process": {
            "type": "string",
            "enum": [
              "purchase_order",
              "invoice_payment"
            ]
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRule"
            }
          }
        }
      },
      "FeedAttemptsPage": {
        "type": "object",
        "properties": {
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FeedAttempt"
            }
          },
          "before": {
            "type": "string"
          }
        }
      },
      "FeedAttempt": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "submit",
              "validate"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "accepted",
              "replayed",
              "valid",
              "refused"
            ]
          },
          "status": {
            "type": "number",
            "format": "double"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "messageId": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number",
                  "format": "double"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "invoiceNumber": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "creditNoteId": {
            "type": "string"
          },
          "keyId": {
            "type": "string"
          },
          "cursor": {
            "type": "string"
          }
        }
      },
      "SupplierDirectoryPage": {
        "type": "object",
        "properties": {
          "suppliers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierDirectoryListing"
            }
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "nextOffset": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SupplierDirectoryListing": {
        "type": "object",
        "properties": {
          "companyName": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          },
          "regions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "regionName": {
                  "type": "string"
                },
                "directoryId": {
                  "type": "string"
                }
              }
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sponsored": {
            "type": "boolean"
          },
          "connectionId": {
            "type": "string"
          }
        }
      },
      "Notification": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "audience": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "recipientEmployeeKey": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "ai_forecast_over_budget",
              "usage_anomaly",
              "usage_contract_projection",
              "ai_drafts_ready",
              "report_ready",
              "company_report_ready",
              "po_approved",
              "po_rejected",
              "po_canceled",
              "po_changed",
              "po_approval_requested",
              "request_approval_requested",
              "request_approved",
              "request_rejected",
              "request_ordered",
              "rfq_invited",
              "rfq_due_soon",
              "rfq_deadline_moved",
              "rfq_canceled",
              "rfq_awarded",
              "rfq_not_selected",
              "rfq_question_answered",
              "rfq_answer_received",
              "rfq_deadline_passed",
              "rfq_declined",
              "rfq_question_asked",
              "rfq_not_shortlisted",
              "rfq_evaluate",
              "rfq_evaluation_complete",
              "po_store_order_problem",
              "po_supplier_confirmed",
              "po_supplier_exception",
              "po_shipped",
              "po_supplier_email",
              "po_changes_declined",
              "po_needs_approver",
              "invoice_submitted",
              "invoice_ready_for_approval",
              "invoice_approval_requested",
              "invoice_discrepancy",
              "invoice_approved",
              "invoice_paid",
              "invoice_payment_withdrawn",
              "payment_problem_reported",
              "payment_problem_answered",
              "payment_receipt_to_confirm",
              "payments_recorded_by_key",
              "accounting_sync_failed",
              "invoice_remittance_sent",
              "invoice_payment_failed",
              "invoice_reminder",
              "invoice_rejected",
              "invoice_on_hold",
              "invoice_hold_released",
              "credit_request_received",
              "credit_request_answered",
              "credit_request_attention",
              "recovery_weekly_digest",
              "invoice_payment_reminder",
              "invoice_entered_by_buyer",
              "invoice_bank_details_to_confirm",
              "invoice_bank_details_confirmed",
              "invoice_early_payment_offer",
              "invoice_bank_account_to_approve",
              "supplier_screening_match",
              "invoice_bank_details_disputed",
              "invoice_bank_details_changed",
              "supplier_bank_details_changed",
              "invoice_needs_approver",
              "ses_approval_requested",
              "ses_auto_approved",
              "ses_approved",
              "ses_rejected",
              "receipt_return_recorded",
              "po_line_due",
              "po_line_due_asked",
              "po_receipt_requested",
              "invoice_held_due_soon",
              "ses_approval_overdue",
              "credit_note_received",
              "credit_note_accepted",
              "credit_note_rejected",
              "credit_note_applied",
              "invoice_comment",
              "po_comment",
              "contract_comment",
              "invoice_feed_changed",
              "supplier_connection_invited",
              "supplier_connection_submitted",
              "supplier_connection_approved",
              "supplier_connection_rejected",
              "supplier_connection_region_mismatch",
              "agent_request",
              "support_case_opened",
              "support_case_updated",
              "supplier_late_fee_terms_changed",
              "supplier_early_payment_offer_changed",
              "contract_terms_to_acknowledge",
              "contract_terms_acknowledged",
              "contract_terms_disputed",
              "contract_recheck_requested",
              "contract_sent_to_joined_supplier",
              "contract_renewal_notice_due",
              "contract_termination_notice_due",
              "contract_seat_review_due",
              "copilot_allowance_80",
              "copilot_allowance_100",
              "copilot_degraded",
              "copilot_packs_low",
              "copilot_packs_empty",
              "copilot_payg_cap",
              "agent_connected",
              "agent_signed_out"
            ]
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "titleMessageId": {
            "type": "string"
          },
          "titleParams": {
            "$ref": "#/components/schemas/ServerMessageParams"
          },
          "bodyMessageId": {
            "type": "string"
          },
          "bodyParams": {
            "$ref": "#/components/schemas/ServerMessageParams"
          },
          "relatedId": {
            "type": "string"
          },
          "stageId": {
            "type": "string"
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "read": {
            "type": "boolean"
          },
          "resolution": {
            "$ref": "#/components/schemas/NotificationResolution"
          }
        },
        "required": [
          "id"
        ]
      },
      "ServerMessageParams": {
        "type": "object",
        "properties": {},
        "additionalProperties": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number",
              "format": "double"
            },
            {
              "type": "boolean"
            },
            {
              "$ref": "#/components/schemas/ServerMessage"
            }
          ]
        }
      },
      "ServerMessage": {
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string"
          },
          "params": {
            "$ref": "#/components/schemas/ServerMessageParams"
          }
        }
      },
      "NotificationResolution": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "you_approved",
              "you_rejected",
              "no_longer_needed"
            ]
          },
          "at": {
            "type": "string"
          }
        }
      },
      "NotificationPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Notification"
            }
          },
          "nextCursor": {
            "type": "string"
          },
          "unreadCount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "MarkAllNotificationsReadResult": {
        "type": "object",
        "properties": {
          "updated": {
            "type": "number",
            "format": "double"
          },
          "remaining": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": "string"
          }
        }
      },
      "ReminderSettings": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "idleDays": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ProfileImages": {
        "type": "object",
        "properties": {
          "profile": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ImageRef"
              }
            ],
            "nullable": true
          },
          "company": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ImageRef"
              }
            ],
            "nullable": true
          }
        }
      },
      "ImageRef": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          }
        }
      },
      "PostalAddress": {
        "type": "object",
        "properties": {
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "country": {
            "type": "string"
          }
        }
      },
      "Geography": {
        "type": "object",
        "properties": {
          "presetId": {
            "type": "string",
            "enum": [
              "eu",
              "eea",
              "uk",
              "emea",
              "apac",
              "latam",
              "namer",
              "global",
              "continent-africa",
              "continent-antarctica",
              "continent-asia",
              "continent-europe",
              "continent-north-america",
              "continent-oceania",
              "continent-south-america"
            ]
          },
          "presetVersion": {
            "type": "string"
          }
        }
      },
      "SameDomainAcknowledgement": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string"
          },
          "companyIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "at": {
            "type": "string"
          }
        }
      },
      "EInvoicingProfileSettings": {
        "type": "object",
        "properties": {
          "contactName": {
            "type": "string"
          },
          "contactPhone": {
            "type": "string"
          },
          "contactEmail": {
            "type": "string"
          },
          "electronicAddress": {
            "type": "object",
            "properties": {
              "scheme": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            }
          },
          "buyerReference": {
            "type": "string"
          }
        }
      },
      "OrgProfile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "regionId": {
            "type": "string"
          },
          "regionName": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "billingEmail": {
            "type": "string"
          },
          "billingAddress": {
            "type": "string"
          },
          "billingAddressParts": {
            "$ref": "#/components/schemas/PostalAddress"
          },
          "billingAddressLegacyText": {
            "type": "string"
          },
          "billingAddressNeedsReview": {
            "type": "boolean"
          },
          "taxId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "otherCurrencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "paymentCurrencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fxWarningPct": {
            "type": "number",
            "format": "double"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "geography": {
            "$ref": "#/components/schemas/Geography"
          },
          "timeZone": {
            "type": "string"
          },
          "locale": {
            "type": "string",
            "enum": [
              "en",
              "es",
              "pt-BR",
              "de",
              "fr",
              "it"
            ]
          },
          "primaryContactName": {
            "type": "string"
          },
          "primaryContactEmail": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "sameDomainAcknowledged": {
            "$ref": "#/components/schemas/SameDomainAcknowledgement"
          },
          "verified": {
            "type": "boolean"
          },
          "listedInDirectory": {
            "type": "boolean"
          },
          "directoryId": {
            "type": "string"
          },
          "sellsCategories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sellsSegments": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sponsoredUntil": {
            "type": "string"
          },
          "sponsoredContract": {
            "type": "string"
          },
          "setupGoal": {
            "type": "string",
            "enum": [
              "audit",
              "network"
            ]
          },
          "eInvoicing": {
            "$ref": "#/components/schemas/EInvoicingProfileSettings"
          }
        },
        "required": [
          "id"
        ]
      },
      "PurchaseOrder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "supplier": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "paid",
              "pending_approval",
              "awaiting_fulfillment",
              "invoiced",
              "draft",
              "canceled",
              "closed",
              "expired"
            ]
          },
          "invoiceId": {
            "type": "string"
          },
          "invoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoicedAmount": {
            "type": "number",
            "format": "double"
          },
          "priorInvoiced": {
            "$ref": "#/components/schemas/PurchaseOrderPriorInvoiced"
          },
          "rejectedInvoiceCount": {
            "type": "number",
            "format": "double"
          },
          "lastRejectedInvoiceId": {
            "type": "string"
          },
          "lastReplacedInvoiceId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "payerAccounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayerAccountRef"
            }
          },
          "billTo": {
            "type": "string"
          },
          "billToParty": {
            "$ref": "#/components/schemas/PurchaseOrderBillTo"
          },
          "costCenter": {
            "type": "string"
          },
          "costCenterChanges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderCostCenterChange"
            }
          },
          "glCode": {
            "type": "string"
          },
          "blanket": {
            "type": "boolean"
          },
          "expectedMonthly": {
            "type": "number",
            "format": "double"
          },
          "submittedAt": {
            "type": "string"
          },
          "budgetCheck": {
            "$ref": "#/components/schemas/BudgetCheck"
          },
          "requestId": {
            "type": "string"
          },
          "budgetOwner": {
            "type": "string"
          },
          "buyerName": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "supplierSite": {
            "type": "string"
          },
          "supplierContactEmail": {
            "type": "string"
          },
          "supplierInvite": {
            "$ref": "#/components/schemas/PurchaseOrderSupplierInvite"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "supplierEmail": {
            "type": "object",
            "properties": {
              "to": {
                "type": "string"
              },
              "at": {
                "type": "string"
              }
            }
          },
          "mailboxToken": {
            "type": "string"
          },
          "quoteDocument": {
            "$ref": "#/components/schemas/PurchaseOrderQuoteDocument"
          },
          "sowDocument": {
            "$ref": "#/components/schemas/PurchaseOrderQuoteDocument"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            }
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "everSpendLimitGated": {
            "type": "boolean"
          },
          "spendLimitGatedAt": {
            "type": "string"
          },
          "updatedBy": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "lastChange": {
            "$ref": "#/components/schemas/PurchaseOrderChangeSummary"
          },
          "approvalAmount": {
            "type": "number",
            "format": "double"
          },
          "punchout": {
            "$ref": "#/components/schemas/PurchaseOrderPunchout"
          },
          "storeId": {
            "type": "string"
          },
          "deliveryAddressId": {
            "type": "string"
          },
          "shipTo": {
            "$ref": "#/components/schemas/PurchaseOrderShipTo"
          },
          "storeOrder": {
            "$ref": "#/components/schemas/StoreOrder"
          },
          "matching": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way"
            ]
          },
          "matchingDefault": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way"
            ]
          },
          "matchingChanges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderMatchingChange"
            }
          },
          "receiverEmployeeKey": {
            "type": "string"
          },
          "receiverName": {
            "type": "string"
          },
          "received": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderReceivedLine"
            }
          },
          "receivedPending": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderReceivedLine"
            }
          },
          "receiptState": {
            "type": "string",
            "enum": [
              "none",
              "partial",
              "full"
            ]
          },
          "receiptRequired": {
            "type": "boolean"
          },
          "readyToInvoice": {
            "type": "number",
            "format": "double"
          },
          "receiptTolerance": {
            "type": "object",
            "properties": {
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "PurchaseOrderPriorInvoiced": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "basis": {
            "type": "string",
            "enum": [
              "invoiced",
              "remaining"
            ]
          },
          "sourceSystem": {
            "type": "string",
            "enum": [
              "sap_ariba",
              "coupa",
              "oracle"
            ]
          },
          "importId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "importedAt": {
            "type": "string"
          },
          "importedBy": {
            "type": "string"
          }
        }
      },
      "PayerAccountRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "PurchaseOrderBillTo": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "custom",
              "company_profile"
            ]
          },
          "companyName": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/PostalAddress"
          },
          "addressText": {
            "type": "string"
          },
          "taxId": {
            "type": "string"
          }
        }
      },
      "PurchaseOrderCostCenterChange": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "at": {
            "type": "string"
          }
        }
      },
      "BudgetCheck": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "off",
              "within",
              "over",
              "no_budget",
              "no_rate"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "warn",
              "block"
            ]
          },
          "period": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "month",
                  "year",
                  "quarter"
                ]
              },
              "start": {
                "type": "string"
              },
              "end": {
                "type": "string"
              }
            }
          },
          "costCenter": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "budget": {
            "type": "number",
            "format": "double"
          },
          "committed": {
            "type": "number",
            "format": "double"
          },
          "actual": {
            "type": "number",
            "format": "double"
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "overBy": {
            "type": "number",
            "format": "double"
          },
          "checkedAt": {
            "type": "string"
          }
        }
      },
      "PurchaseOrderSupplierInvite": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "failed",
              "invited",
              "existing",
              "needs_permission"
            ]
          },
          "connectionId": {
            "type": "string"
          },
          "at": {
            "type": "string"
          }
        }
      },
      "PurchaseOrderQuoteDocument": {
        "type": "object",
        "properties": {
          "importId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "image/png",
              "image/jpeg"
            ]
          },
          "addedAt": {
            "type": "string"
          },
          "addedBy": {
            "type": "string"
          },
          "quoteNumber": {
            "type": "string"
          },
          "validUntil": {
            "type": "string"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "quote",
              "order_form",
              "proforma",
              "sow",
              "contract",
              "other"
            ]
          }
        }
      },
      "LineItem": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "lineType": {
            "type": "string",
            "enum": [
              "goods",
              "service"
            ]
          },
          "scopeType": {
            "type": "string",
            "enum": [
              "custom",
              "service",
              "sku",
              "account"
            ]
          },
          "scopeId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "ruleType": {
            "type": "string",
            "enum": [
              "amount",
              "quantity"
            ]
          },
          "unit": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "nteAmount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "paymentTerms": {
            "type": "string"
          },
          "validFrom": {
            "type": "string"
          },
          "validUntil": {
            "type": "string"
          },
          "dueDate": {
            "type": "string"
          },
          "consumed": {
            "type": "number",
            "format": "double"
          },
          "supplierSku": {
            "type": "string"
          },
          "priceSource": {
            "type": "string",
            "enum": [
              "list",
              "manual",
              "contract"
            ]
          },
          "customerLineNo": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "contractTermId": {
            "type": "string"
          },
          "quoteLineNo": {
            "type": "number",
            "format": "double"
          },
          "sowLineNo": {
            "type": "number",
            "format": "double"
          },
          "origin": {
            "$ref": "#/components/schemas/PunchoutLineOrigin"
          },
          "punchoutRef": {
            "type": "object",
            "properties": {
              "sessionId": {
                "type": "string"
              },
              "cartLineNo": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "ai": {
            "$ref": "#/components/schemas/AiLineScope"
          }
        }
      },
      "PunchoutLineOrigin": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "punchout"
            ]
          },
          "storeId": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "cartLineNo": {
            "type": "number",
            "format": "double"
          },
          "supplierPartId": {
            "type": "string"
          },
          "supplierPartAuxiliaryId": {
            "type": "string"
          },
          "manufacturerPartId": {
            "type": "string"
          },
          "manufacturerName": {
            "type": "string"
          },
          "classification": {
            "type": "object",
            "properties": {
              "domain": {
                "type": "string"
              },
              "code": {
                "type": "string"
              }
            }
          },
          "evidenceUnitPrice": {
            "type": "number",
            "format": "double"
          },
          "evidenceQuantity": {
            "type": "number",
            "format": "double"
          },
          "edited": {
            "type": "boolean"
          }
        }
      },
      "AiLineScope": {
        "type": "object",
        "properties": {
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "vendor": {
            "type": "string",
            "enum": [
              "unknown",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "snowflake",
              "databricks",
              "microsoft",
              "google",
              "meta",
              "amazon",
              "deepseek",
              "nvidia"
            ]
          },
          "model": {
            "type": "string"
          },
          "meter": {
            "type": "string",
            "enum": [
              "images",
              "other",
              "input_tokens",
              "output_tokens",
              "cached_input_tokens",
              "cache_write_tokens",
              "batch_input_tokens",
              "batch_output_tokens",
              "audio_seconds",
              "embeddings_tokens",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "model_units_hours",
              "cluster_hours",
              "seats",
              "prepaid_credit"
            ]
          },
          "region": {
            "type": "string"
          }
        }
      },
      "ApprovalChain": {
        "type": "object",
        "properties": {
          "requester": {
            "type": "string"
          },
          "requesterEmployeeKey": {
            "type": "string"
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStageGroupInstance"
            }
          },
          "groupIndex": {
            "type": "number",
            "format": "double"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalHistoryEntry"
            }
          },
          "autonomy": {
            "type": "boolean"
          },
          "routedAutomatically": {
            "type": "boolean"
          },
          "spendLimitGate": {
            "$ref": "#/components/schemas/SpendLimitGate"
          },
          "excludedEmployeeKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "selfApproved": {
            "type": "boolean"
          },
          "fx": {
            "$ref": "#/components/schemas/ApprovalFx"
          },
          "fromRequest": {
            "type": "object",
            "properties": {
              "requestId": {
                "type": "string"
              },
              "amount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              }
            }
          },
          "routing": {
            "$ref": "#/components/schemas/ApprovalRouting"
          }
        }
      },
      "ApprovalStageGroupInstance": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "parallel",
              "sequential"
            ]
          },
          "label": {
            "type": "string"
          },
          "stages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStageInstance"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "ApprovalStageInstance": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "approverEmployeeKey": {
            "type": "string"
          },
          "approverName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          },
          "selfApprovalBasis": {
            "type": "string",
            "enum": [
              "sole_eligible_approver"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "ApprovalHistoryEntry": {
        "type": "object",
        "properties": {
          "stage": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "actorSub": {
            "type": "string"
          },
          "at": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "approved",
              "rejected",
              "limit_exceeded",
              "reassigned",
              "skipped"
            ]
          },
          "detail": {
            "$ref": "#/components/schemas/SpendLimitHistoryDetail"
          },
          "reassignment": {
            "$ref": "#/components/schemas/ApprovalReassignmentDetail"
          },
          "skip": {
            "type": "object",
            "properties": {
              "rule": {
                "type": "string",
                "enum": [
                  "requester_in_parallel_group"
                ]
              },
              "stageLabel": {
                "type": "string"
              },
              "employeeKey": {
                "type": "string"
              }
            }
          },
          "selfApproval": {
            "$ref": "#/components/schemas/SelfApprovalRecord"
          }
        }
      },
      "SpendLimitHistoryDetail": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "limitCurrency": {
            "type": "string"
          },
          "exceeded": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpendLimitBreach"
            }
          },
          "appliedEmployeeKey": {
            "type": "string"
          },
          "approverEmployeeKey": {
            "type": "string"
          },
          "approverName": {
            "type": "string"
          },
          "mergedIntoExistingStage": {
            "type": "boolean"
          },
          "satisfiedByEmployeeKey": {
            "type": "string"
          },
          "satisfiedByName": {
            "type": "string"
          },
          "satisfiedAt": {
            "type": "string"
          },
          "satisfiedAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SpendLimitBreach": {
        "type": "object",
        "properties": {
          "employeeKey": {
            "type": "string"
          },
          "employeeName": {
            "type": "string"
          },
          "limitAmount": {
            "type": "number",
            "format": "double"
          },
          "limitCurrency": {
            "type": "string"
          },
          "fx": {
            "$ref": "#/components/schemas/ApprovalFx"
          },
          "subject": {
            "type": "string",
            "enum": [
              "requester",
              "actor"
            ]
          },
          "applied": {
            "type": "boolean"
          }
        }
      },
      "ApprovalFx": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "provider",
              "none",
              "override"
            ]
          },
          "asOf": {
            "type": "string"
          },
          "controlAmount": {
            "type": "number",
            "format": "double"
          },
          "supplierStated": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "rateSource": {
                "type": "string"
              },
              "rateDate": {
                "type": "string"
              }
            }
          }
        }
      },
      "ApprovalReassignmentDetail": {
        "type": "object",
        "properties": {
          "fromEmployeeKey": {
            "type": "string"
          },
          "fromName": {
            "type": "string"
          },
          "toEmployeeKey": {
            "type": "string"
          },
          "toName": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "onRebuild": {
            "type": "string",
            "enum": [
              "carried",
              "not-carried"
            ]
          },
          "byPolicy": {
            "type": "string",
            "enum": [
              "requester_rule"
            ]
          }
        }
      },
      "SelfApprovalRecord": {
        "type": "object",
        "properties": {
          "basis": {
            "type": "string",
            "enum": [
              "sole_eligible_approver"
            ]
          },
          "eligibleApproverCount": {
            "type": "number",
            "format": "double"
          },
          "evaluatedAt": {
            "type": "string"
          },
          "waivedExclusion": {
            "type": "string",
            "enum": [
              "entered this invoice",
              "over their own spend limit",
              "spend-limit review"
            ]
          }
        }
      },
      "SpendLimitGate": {
        "type": "object",
        "properties": {
          "employeeKey": {
            "type": "string"
          },
          "employeeName": {
            "type": "string"
          },
          "limitAmount": {
            "type": "number",
            "format": "double"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "limitCurrency": {
            "type": "string"
          },
          "fx": {
            "$ref": "#/components/schemas/ApprovalFx"
          },
          "approverEmployeeKey": {
            "type": "string"
          },
          "approverName": {
            "type": "string"
          },
          "mergedIntoExistingStage": {
            "type": "boolean"
          },
          "exceeded": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpendLimitBreach"
            }
          },
          "satisfiedByEmployeeKey": {
            "type": "string"
          },
          "satisfiedByName": {
            "type": "string"
          },
          "gatedAt": {
            "type": "string"
          },
          "satisfiedAt": {
            "type": "string"
          },
          "satisfiedAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ApprovalRouting": {
        "type": "object",
        "properties": {
          "budget": {
            "type": "object",
            "properties": {
              "outcome": {
                "type": "string",
                "enum": [
                  "off",
                  "within",
                  "over",
                  "no_budget",
                  "no_rate"
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "off",
                  "warn",
                  "block"
                ]
              },
              "costCenter": {
                "type": "string"
              },
              "period": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "month",
                      "year",
                      "quarter"
                    ]
                  },
                  "start": {
                    "type": "string"
                  },
                  "end": {
                    "type": "string"
                  }
                }
              },
              "currency": {
                "type": "string"
              },
              "overBy": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "spendLimit": {
            "type": "object",
            "properties": {
              "employeeKey": {
                "type": "string"
              },
              "employeeName": {
                "type": "string"
              },
              "approverName": {
                "type": "string"
              },
              "satisfied": {
                "type": "boolean"
              }
            }
          },
          "rule": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "index": {
                "type": "number",
                "format": "double"
              },
              "action": {
                "type": "string",
                "enum": [
                  "auto_approve",
                  "require_approval"
                ]
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "id"
            ]
          },
          "autonomy": {
            "type": "object",
            "properties": {
              "maxAutoApproveAmount": {
                "type": "number",
                "format": "double"
              },
              "applied": {
                "type": "boolean"
              }
            }
          },
          "touchlessSkipped": {
            "type": "string",
            "enum": [
              "human_only",
              "other_currency",
              "flagged_answer"
            ]
          },
          "flaggedAnswers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalRoutingStep"
            }
          }
        }
      },
      "ApprovalRoutingStep": {
        "type": "object",
        "properties": {
          "stepId": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "applied": {
            "type": "boolean"
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStepCondition"
            }
          },
          "highValueOnly": {
            "type": "boolean"
          }
        }
      },
      "PurchaseOrderChangeSummary": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "format": "double"
          },
          "at": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "amountFrom": {
            "type": "number",
            "format": "double"
          },
          "amountTo": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "linesAdded": {
            "type": "number",
            "format": "double"
          },
          "linesRemoved": {
            "type": "number",
            "format": "double"
          },
          "linesChanged": {
            "type": "number",
            "format": "double"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "approved",
              "draft",
              "reapproval"
            ]
          }
        }
      },
      "PurchaseOrderPunchout": {
        "type": "object",
        "properties": {
          "claimed": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "object",
              "properties": {
                "claimFloor": {
                  "type": "number",
                  "format": "double"
                },
                "claimedAt": {
                  "type": "string"
                },
                "operationAllowed": {
                  "type": "string",
                  "enum": [
                    "create",
                    "edit",
                    "inspect"
                  ]
                },
                "orderBy": {
                  "type": "string"
                },
                "exact": {
                  "type": "object",
                  "properties": {
                    "cartLines": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PurchaseOrderShipTo": {
        "type": "object",
        "properties": {
          "addressId": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "attention": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/PostalAddress"
          },
          "phone": {
            "type": "string"
          }
        }
      },
      "StoreOrder": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "failed",
              "manual",
              "refused",
              "expired",
              "queued",
              "sending",
              "retrying",
              "sent",
              "confirmed",
              "cancelled",
              "partial"
            ]
          },
          "payloadId": {
            "type": "string"
          },
          "attempts": {
            "type": "number",
            "format": "double"
          },
          "queuedAt": {
            "type": "string"
          },
          "lastAttemptAt": {
            "type": "string"
          },
          "nextAttemptAt": {
            "type": "string"
          },
          "sentAt": {
            "type": "string"
          },
          "refusal": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            }
          },
          "storeAnswer": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            }
          },
          "confirmation": {
            "$ref": "#/components/schemas/StoreOrderConfirmation"
          },
          "deadline": {
            "type": "string"
          },
          "queueSk": {
            "type": "string"
          }
        }
      },
      "StoreOrderConfirmation": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "partial"
            ]
          },
          "at": {
            "type": "string"
          },
          "storeConfirmationId": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineNo": {
                  "type": "number",
                  "format": "double"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "accept",
                    "reject",
                    "backordered",
                    "detail"
                  ]
                },
                "quantity": {
                  "type": "number",
                  "format": "double"
                },
                "reason": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PurchaseOrderMatchingChange": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way"
            ]
          },
          "to": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way"
            ]
          },
          "reason": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "at": {
            "type": "string"
          }
        }
      },
      "PurchaseOrderReceivedLine": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "PurchaseOrderSupplierView": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "paid",
              "pending_approval",
              "awaiting_fulfillment",
              "invoiced",
              "draft",
              "canceled",
              "closed",
              "expired"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "invoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoicedAmount": {
            "type": "number",
            "format": "double"
          },
          "rejectedInvoiceCount": {
            "type": "number",
            "format": "double"
          },
          "lastRejectedInvoiceId": {
            "type": "string"
          },
          "lastReplacedInvoiceId": {
            "type": "string"
          },
          "payerAccounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayerAccountRef"
            }
          },
          "billTo": {
            "type": "string"
          },
          "billToParty": {
            "$ref": "#/components/schemas/PurchaseOrderBillTo"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "supplierSite": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "supplierEmail": {
            "type": "object",
            "properties": {
              "to": {
                "type": "string"
              },
              "at": {
                "type": "string"
              }
            }
          },
          "mailboxToken": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "storeId": {
            "type": "string"
          },
          "deliveryAddressId": {
            "type": "string"
          },
          "shipTo": {
            "$ref": "#/components/schemas/PurchaseOrderShipTo"
          },
          "storeOrder": {
            "$ref": "#/components/schemas/StoreOrder"
          },
          "matching": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way"
            ]
          },
          "received": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderReceivedLine"
            }
          },
          "receivedPending": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderReceivedLine"
            }
          },
          "receiptState": {
            "type": "string",
            "enum": [
              "none",
              "partial",
              "full"
            ]
          },
          "receiptRequired": {
            "type": "boolean"
          },
          "readyToInvoice": {
            "type": "number",
            "format": "double"
          },
          "receiptTolerance": {
            "type": "object",
            "properties": {
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "approval": {
            "$ref": "#/components/schemas/SupplierApprovalView"
          },
          "priorInvoiced": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              },
              "basis": {
                "type": "string",
                "enum": [
                  "invoiced",
                  "remaining"
                ]
              },
              "sourceSystem": {
                "type": "string",
                "enum": [
                  "sap_ariba",
                  "coupa",
                  "oracle"
                ]
              },
              "importedAt": {
                "type": "string"
              }
            }
          },
          "quoteDocument": {
            "type": "object",
            "properties": {
              "documentType": {
                "type": "string",
                "enum": [
                  "invoice",
                  "quote",
                  "order_form",
                  "proforma",
                  "sow",
                  "contract",
                  "other"
                ]
              },
              "importId": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "contentType": {
                "type": "string",
                "enum": [
                  "application/pdf",
                  "image/png",
                  "image/jpeg"
                ]
              },
              "addedAt": {
                "type": "string"
              },
              "quoteNumber": {
                "type": "string"
              },
              "validUntil": {
                "type": "string"
              }
            }
          },
          "sowDocument": {
            "type": "object",
            "properties": {
              "documentType": {
                "type": "string",
                "enum": [
                  "invoice",
                  "quote",
                  "order_form",
                  "proforma",
                  "sow",
                  "contract",
                  "other"
                ]
              },
              "importId": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "contentType": {
                "type": "string",
                "enum": [
                  "application/pdf",
                  "image/png",
                  "image/jpeg"
                ]
              },
              "addedAt": {
                "type": "string"
              },
              "quoteNumber": {
                "type": "string"
              },
              "validUntil": {
                "type": "string"
              }
            }
          },
          "buyerWorkspaceId": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "SupplierApprovalView": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          }
        }
      },
      "InvoiceBuyerView": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "settlement": {
            "$ref": "#/components/schemas/InvoiceSettlement"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          },
          "usageAmountSimulated": {
            "type": "boolean"
          },
          "usageSimulatedAfterDisconnect": {
            "type": "boolean"
          },
          "usageCurrency": {
            "type": "string"
          },
          "usageSource": {
            "type": "string",
            "enum": [
              "aws_invoice",
              "billing_export",
              "mca_invoice",
              "ea_balance",
              "usage_api_closed_month",
              "osp_invoice",
              "focus_export",
              "cost_explorer_month"
            ]
          },
          "usageLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceUsageLine"
            }
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "unverifiedReason": {
            "type": "string",
            "enum": [
              "no_purchase_order",
              "no_billing_connection",
              "debit_note",
              "payer_account_unclear",
              "no_po_first_invoice",
              "no_usage_figure"
            ]
          },
          "matchBasis": {
            "type": "string",
            "enum": [
              "purchase_order",
              "no_po_history"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "receiptCheckSkipped": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "small_invoice"
                ]
              },
              "at": {
                "type": "string"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceControlFinding"
                }
              }
            }
          },
          "receiptToleranceApplied": {
            "type": "object",
            "properties": {
              "over": {
                "type": "number",
                "format": "double"
              },
              "received": {
                "type": "number",
                "format": "double"
              },
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poLineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "over": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "at": {
                "type": "string"
              }
            }
          },
          "matchType": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "discrepancyReason": {
            "type": "string",
            "enum": [
              "amount",
              "currency",
              "controls",
              "no_po_variance"
            ]
          },
          "controlFindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceControlFinding"
            }
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/InvoicePaymentRecord"
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRemittance"
            }
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentHistoryEntry"
            }
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/InvoicePaymentProblem"
          },
          "receiptConfirmationRemindedAt": {
            "type": "string"
          },
          "exportAvailableFrom": {
            "type": "string"
          },
          "previousExportedAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "cloudConnectionId": {
            "type": "string"
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "sodExcludedKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "feedPayloadHash": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "heldBack": {
            "$ref": "#/components/schemas/InvoiceHeldBack"
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "rateWarnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRateWarning"
            }
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "remittanceCheck": {
            "$ref": "#/components/schemas/RemittanceCheck"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/BankDetailsConfirmation"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "viewerIsSupplierMember": {
            "type": "boolean"
          },
          "nextApproverReminderAt": {
            "type": "string"
          },
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "InvoiceSettlement": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "stripe",
              "supplier_confirmed",
              "no_money_moved",
              "no_problem_reported",
              "buyer_marked"
            ]
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "undoUntil": {
            "type": "string"
          }
        }
      },
      "InvoiceLineItem": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "discount": {
            "type": "number",
            "format": "double"
          },
          "charge": {
            "type": "number",
            "format": "double"
          },
          "ai": {
            "type": "object",
            "properties": {
              "invoicer": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci",
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "openrouter",
                  "snowflake",
                  "databricks",
                  "coreweave",
                  "lambda",
                  "nebius",
                  "crusoe",
                  "cursor",
                  "github",
                  "microsoft",
                  "slack",
                  "zoom"
                ]
              },
              "vendor": {
                "type": "string",
                "enum": [
                  "unknown",
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "snowflake",
                  "databricks",
                  "microsoft",
                  "google",
                  "meta",
                  "amazon",
                  "deepseek",
                  "nvidia"
                ]
              },
              "model": {
                "type": "string"
              },
              "meter": {
                "type": "string",
                "enum": [
                  "images",
                  "other",
                  "input_tokens",
                  "output_tokens",
                  "cached_input_tokens",
                  "cache_write_tokens",
                  "batch_input_tokens",
                  "batch_output_tokens",
                  "audio_seconds",
                  "embeddings_tokens",
                  "requests",
                  "gpu_hours",
                  "ptu_hours",
                  "model_units_hours",
                  "cluster_hours",
                  "seats",
                  "prepaid_credit"
                ]
              },
              "region": {
                "type": "string"
              },
              "period": {
                "type": "string"
              }
            }
          }
        }
      },
      "InvoicePartyDetails": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "addressLines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "address": {
            "$ref": "#/components/schemas/PostalAddress"
          },
          "taxId": {
            "type": "string"
          },
          "taxIdLabel": {
            "type": "string"
          }
        }
      },
      "InvoiceUsageLine": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "NoPoComparison": {
        "type": "object",
        "properties": {
          "average": {
            "type": "number",
            "format": "double"
          },
          "invoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "differencePct": {
            "type": "number",
            "format": "double"
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "at": {
            "type": "string"
          }
        }
      },
      "InvoiceControlFinding": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "usage_grew",
              "po_balance_exceeded",
              "po_line_amount_exceeded",
              "po_line_qty_exceeded",
              "po_line_price_exceeded",
              "po_line_unassigned",
              "po_line_missing",
              "contract_rate_exceeded",
              "contract_max_unit_price_exceeded",
              "contract_outside_term",
              "contract_cap_exceeded",
              "contract_not_active",
              "contract_check_failed",
              "contract_rate_not_checked",
              "receipt_missing",
              "receipt_qty_exceeded",
              "receipt_amount_exceeded",
              "tier_price_exceeded",
              "contract_discount_missing",
              "fixed_discount_missing",
              "commitment_shortfall_overbilled",
              "contract_milestone_unknown",
              "contract_milestone_already_billed",
              "contract_milestone_exceeded",
              "contract_milestone_unconfirmed",
              "ai_rate_above_contract",
              "ai_rate_above_list",
              "ai_price_cut_not_applied",
              "ai_cache_discount_missing",
              "ai_batch_discount_missing",
              "ai_tokens_mismatch",
              "ai_capacity_underused",
              "ai_double_billed",
              "ai_commitment_exceeded",
              "ai_seats_above_active",
              "usage_billed_mismatch"
            ]
          },
          "message": {
            "type": "string"
          },
          "messageId": {
            "type": "string"
          },
          "params": {
            "$ref": "#/components/schemas/ServerMessageParams"
          },
          "invoiceLine": {
            "type": "number",
            "format": "double"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "contractId": {
            "type": "string"
          },
          "allowed": {
            "type": "number",
            "format": "double"
          },
          "billed": {
            "type": "number",
            "format": "double"
          },
          "contractVersion": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "InvoicePaymentRecord": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "stripe",
              "exported",
              "recorded"
            ]
          },
          "stripe": {
            "$ref": "#/components/schemas/InvoiceStripePayment"
          },
          "exportId": {
            "type": "string"
          },
          "exportedAt": {
            "type": "string"
          },
          "exportedBy": {
            "type": "string"
          },
          "exportedByName": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "other",
              "card",
              "ach",
              "wire",
              "check",
              "credit",
              "nothing_due"
            ]
          },
          "paymentDate": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "recordedAt": {
            "type": "string"
          },
          "recordedBy": {
            "type": "string"
          },
          "recordedByName": {
            "type": "string"
          },
          "adviceVersion": {
            "type": "number",
            "format": "double"
          },
          "paidAmount": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              },
              "rate": {
                "type": "number",
                "format": "double"
              },
              "rateDate": {
                "type": "string"
              }
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "earlyPaymentDiscount": {
            "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
          },
          "scheduledPaymentDate": {
            "type": "string"
          }
        }
      },
      "InvoiceStripePayment": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string"
          },
          "checkoutSessionId": {
            "type": "string"
          },
          "checkoutExpiresAt": {
            "type": "string"
          },
          "feeCents": {
            "type": "number",
            "format": "double"
          },
          "totalCents": {
            "type": "number",
            "format": "double"
          },
          "state": {
            "type": "string",
            "enum": [
              "checkout_open",
              "processing",
              "succeeded"
            ]
          },
          "paymentIntentId": {
            "type": "string"
          },
          "paymentMethodType": {
            "type": "string",
            "enum": [
              "card",
              "us_bank_account"
            ]
          },
          "startedAt": {
            "type": "string"
          },
          "startedBy": {
            "type": "string"
          },
          "startedByName": {
            "type": "string"
          },
          "succeededAt": {
            "type": "string"
          },
          "earlyPaymentDiscount": {
            "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
          },
          "initiatedDate": {
            "type": "string"
          }
        }
      },
      "EarlyPaymentDiscountTaken": {
        "type": "object",
        "properties": {
          "percent": {
            "type": "number",
            "format": "double"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "deadline": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "supplier_offer"
            ]
          }
        }
      },
      "InvoiceBreakdownEntry": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "rate": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "InvoiceRemittance": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "sentAt": {
            "type": "string"
          },
          "sentBy": {
            "type": "string"
          },
          "sentByName": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "file": {
            "type": "object",
            "properties": {
              "fileId": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "contentType": {
                "type": "string",
                "enum": [
                  "application/pdf",
                  "image/png",
                  "image/jpeg"
                ]
              },
              "sizeBytes": {
                "type": "number",
                "format": "double"
              }
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "PaymentHistoryEntry": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "exported",
              "recorded",
              "export_withdrawn",
              "record_withdrawn",
              "stripe_started",
              "stripe_released",
              "stripe_failed",
              "stripe_succeeded",
              "remittance_sent",
              "credit_applied",
              "credit_removed",
              "settled",
              "settlement_undone",
              "problem_reported",
              "problem_answered",
              "held_back_paid"
            ]
          },
          "at": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "bySupplier": {
            "type": "boolean"
          },
          "remittanceId": {
            "type": "string"
          },
          "creditNoteId": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "paymentDate": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "solePayer": {
            "$ref": "#/components/schemas/SolePayerWaiverRecord"
          },
          "approvedByOthers": {
            "$ref": "#/components/schemas/ApprovedByOthersRecord"
          },
          "record": {
            "type": "object",
            "properties": {
              "withholdings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                }
              },
              "method": {
                "type": "string",
                "enum": [
                  "other",
                  "card",
                  "ach",
                  "wire",
                  "check",
                  "credit",
                  "nothing_due"
                ]
              },
              "paymentDate": {
                "type": "string"
              },
              "reference": {
                "type": "string"
              },
              "recordedAt": {
                "type": "string"
              },
              "adviceVersion": {
                "type": "number",
                "format": "double"
              },
              "paidAmount": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "rate": {
                    "type": "number",
                    "format": "double"
                  },
                  "rateDate": {
                    "type": "string"
                  }
                }
              },
              "earlyPaymentDiscount": {
                "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
              }
            }
          }
        }
      },
      "SolePayerWaiverRecord": {
        "type": "object",
        "properties": {
          "accessRemoved": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAccessRemoval"
            }
          },
          "accessRemovedTotal": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "InvoiceAccessRemoval": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "role_changed",
              "removed"
            ]
          },
          "byKey": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "bySso": {
            "type": "boolean"
          },
          "targetKey": {
            "type": "string"
          },
          "targetName": {
            "type": "string"
          },
          "ssoMappingSaved": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "byKey": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              }
            }
          },
          "regained": {
            "$ref": "#/components/schemas/InvoiceAccessRegrant"
          }
        }
      },
      "InvoiceAccessRegrant": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "byKey": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "bySso": {
            "type": "boolean"
          }
        }
      },
      "ApprovedByOthersRecord": {
        "type": "object",
        "properties": {
          "approverKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "InvoicePaymentProblem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "not_received",
              "amount_differs"
            ]
          },
          "amountReceived": {
            "type": "number",
            "format": "double"
          },
          "note": {
            "type": "string"
          },
          "at": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "answer": {
            "type": "object",
            "properties": {
              "note": {
                "type": "string"
              },
              "at": {
                "type": "string"
              },
              "by": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              }
            }
          },
          "resolvedAt": {
            "type": "string"
          }
        }
      },
      "InvoiceEarlyPayment": {
        "type": "object",
        "properties": {
          "percent": {
            "type": "number",
            "format": "double"
          },
          "deadline": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "contract",
              "supplier_offer"
            ]
          },
          "contractId": {
            "type": "string"
          },
          "offeredBy": {
            "type": "object",
            "properties": {
              "sub": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "offeredAt": {
            "type": "string"
          },
          "standing": {
            "type": "boolean"
          }
        }
      },
      "InvoiceRejection": {
        "type": "object",
        "properties": {
          "reasonCode": {
            "type": "string",
            "enum": [
              "other",
              "amount_incorrect",
              "not_ordered_or_not_received",
              "duplicate",
              "missing_or_wrong_po",
              "wrong_billing_entity"
            ]
          },
          "reason": {
            "type": "string"
          },
          "at": {
            "type": "string"
          }
        }
      },
      "InvoiceDuplicateRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "EInvoiceSummary": {
        "type": "object",
        "properties": {
          "syntax": {
            "type": "string",
            "enum": [
              "ubl",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "profile": {
            "type": "string",
            "enum": [
              "fatturapa",
              "facturae",
              "nfe",
              "nfse",
              "other",
              "en16931",
              "peppol-bis-billing-3",
              "xrechnung",
              "xrechnung-extension",
              "factur-x-minimum",
              "factur-x-basic-wl",
              "factur-x-basic",
              "factur-x-extended"
            ]
          },
          "specificationId": {
            "type": "string"
          },
          "profileVersion": {
            "type": "string"
          },
          "ruleSets": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "en16931",
                "xrechnung"
              ]
            }
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "rule": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "fatal",
                    "warning"
                  ]
                },
                "position": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "findingsTruncated": {
            "type": "boolean"
          },
          "container": {
            "type": "string",
            "enum": [
              "pdf"
            ]
          },
          "embeddedFilename": {
            "type": "string"
          },
          "archive": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "sha256": {
                "type": "string"
              },
              "retainUntilYear": {
                "type": "number",
                "format": "double"
              }
            }
          }
        }
      },
      "InvoiceEInvoiceDetails": {
        "type": "object",
        "properties": {
          "lineVat": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EInvoiceVat"
            }
          },
          "adjustmentVat": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EInvoiceVat"
            }
          },
          "exemptionReason": {
            "type": "string"
          },
          "exemptionReasonCode": {
            "type": "string"
          },
          "buyerReference": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "updatedBy": {
            "type": "string"
          }
        }
      },
      "EInvoiceVat": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "enum": [
              "S",
              "Z",
              "E",
              "AE",
              "K",
              "G",
              "O",
              "L",
              "M"
            ]
          },
          "rate": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "InvoiceAdjustment": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "discount",
              "charge"
            ]
          },
          "description": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "InvoiceDeduction": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "credit",
              "prepayment"
            ]
          },
          "description": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "sourceInvoiceId": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "paidOn": {
            "type": "string"
          },
          "stated": {
            "type": "boolean"
          }
        }
      },
      "InvoiceCreditApplication": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "creditNoteId": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "appliedAt": {
            "type": "string"
          },
          "appliedBy": {
            "type": "string"
          },
          "appliedByName": {
            "type": "string"
          },
          "auto": {
            "type": "boolean"
          },
          "answersHold": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "InvoiceHeldBack": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "format": "double"
          },
          "net": {
            "type": "number",
            "format": "double"
          },
          "tax": {
            "type": "number",
            "format": "double"
          },
          "claimId": {
            "type": "string"
          },
          "decisionId": {
            "type": "string"
          },
          "at": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "paid",
              "carried",
              "open",
              "answered",
              "released"
            ]
          },
          "carriedBy": {
            "type": "string"
          },
          "underProtest": {
            "type": "boolean"
          },
          "paidLater": {
            "type": "object",
            "properties": {
              "paymentDate": {
                "type": "string"
              },
              "reference": {
                "type": "string"
              }
            }
          },
          "closedAt": {
            "type": "string"
          }
        }
      },
      "InvoiceCurrencyAmount": {
        "type": "object",
        "properties": {
          "currencyCode": {
            "type": "string"
          },
          "totalAmount": {
            "type": "number",
            "format": "double"
          },
          "totalAmountBeforeTax": {
            "type": "number",
            "format": "double"
          },
          "amountBreakdown": {
            "type": "object",
            "properties": {
              "subTotalAmount": {
                "type": "number",
                "format": "double"
              },
              "discounts": {
                "$ref": "#/components/schemas/InvoiceBreakdownGroup"
              },
              "fees": {
                "$ref": "#/components/schemas/InvoiceBreakdownGroup"
              },
              "taxes": {
                "$ref": "#/components/schemas/InvoiceBreakdownGroup"
              }
            }
          },
          "currencyExchangeDetails": {
            "$ref": "#/components/schemas/InvoiceCurrencyExchangeDetails"
          }
        }
      },
      "InvoiceBreakdownGroup": {
        "type": "object",
        "properties": {
          "totalAmount": {
            "type": "number",
            "format": "double"
          },
          "breakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          }
        }
      },
      "InvoiceCurrencyExchangeDetails": {
        "type": "object",
        "properties": {
          "sourceCurrencyCode": {
            "type": "string"
          },
          "targetCurrencyCode": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "format": "double"
          },
          "rateDate": {
            "type": "string"
          },
          "rateSource": {
            "type": "string"
          }
        }
      },
      "InvoiceRateWarning": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "payment",
              "tax"
            ]
          },
          "currency": {
            "type": "string"
          },
          "statedRate": {
            "type": "number",
            "format": "double"
          },
          "referenceRate": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "provider",
              "override"
            ]
          },
          "asOf": {
            "type": "string"
          },
          "deviationPct": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RemittanceInstructions": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "other",
              "ach",
              "wire",
              "check",
              "bank_transfer"
            ]
          },
          "payeeName": {
            "type": "string"
          },
          "bankName": {
            "type": "string"
          },
          "iban": {
            "type": "string"
          },
          "accountNumber": {
            "type": "string"
          },
          "bic": {
            "type": "string"
          },
          "routingNumber": {
            "type": "string"
          },
          "mailingAddress": {
            "type": "string"
          },
          "paymentReference": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "RemittanceCheck": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "first",
              "same",
              "changed"
            ]
          },
          "comparedInvoiceId": {
            "type": "string"
          },
          "comparedInvoiceNumber": {
            "type": "string"
          },
          "changedFields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "notes",
                "method",
                "payeeName",
                "iban",
                "accountNumber",
                "bic",
                "routingNumber",
                "mailingAddress"
              ]
            }
          }
        }
      },
      "BankDetailsConfirmation": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "disputed"
            ]
          },
          "requestedAt": {
            "type": "string"
          },
          "supplierCanConfirm": {
            "type": "boolean"
          },
          "confirmedVia": {
            "type": "string",
            "enum": [
              "supplier",
              "phone"
            ]
          },
          "confirmedAt": {
            "type": "string"
          },
          "confirmedBy": {
            "type": "object",
            "properties": {
              "sub": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "phone": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "other",
                  "callback",
                  "letter"
                ]
              },
              "contactName": {
                "type": "string"
              },
              "phoneNumber": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            }
          },
          "dispute": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "not_sent",
                  "wrong_bank_details"
                ]
              },
              "note": {
                "type": "string"
              },
              "at": {
                "type": "string"
              },
              "by": {
                "type": "object",
                "properties": {
                  "sub": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "InvoiceSourceDocument": {
        "type": "object",
        "properties": {
          "importId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "image/png",
              "image/jpeg"
            ]
          },
          "statedPoNumber": {
            "type": "string"
          }
        }
      },
      "InvoiceBaseCurrencyAmount": {
        "type": "object",
        "properties": {
          "currencyCode": {
            "type": "string"
          },
          "totalAmount": {
            "type": "number",
            "format": "double"
          },
          "totalAmountBeforeTax": {
            "type": "number",
            "format": "double"
          },
          "amountBreakdown": {
            "type": "object",
            "properties": {
              "subTotalAmount": {
                "type": "number",
                "format": "double"
              },
              "discounts": {
                "$ref": "#/components/schemas/InvoiceBreakdownGroup"
              },
              "fees": {
                "$ref": "#/components/schemas/InvoiceBreakdownGroup"
              },
              "taxes": {
                "$ref": "#/components/schemas/InvoiceBreakdownGroup"
              }
            }
          }
        }
      },
      "InvoiceReplacementCheck": {
        "type": "object",
        "properties": {
          "creditedInFull": {
            "type": "boolean"
          },
          "uncredited": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "UncreditedOriginal": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "uncredited": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          }
        }
      },
      "InvoiceSupplierView": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "canOfferEarlyPayment": {
            "type": "boolean"
          },
          "heldBack": {
            "$ref": "#/components/schemas/SupplierHeldBackView"
          },
          "settlement": {
            "$ref": "#/components/schemas/SupplierSettlementView"
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/SupplierPaymentProblemView"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/SupplierBankDetailsConfirmationView"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "approval": {
            "$ref": "#/components/schemas/SupplierApprovalView"
          },
          "payment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "withdrawnPayment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierRemittanceView"
            }
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "nextReminderAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "SupplierHeldBackView": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "state": {
            "type": "string",
            "enum": [
              "paid",
              "carried",
              "open",
              "answered",
              "released"
            ]
          },
          "carriedBy": {
            "type": "string"
          },
          "paidLater": {
            "type": "object",
            "properties": {
              "paymentDate": {
                "type": "string"
              },
              "reference": {
                "type": "string"
              }
            }
          },
          "closedAt": {
            "type": "string"
          },
          "held": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SupplierSettlementView": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "stripe",
              "supplier_confirmed",
              "no_money_moved",
              "no_problem_reported",
              "buyer_marked"
            ]
          },
          "undoUntil": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          }
        }
      },
      "SupplierPaymentProblemView": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "not_received",
              "amount_differs"
            ]
          },
          "amountReceived": {
            "type": "number",
            "format": "double"
          },
          "note": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "resolvedAt": {
            "type": "string"
          },
          "answer": {
            "type": "object",
            "properties": {
              "note": {
                "type": "string"
              },
              "at": {
                "type": "string"
              }
            }
          }
        }
      },
      "SupplierBankDetailsConfirmationView": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "disputed"
            ]
          },
          "requestedAt": {
            "type": "string"
          },
          "supplierCanConfirm": {
            "type": "boolean"
          },
          "confirmedVia": {
            "type": "string",
            "enum": [
              "supplier",
              "phone"
            ]
          },
          "confirmedAt": {
            "type": "string"
          },
          "confirmedByName": {
            "type": "string"
          },
          "dispute": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "not_sent",
                  "wrong_bank_details"
                ]
              },
              "note": {
                "type": "string"
              },
              "at": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              }
            }
          },
          "changedFields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "notes",
                "method",
                "payeeName",
                "iban",
                "accountNumber",
                "bic",
                "routingNumber",
                "mailingAddress"
              ]
            }
          }
        }
      },
      "SupplierRemittanceView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "sentAt": {
            "type": "string"
          },
          "file": {
            "type": "object",
            "properties": {
              "fileName": {
                "type": "string"
              },
              "contentType": {
                "type": "string",
                "enum": [
                  "application/pdf",
                  "image/png",
                  "image/jpeg"
                ]
              },
              "sizeBytes": {
                "type": "number",
                "format": "double"
              }
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "ExchangeRatesView": {
        "type": "object",
        "properties": {
          "workspaceCurrency": {
            "type": "string"
          },
          "warningPct": {
            "type": "number",
            "format": "double"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExchangeRateRow"
            }
          },
          "provider": {
            "type": "object",
            "properties": {
              "asOf": {
                "type": "string"
              },
              "fresh": {
                "type": "boolean"
              },
              "attribution": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "ExchangeRateRow": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "providerRate": {
            "type": "number",
            "format": "double"
          },
          "providerAsOf": {
            "type": "string"
          }
        }
      },
      "ReferenceRate": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "format": "double"
          },
          "date": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "attribution": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            }
          }
        }
      },
      "SupplierCreditNoteView": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "invoiceId": {
                  "type": "string"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "rejected",
                    "accepted",
                    "exported",
                    "removed",
                    "issued",
                    "applied",
                    "returned",
                    "voided"
                  ]
                },
                "exportId": {
                  "type": "string"
                }
              }
            }
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "CreditNoteApplication": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "appliedAt": {
            "type": "string"
          },
          "appliedBy": {
            "type": "string"
          },
          "appliedByName": {
            "type": "string"
          },
          "auto": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "FeedValidationResult": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "feedEnabled": {
            "type": "boolean"
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "invoice": {
            "type": "object",
            "properties": {
              "supplier": {
                "type": "string"
              },
              "buyerOrgId": {
                "type": "string"
              },
              "supplierOrgId": {
                "type": "string"
              },
              "cloudProvider": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci"
                ]
              },
              "lateFeeTerms": {
                "$ref": "#/components/schemas/LateFeeTerms"
              },
              "amount": {
                "type": "number",
                "format": "double"
              },
              "settlement": {
                "$ref": "#/components/schemas/SupplierSettlementView"
              },
              "approval": {
                "$ref": "#/components/schemas/SupplierApprovalView"
              },
              "supplierConnectionId": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "buyerOrgName": {
                "type": "string"
              },
              "buyerRegionName": {
                "type": "string"
              },
              "supplierRegionName": {
                "type": "string"
              },
              "contractId": {
                "type": "string"
              },
              "lineItems": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceLineItem"
                }
              },
              "po": {
                "type": "string"
              },
              "poLineNo": {
                "type": "number",
                "format": "double"
              },
              "billsNoPoLine": {
                "type": "boolean"
              },
              "partyDetails": {
                "type": "object",
                "properties": {
                  "supplier": {
                    "$ref": "#/components/schemas/InvoicePartyDetails"
                  },
                  "buyer": {
                    "$ref": "#/components/schemas/InvoicePartyDetails"
                  }
                }
              },
              "matchStatus": {
                "type": "string",
                "enum": [
                  "pending",
                  "matched",
                  "discrepancy",
                  "unverified"
                ]
              },
              "noPoComparison": {
                "$ref": "#/components/schemas/NoPoComparison"
              },
              "paymentRoute": {
                "type": "string",
                "enum": [
                  "pleaxy",
                  "erp"
                ]
              },
              "paid": {
                "type": "boolean"
              },
              "dueInDays": {
                "type": "number",
                "format": "double"
              },
              "dueDate": {
                "type": "string"
              },
              "paidAt": {
                "type": "string"
              },
              "payment": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "withholdings": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                        }
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "other",
                          "card",
                          "ach",
                          "wire",
                          "check",
                          "credit",
                          "nothing_due"
                        ]
                      },
                      "paymentDate": {
                        "type": "string"
                      },
                      "reference": {
                        "type": "string"
                      },
                      "recordedAt": {
                        "type": "string"
                      },
                      "adviceVersion": {
                        "type": "number",
                        "format": "double"
                      },
                      "paidAmount": {
                        "type": "object",
                        "properties": {
                          "amount": {
                            "type": "number",
                            "format": "double"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "number",
                            "format": "double"
                          },
                          "rateDate": {
                            "type": "string"
                          }
                        }
                      },
                      "earlyPaymentDiscount": {
                        "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "recorded"
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "stripe"
                        ]
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "processing",
                          "succeeded"
                        ]
                      },
                      "paymentMethodType": {
                        "type": "string",
                        "enum": [
                          "card",
                          "us_bank_account"
                        ]
                      },
                      "succeededAt": {
                        "type": "string"
                      },
                      "earlyPaymentDiscount": {
                        "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                      }
                    }
                  }
                ]
              },
              "remittances": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SupplierRemittanceView"
                }
              },
              "paymentProblem": {
                "$ref": "#/components/schemas/SupplierPaymentProblemView"
              },
              "dueDateSource": {
                "type": "string",
                "enum": [
                  "default",
                  "stated"
                ]
              },
              "earlyPayment": {
                "$ref": "#/components/schemas/InvoiceEarlyPayment"
              },
              "contractEarlyPayment": {
                "$ref": "#/components/schemas/InvoiceEarlyPayment"
              },
              "earlyPaymentCreditNoteId": {
                "type": "string"
              },
              "lastRemindedAt": {
                "type": "string"
              },
              "lastApproverRemindedAt": {
                "type": "string"
              },
              "rejection": {
                "$ref": "#/components/schemas/InvoiceRejection"
              },
              "replacesInvoiceId": {
                "type": "string"
              },
              "replacesInvoiceIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "replacedByInvoiceIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "possibleDuplicates": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceDuplicateRef"
                }
              },
              "duplicatesChecked": {
                "type": "boolean"
              },
              "hasLookupRows": {
                "type": "boolean"
              },
              "enteredBy": {
                "type": "string",
                "enum": [
                  "buyer",
                  "supplier"
                ]
              },
              "invoiceDate": {
                "type": "string"
              },
              "submittedFormat": {
                "type": "string",
                "enum": [
                  "json",
                  "ubl",
                  "cxml",
                  "cii",
                  "fatturapa",
                  "facturae",
                  "nfe",
                  "nfse"
                ]
              },
              "eInvoice": {
                "$ref": "#/components/schemas/EInvoiceSummary"
              },
              "eInvoiceDetails": {
                "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
              },
              "eInvoiceBuyerDownloadedAt": {
                "type": "string"
              },
              "issuedInBillingSoftware": {
                "type": "boolean"
              },
              "externalInvoiceNumber": {
                "type": "string"
              },
              "adjustments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceAdjustment"
                }
              },
              "taxAmount": {
                "type": "number",
                "format": "double"
              },
              "taxBreakdown": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                }
              },
              "withholdings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                }
              },
              "documentType": {
                "type": "string",
                "enum": [
                  "debit_note"
                ]
              },
              "amendsInvoiceId": {
                "type": "string"
              },
              "amendsExternalInvoiceNumber": {
                "type": "string"
              },
              "debitNoteIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "invoiceKind": {
                "type": "string",
                "enum": [
                  "prepayment"
                ]
              },
              "deductions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceDeduction"
                }
              },
              "creditApplications": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceCreditApplication"
                }
              },
              "heldBack": {
                "$ref": "#/components/schemas/SupplierHeldBackView"
              },
              "creditNoteIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "creditVersion": {
                "type": "number",
                "format": "double"
              },
              "paymentCurrencyAmount": {
                "$ref": "#/components/schemas/InvoiceCurrencyAmount"
              },
              "taxCurrencyAmount": {
                "$ref": "#/components/schemas/InvoiceCurrencyAmount"
              },
              "remittanceInstructions": {
                "$ref": "#/components/schemas/RemittanceInstructions"
              },
              "bankDetailsConfirmation": {
                "$ref": "#/components/schemas/SupplierBankDetailsConfirmationView"
              },
              "bankLane": {
                "type": "string"
              },
              "sourceDocument": {
                "$ref": "#/components/schemas/InvoiceSourceDocument"
              },
              "hasOriginalPdf": {
                "type": "boolean"
              },
              "canOfferEarlyPayment": {
                "type": "boolean"
              },
              "baseCurrencyAmount": {
                "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
              },
              "withdrawnPayment": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "withholdings": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                        }
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "other",
                          "card",
                          "ach",
                          "wire",
                          "check",
                          "credit",
                          "nothing_due"
                        ]
                      },
                      "paymentDate": {
                        "type": "string"
                      },
                      "reference": {
                        "type": "string"
                      },
                      "recordedAt": {
                        "type": "string"
                      },
                      "adviceVersion": {
                        "type": "number",
                        "format": "double"
                      },
                      "paidAmount": {
                        "type": "object",
                        "properties": {
                          "amount": {
                            "type": "number",
                            "format": "double"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "number",
                            "format": "double"
                          },
                          "rateDate": {
                            "type": "string"
                          }
                        }
                      },
                      "earlyPaymentDiscount": {
                        "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "recorded"
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "stripe"
                        ]
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "processing",
                          "succeeded"
                        ]
                      },
                      "paymentMethodType": {
                        "type": "string",
                        "enum": [
                          "card",
                          "us_bank_account"
                        ]
                      },
                      "succeededAt": {
                        "type": "string"
                      },
                      "earlyPaymentDiscount": {
                        "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                      }
                    }
                  }
                ]
              },
              "buyerWorkspaceId": {
                "type": "string"
              },
              "nextReminderAt": {
                "type": "string"
              }
            }
          },
          "matchStatusOnSubmit": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contractId": {
                  "type": "string"
                },
                "poLineNo": {
                  "type": "number",
                  "format": "double"
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "usage_grew",
                    "po_balance_exceeded",
                    "po_line_amount_exceeded",
                    "po_line_qty_exceeded",
                    "po_line_price_exceeded",
                    "po_line_unassigned",
                    "po_line_missing",
                    "contract_rate_exceeded",
                    "contract_max_unit_price_exceeded",
                    "contract_outside_term",
                    "contract_cap_exceeded",
                    "contract_not_active",
                    "contract_check_failed",
                    "contract_rate_not_checked",
                    "receipt_missing",
                    "receipt_qty_exceeded",
                    "receipt_amount_exceeded",
                    "tier_price_exceeded",
                    "contract_discount_missing",
                    "fixed_discount_missing",
                    "commitment_shortfall_overbilled",
                    "contract_milestone_unknown",
                    "contract_milestone_already_billed",
                    "contract_milestone_exceeded",
                    "contract_milestone_unconfirmed",
                    "ai_rate_above_contract",
                    "ai_rate_above_list",
                    "ai_price_cut_not_applied",
                    "ai_cache_discount_missing",
                    "ai_batch_discount_missing",
                    "ai_tokens_mismatch",
                    "ai_capacity_underused",
                    "ai_double_billed",
                    "ai_commitment_exceeded",
                    "ai_seats_above_active",
                    "usage_billed_mismatch"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "invoiceLine": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "replay": {
            "type": "object",
            "properties": {
              "invoiceId": {
                "type": "string"
              },
              "identical": {
                "type": "boolean"
              }
            },
            "nullable": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FeedValidationWarning"
            }
          }
        }
      },
      "FeedValidationWarning": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "FEED_NOT_ENABLED",
              "RATE_DIFFERS"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "CreditNoteHistoryEntry": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "exported",
              "removed",
              "issued",
              "applied",
              "returned",
              "voided"
            ]
          },
          "at": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "exportId": {
            "type": "string"
          }
        }
      },
      "InvoiceCounterparty": {
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "regionName": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "paymentCurrency": {
            "type": "string"
          },
          "openPurchaseOrders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "createdAt": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "invoicedAmount": {
                  "type": "number",
                  "format": "double"
                },
                "lines": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "lineNo": {
                        "type": "number",
                        "format": "double"
                      },
                      "name": {
                        "type": "string"
                      },
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "consumed": {
                        "type": "number",
                        "format": "double"
                      }
                    }
                  }
                },
                "defaultDueInDays": {
                  "type": "number",
                  "format": "double"
                },
                "defaultDueRule": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "enum": [
                            "end_of_month"
                          ]
                        },
                        "days": {
                          "type": "number",
                          "format": "double"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "enum": [
                            "next_month_day"
                          ]
                        },
                        "day": {
                          "type": "number",
                          "format": "double"
                        }
                      }
                    }
                  ]
                },
                "billToCompanyName": {
                  "type": "string"
                },
                "paidDeposits": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OpenPurchaseOrderDeposit"
                  }
                }
              },
              "required": [
                "id"
              ]
            }
          },
          "invoiceFeedEnabled": {
            "type": "boolean"
          },
          "invoiceFeedUpdatedAt": {
            "type": "string"
          },
          "feedReadiness": {
            "type": "string",
            "enum": [
              "not_connected",
              "off",
              "no_key",
              "untested",
              "tested",
              "live"
            ]
          },
          "feedAcceptedCount": {
            "type": "number",
            "format": "double"
          },
          "feedLastAcceptedAt": {
            "type": "string"
          },
          "feedLastValidAt": {
            "type": "string"
          },
          "feedValidCount": {
            "type": "number",
            "format": "double"
          },
          "approvedAt": {
            "type": "string"
          },
          "multipleConnections": {
            "type": "boolean"
          },
          "offPlatform": {
            "type": "boolean"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          }
        }
      },
      "OpenPurchaseOrderDeposit": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "owed": {
            "type": "number",
            "format": "double"
          },
          "available": {
            "type": "number",
            "format": "double"
          },
          "paidOn": {
            "type": "string"
          },
          "prepayment": {
            "type": "boolean"
          },
          "reference": {
            "type": "string"
          }
        }
      },
      "ReconciliationResult": {
        "type": "object",
        "properties": {
          "invoice_id": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "unverified",
              "disputed"
            ]
          },
          "unverified_reason": {
            "type": "string"
          },
          "resolved_by_person": {
            "type": "boolean"
          },
          "approval_status": {
            "type": "string"
          },
          "paid": {
            "type": "boolean"
          },
          "match_type": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "records": {
            "type": "object",
            "properties": {
              "order": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "line": {
                    "type": "number",
                    "format": "double"
                  }
                },
                "required": [
                  "id"
                ]
              },
              "price_agreement": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "versions": {
                    "type": "array",
                    "items": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                },
                "required": [
                  "id"
                ]
              },
              "usage": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "provider_invoice",
                      "provider_report"
                    ]
                  },
                  "amount": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "periods": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "invoice_line": {
                          "type": "number",
                          "format": "double"
                        },
                        "period": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "tolerance": {
            "type": "object",
            "properties": {
              "percent": {
                "type": "number",
                "format": "double"
              },
              "receipt": {
                "type": "object",
                "properties": {
                  "percent": {
                    "type": "number",
                    "format": "double"
                  },
                  "max_amount": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "checked": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "group": {
                  "type": "string",
                  "enum": [
                    "usage",
                    "order",
                    "receipt",
                    "agreement"
                  ]
                },
                "result": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "skipped",
                    "pass",
                    "fail",
                    "not_checked",
                    "no_failures_recorded"
                  ]
                }
              }
            }
          },
          "failures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReconciliationFailure"
            }
          },
          "primary_failure": {
            "type": "string",
            "enum": [
              "order_line_exists",
              "order_amount",
              "order_quantity",
              "order_price",
              "receipt_exists",
              "receipt_quantity",
              "receipt_amount",
              "agreement_active",
              "agreement_rate",
              "agreement_cap",
              "agreement_discount",
              "commitment_shortfall",
              "milestone_exists",
              "milestone_already_billed",
              "milestone_amount",
              "milestone_confirmed",
              "usage_match",
              "usage_currency"
            ]
          },
          "insights": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "invoice_line": {
                  "type": "number",
                  "format": "double"
                },
                "order_line": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          }
        }
      },
      "ReconciliationFailure": {
        "type": "object",
        "properties": {
          "check": {
            "type": "string",
            "enum": [
              "order_line_exists",
              "order_amount",
              "order_quantity",
              "order_price",
              "receipt_exists",
              "receipt_quantity",
              "receipt_amount",
              "agreement_active",
              "agreement_rate",
              "agreement_cap",
              "agreement_discount",
              "commitment_shortfall",
              "milestone_exists",
              "milestone_already_billed",
              "milestone_amount",
              "milestone_confirmed",
              "usage_match",
              "usage_currency"
            ]
          },
          "code": {
            "type": "string"
          },
          "invoice_line": {
            "type": "number",
            "format": "double"
          },
          "order_line": {
            "type": "number",
            "format": "double"
          },
          "agreement_id": {
            "type": "string"
          },
          "agreement_version": {
            "type": "number",
            "format": "double"
          },
          "allowed": {
            "type": "string"
          },
          "billed": {
            "type": "string"
          }
        }
      },
      "SupplierBankAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "supplierKey": {
            "type": "string"
          },
          "laneKey": {
            "type": "string"
          },
          "payeeName": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "details": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "status": {
            "type": "string",
            "enum": [
              "unverified",
              "verified",
              "changing"
            ]
          },
          "learnedFrom": {
            "type": "object",
            "properties": {
              "invoiceId": {
                "type": "string"
              },
              "side": {
                "type": "string",
                "enum": [
                  "buyer",
                  "supplier"
                ]
              }
            }
          },
          "approval": {
            "$ref": "#/components/schemas/SupplierBankAccountApproval"
          },
          "pendingChange": {
            "type": "object",
            "properties": {
              "details": {
                "$ref": "#/components/schemas/RemittanceInstructions"
              },
              "invoiceId": {
                "type": "string"
              },
              "side": {
                "type": "string",
                "enum": [
                  "buyer",
                  "supplier"
                ]
              },
              "at": {
                "type": "string"
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierBankAccountHistoryEntry"
            }
          },
          "reveals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "by": {
                  "type": "object",
                  "properties": {
                    "sub": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "SupplierBankAccountApproval": {
        "type": "object",
        "properties": {
          "verification": {
            "type": "string",
            "enum": [
              "supplier_confirmed",
              "buyer_approved",
              "paid_before"
            ]
          },
          "at": {
            "type": "string"
          },
          "by": {
            "type": "object",
            "properties": {
              "sub": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "side": {
                "type": "string",
                "enum": [
                  "buyer",
                  "supplier"
                ]
              }
            }
          },
          "check": {
            "$ref": "#/components/schemas/BankCheck"
          },
          "invoiceId": {
            "type": "string"
          }
        }
      },
      "BankCheck": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "bank_letter",
              "none",
              "other",
              "call",
              "email",
              "supplier_portal"
            ]
          },
          "detail": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "SupplierBankAccountHistoryEntry": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "event": {
            "type": "string",
            "enum": [
              "approved",
              "learned",
              "seeded",
              "change_proposed",
              "change_rejected"
            ]
          },
          "masked": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "verification": {
            "type": "string",
            "enum": [
              "supplier_confirmed",
              "buyer_approved",
              "paid_before"
            ]
          },
          "check": {
            "type": "string",
            "enum": [
              "bank_letter",
              "none",
              "other",
              "call",
              "email",
              "supplier_portal"
            ]
          }
        }
      },
      "ErrorParams": {
        "type": "object",
        "properties": {},
        "additionalProperties": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number",
              "format": "double"
            },
            {
              "type": "boolean"
            }
          ]
        }
      },
      "RemittanceView": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string"
          },
          "invoiceNumber": {
            "type": "string"
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "purchaseOrderId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "failed",
              "recorded",
              "processing",
              "unpaid",
              "paid_through_pleaxy",
              "withdrawn"
            ]
          },
          "failedAt": {
            "type": "string"
          },
          "paid": {
            "type": "boolean"
          },
          "paidAt": {
            "type": "string"
          },
          "amountDue": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              }
            }
          },
          "payment": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "other",
                  "stripe",
                  "card",
                  "ach",
                  "wire",
                  "check",
                  "credit",
                  "nothing_due"
                ]
              },
              "paymentDate": {
                "type": "string"
              },
              "reference": {
                "type": "string"
              },
              "recordedAt": {
                "type": "string"
              },
              "adviceVersion": {
                "type": "number",
                "format": "double"
              },
              "withheld": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                }
              },
              "earlyPaymentDiscount": {
                "type": "object",
                "properties": {
                  "percent": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              "netPaid": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              "paidInOtherCurrency": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "rate": {
                    "type": "number",
                    "format": "double"
                  },
                  "rateDate": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "remittances": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "sentAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                },
                "file": {
                  "type": "object",
                  "properties": {
                    "fileName": {
                      "type": "string"
                    },
                    "contentType": {
                      "type": "string",
                      "enum": [
                        "application/pdf",
                        "image/png",
                        "image/jpeg"
                      ]
                    },
                    "sizeBytes": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "required": [
                "id"
              ]
            }
          }
        }
      },
      "BankAccountView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "supplierKey": {
            "type": "string"
          },
          "laneKey": {
            "type": "string"
          },
          "payeeName": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "details": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "status": {
            "type": "string",
            "enum": [
              "unverified",
              "verified",
              "changing"
            ]
          },
          "learnedFrom": {
            "type": "object",
            "properties": {
              "invoiceId": {
                "type": "string"
              },
              "side": {
                "type": "string",
                "enum": [
                  "buyer",
                  "supplier"
                ]
              }
            }
          },
          "approval": {
            "$ref": "#/components/schemas/SupplierBankAccountApproval"
          },
          "pendingChange": {
            "type": "object",
            "properties": {
              "details": {
                "$ref": "#/components/schemas/RemittanceInstructions"
              },
              "invoiceId": {
                "type": "string"
              },
              "side": {
                "type": "string",
                "enum": [
                  "buyer",
                  "supplier"
                ]
              },
              "at": {
                "type": "string"
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierBankAccountHistoryEntry"
            }
          },
          "reveals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "by": {
                  "type": "object",
                  "properties": {
                    "sub": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "connectionId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "SupplierScreening": {
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string"
          },
          "supplierKey": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "clear",
              "possible_match",
              "confirmed_match",
              "not_screened"
            ]
          },
          "checkedAt": {
            "type": "string"
          },
          "listVersions": {
            "type": "object",
            "properties": {
              "eu": {
                "type": "string"
              },
              "uk": {
                "type": "string"
              },
              "ofac": {
                "type": "string"
              },
              "un": {
                "type": "string"
              }
            }
          },
          "subjects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScreenSubject"
            }
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScreeningMatch"
            }
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "event": {
                  "type": "string",
                  "enum": [
                    "closed",
                    "confirmed",
                    "dismissed",
                    "screened",
                    "reopened"
                  ]
                },
                "matchId": {
                  "type": "string"
                },
                "by": {
                  "type": "string"
                }
              }
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ScreenSubject": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "name",
              "former_name",
              "payee"
            ]
          },
          "name": {
            "type": "string"
          }
        }
      },
      "ScreeningMatch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entryId": {
            "type": "string"
          },
          "list": {
            "type": "string",
            "enum": [
              "eu",
              "uk",
              "ofac",
              "un",
              "jurisdiction"
            ]
          },
          "entryName": {
            "type": "string"
          },
          "matchedName": {
            "type": "string"
          },
          "subject": {
            "$ref": "#/components/schemas/ScreenSubject"
          },
          "score": {
            "type": "number",
            "format": "double"
          },
          "countryMismatch": {
            "type": "boolean"
          },
          "entry": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "other",
                  "entity",
                  "individual"
                ]
              },
              "names": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "countries": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "programmes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "identifiers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              },
              "listedOn": {
                "type": "string"
              }
            }
          },
          "listVersion": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "closed",
              "confirmed",
              "open",
              "dismissed"
            ]
          },
          "foundAt": {
            "type": "string"
          },
          "decidedAt": {
            "type": "string"
          },
          "decidedBy": {
            "type": "object",
            "properties": {
              "sub": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "reason": {
            "type": "string"
          },
          "closedReason": {
            "type": "string",
            "enum": [
              "entry_removed",
              "no_longer_matches"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "AiProvider": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom",
              "datadog",
              "twilio",
              "mongodb",
              "confluent",
              "vercel"
            ]
          },
          "accountLabel": {
            "type": "string"
          },
          "keyHint": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "pending"
            ]
          },
          "connectedAt": {
            "type": "string"
          },
          "connectedBy": {
            "type": "string"
          },
          "snowflake": {
            "type": "object",
            "properties": {
              "account": {
                "type": "string"
              },
              "user": {
                "type": "string"
              },
              "warehouse": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "publicKeyPem": {
                "type": "string"
              },
              "publicKeyFingerprint": {
                "type": "string"
              }
            }
          },
          "databricks": {
            "type": "object",
            "properties": {
              "host": {
                "type": "string"
              },
              "clientId": {
                "type": "string"
              },
              "warehouseId": {
                "type": "string"
              }
            }
          },
          "github": {
            "type": "object",
            "properties": {
              "org": {
                "type": "string"
              }
            }
          },
          "zoom": {
            "type": "object",
            "properties": {
              "accountId": {
                "type": "string"
              },
              "clientId": {
                "type": "string"
              }
            }
          },
          "datadog": {
            "type": "object",
            "properties": {
              "site": {
                "type": "string"
              }
            }
          },
          "twilio": {
            "type": "object",
            "properties": {
              "accountSid": {
                "type": "string"
              },
              "keySid": {
                "type": "string"
              }
            }
          },
          "mongodb": {
            "type": "object",
            "properties": {
              "orgId": {
                "type": "string"
              },
              "clientId": {
                "type": "string"
              }
            }
          },
          "confluent": {
            "type": "object",
            "properties": {
              "keyId": {
                "type": "string"
              }
            }
          },
          "vercel": {
            "type": "object",
            "properties": {
              "teamId": {
                "type": "string"
              }
            }
          },
          "creditPrice": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "on_demand",
                  "capacity",
                  "commit"
                ]
              }
            }
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "lastSyncedAt": {
            "type": "string"
          },
          "lastSyncStatus": {
            "type": "string",
            "enum": [
              "error",
              "ok",
              "throttled"
            ]
          },
          "lastSyncError": {
            "type": "string"
          },
          "lastSyncErrorCode": {
            "type": "string",
            "enum": [
              "throttled",
              "access_revoked",
              "platform_config",
              "data_not_enabled",
              "unknown"
            ]
          },
          "currency": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "BudgetControlSettings": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "warn",
              "block"
            ]
          },
          "period": {
            "type": "string",
            "enum": [
              "month",
              "year",
              "quarter"
            ]
          },
          "updatedAt": {
            "type": "string"
          },
          "updatedBy": {
            "type": "string"
          }
        }
      },
      "BudgetPeriod": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "month",
              "year",
              "quarter"
            ]
          },
          "start": {
            "type": "string"
          },
          "end": {
            "type": "string"
          },
          "fiscalYear": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "BudgetStatus": {
        "type": "object",
        "properties": {
          "costCenter": {
            "type": "string"
          },
          "costCenterName": {
            "type": "string"
          },
          "period": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "month",
                  "year",
                  "quarter"
                ]
              },
              "start": {
                "type": "string"
              },
              "end": {
                "type": "string"
              }
            }
          },
          "currency": {
            "type": "string"
          },
          "budget": {
            "type": "number",
            "format": "double"
          },
          "committed": {
            "type": "number",
            "format": "double"
          },
          "actual": {
            "type": "number",
            "format": "double"
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "pending": {
            "type": "number",
            "format": "double"
          },
          "unconverted": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SpendFigures": {
        "type": "object",
        "properties": {
          "committed": {
            "type": "number",
            "format": "double"
          },
          "actual": {
            "type": "number",
            "format": "double"
          },
          "pending": {
            "type": "number",
            "format": "double"
          },
          "unconverted": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "BuyerCreditNoteView": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "acceptedByName": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteHistoryEntry"
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "PurchaseOrderFulfillment": {
        "type": "object",
        "properties": {
          "confirmation": {
            "$ref": "#/components/schemas/OrderConfirmation"
          },
          "confirmations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderConfirmation"
            }
          },
          "shipNotices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipNotice"
            }
          },
          "shippedByLine": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineNo": {
                  "type": "number",
                  "format": "double"
                },
                "qty": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "expectedDeliveryDate": {
            "type": "string"
          }
        }
      },
      "OrderConfirmation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "poId": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "partial",
              "backordered",
              "changed"
            ]
          },
          "confirmId": {
            "type": "string"
          },
          "operation": {
            "type": "string",
            "enum": [
              "new",
              "update"
            ]
          },
          "deliveryDate": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderConfirmationLine"
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "cxml",
              "email",
              "portal",
              "api"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "decision": {
            "$ref": "#/components/schemas/OrderConfirmationDecision"
          }
        },
        "required": [
          "id"
        ]
      },
      "OrderConfirmationLine": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "status": {
            "type": "string",
            "enum": [
              "accept",
              "reject",
              "backordered",
              "change"
            ]
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "substitute": {
            "$ref": "#/components/schemas/OrderConfirmationSubstitute"
          },
          "shipmentDate": {
            "type": "string"
          },
          "deliveryDate": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "OrderConfirmationSubstitute": {
        "type": "object",
        "properties": {
          "supplierPartId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "catalogItemId": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "lineType": {
            "type": "string",
            "enum": [
              "goods",
              "service"
            ]
          }
        }
      },
      "OrderConfirmationDecision": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "applied",
              "declined"
            ]
          },
          "at": {
            "type": "string"
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "ShipNotice": {
        "type": "object",
        "properties": {
          "shipmentId": {
            "type": "string"
          },
          "poId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "canceled",
              "planned",
              "shipped"
            ]
          },
          "shipmentDate": {
            "type": "string"
          },
          "deliveryDate": {
            "type": "string"
          },
          "carrier": {
            "type": "string"
          },
          "trackingNumber": {
            "type": "string"
          },
          "trackingUrl": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipNoticeLine"
            }
          },
          "note": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "cxml",
              "email",
              "portal",
              "api"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "receipts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "receivedAt": {
                  "type": "string"
                }
              },
              "required": [
                "id"
              ]
            }
          }
        }
      },
      "ShipNoticeLine": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "qty": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SyncEventPage": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SyncEvent"
            }
          },
          "nextCursor": {
            "type": "string"
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "SyncEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "at": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "purchase_order.issued",
              "purchase_order.changed",
              "purchase_order.canceled",
              "purchase_order.rejected",
              "purchase_order.updated",
              "purchase_order.confirmed",
              "purchase_order.shipped",
              "invoice.received",
              "invoice.approved",
              "invoice.rejected",
              "invoice.paid",
              "invoice.payment_withdrawn",
              "invoice.payment",
              "invoice.remittance_sent",
              "invoice.credit_applied",
              "invoice.updated",
              "credit_note.received",
              "credit_note.accepted",
              "credit_note.rejected"
            ]
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "purchase_order",
              "credit_note"
            ]
          },
          "documentId": {
            "type": "string"
          },
          "buyerWorkspaceId": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "InvoiceStatusView": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string"
          },
          "invoiceNumber": {
            "type": "string"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ]
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "purchaseOrderId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "approved",
              "rejected",
              "received",
              "paid",
              "duplicate",
              "in_process",
              "under_query",
              "payment_in_progress"
            ]
          },
          "responseCode": {
            "type": "string",
            "enum": [
              "AB",
              "IP",
              "UQ",
              "AP",
              "RE",
              "PD"
            ]
          },
          "cxmlStatus": {
            "type": "string",
            "enum": [
              "rejected",
              "paid",
              "processing",
              "reconciled",
              "paying"
            ]
          },
          "queryReason": {
            "type": "string",
            "enum": [
              "discrepancy",
              "bank_details_unconfirmed",
              "bank_details_disputed"
            ]
          },
          "rejection": {
            "type": "object",
            "properties": {
              "reasonCode": {
                "type": "string",
                "enum": [
                  "other",
                  "amount_incorrect",
                  "not_ordered_or_not_received",
                  "duplicate",
                  "missing_or_wrong_po",
                  "wrong_billing_entity"
                ]
              },
              "reason": {
                "type": "string"
              },
              "at": {
                "type": "string"
              }
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "issueDate": {
            "type": "string"
          },
          "receivedAt": {
            "type": "string"
          },
          "dueDate": {
            "type": "string"
          },
          "total": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              }
            }
          },
          "amountDue": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string"
              }
            }
          },
          "paid": {
            "type": "boolean"
          },
          "paidAt": {
            "type": "string"
          }
        }
      },
      "WebhookEndpointView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "purchase_order.issued",
                "purchase_order.changed",
                "purchase_order.canceled",
                "purchase_order.rejected",
                "purchase_order.updated",
                "purchase_order.confirmed",
                "purchase_order.shipped",
                "invoice.received",
                "invoice.approved",
                "invoice.rejected",
                "invoice.paid",
                "invoice.payment_withdrawn",
                "invoice.payment",
                "invoice.remittance_sent",
                "invoice.credit_applied",
                "invoice.updated",
                "credit_note.received",
                "credit_note.accepted",
                "credit_note.rejected"
              ]
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "lastAttemptAt": {
            "type": "string"
          },
          "lastStatus": {
            "type": "number",
            "format": "double"
          },
          "lastErrorCode": {
            "type": "string",
            "enum": [
              "failed",
              "http_status",
              "blocked_address",
              "unreachable",
              "timeout",
              "redirect",
              "too_large",
              "endpoint_off"
            ]
          },
          "lastSuccessAt": {
            "type": "string"
          },
          "failedDeliveries": {
            "type": "number",
            "format": "double"
          },
          "secretHint": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string"
          },
          "endpointId": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "purchase_order.issued",
              "purchase_order.changed",
              "purchase_order.canceled",
              "purchase_order.rejected",
              "purchase_order.updated",
              "purchase_order.confirmed",
              "purchase_order.shipped",
              "invoice.received",
              "invoice.approved",
              "invoice.rejected",
              "invoice.paid",
              "invoice.payment_withdrawn",
              "invoice.payment",
              "invoice.remittance_sent",
              "invoice.credit_applied",
              "invoice.updated",
              "credit_note.received",
              "credit_note.accepted",
              "credit_note.rejected",
              "ping"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "failed",
              "delivered"
            ]
          },
          "attempts": {
            "type": "number",
            "format": "double"
          },
          "createdAt": {
            "type": "string"
          },
          "nextAttemptAt": {
            "type": "string"
          },
          "lastAttemptAt": {
            "type": "string"
          },
          "lastStatus": {
            "type": "number",
            "format": "double"
          },
          "lastErrorCode": {
            "type": "string",
            "enum": [
              "failed",
              "http_status",
              "blocked_address",
              "unreachable",
              "timeout",
              "redirect",
              "too_large",
              "endpoint_off"
            ]
          },
          "deliveredAt": {
            "type": "string"
          }
        }
      },
      "PurchaseRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "requesterEmployeeKey": {
            "type": "string"
          },
          "requesterName": {
            "type": "string"
          },
          "costCenter": {
            "type": "string"
          },
          "glCode": {
            "type": "string"
          },
          "supplier": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "supplierConnectionId": {
                "type": "string"
              },
              "supplierRegionId": {
                "type": "string"
              }
            }
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseRequestLine"
            }
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "neededBy": {
            "type": "string"
          },
          "quoteDocument": {
            "$ref": "#/components/schemas/PurchaseOrderQuoteDocument"
          },
          "notes": {
            "type": "string"
          },
          "requestType": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "number",
                "format": "double"
              }
            },
            "required": [
              "id"
            ]
          },
          "formFields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionnaireFieldDef"
            }
          },
          "answers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAnswer"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "approved",
              "rejected",
              "sourcing",
              "pending_approval",
              "draft",
              "canceled",
              "ordered"
            ]
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "budgetCheck": {
            "$ref": "#/components/schemas/BudgetCheck"
          },
          "poId": {
            "type": "string"
          },
          "poIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sourcingEventId": {
            "type": "string"
          },
          "rejectionReason": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "submittedAt": {
            "type": "string"
          },
          "decidedAt": {
            "type": "string"
          },
          "canceledAt": {
            "type": "string"
          },
          "canceledBy": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "PurchaseRequestLine": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "lineType": {
            "type": "string",
            "enum": [
              "goods",
              "service"
            ]
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unit": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RequestAnswer": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string"
          },
          "textAnswer": {
            "type": "string"
          },
          "selectedOptionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "file": {
            "$ref": "#/components/schemas/QuestionnaireFileAnswer"
          },
          "flagged": {
            "type": "boolean"
          }
        }
      },
      "ApprovalQueue": {
        "type": "object",
        "properties": {
          "purchaseOrders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrder"
            }
          },
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBuyerView"
            }
          },
          "serviceEntrySheets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ServiceEntrySheetQueueItem"
            }
          },
          "needsAssignment": {
            "type": "object",
            "properties": {
              "purchaseOrders": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              },
              "invoices": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          },
          "decided": {
            "type": "object",
            "properties": {
              "purchaseOrders": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              },
              "invoices": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                }
              }
            }
          }
        }
      },
      "ServiceEntrySheetQueueItem": {
        "type": "object",
        "properties": {
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          },
          "supplier": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "releases": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "invoiceNumber": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "currency": {
                  "type": "string"
                }
              },
              "required": [
                "id"
              ]
            }
          }
        }
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "poId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "service_entry_sheet",
              "goods_receipt"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "approved",
              "rejected",
              "pending_approval",
              "reversed"
            ]
          },
          "receivedAt": {
            "type": "string"
          },
          "periodFrom": {
            "type": "string"
          },
          "periodTo": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptLine"
            }
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "shipmentId": {
            "type": "string"
          },
          "attachment": {
            "$ref": "#/components/schemas/ReceiptAttachment"
          },
          "source": {
            "type": "string",
            "enum": [
              "supplier",
              "api",
              "app",
              "assistant",
              "import"
            ]
          },
          "createdBy": {
            "type": "string"
          },
          "createdByName": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "approvedBy": {
            "type": "string"
          },
          "approvedByName": {
            "type": "string"
          },
          "approvedAt": {
            "type": "string"
          },
          "reversal": {
            "type": "object",
            "properties": {
              "by": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              },
              "at": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "rejection": {
            "type": "object",
            "properties": {
              "by": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              },
              "at": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptReturn"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "ReceiptLine": {
        "type": "object",
        "properties": {
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ReceiptAttachment": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "image/png",
              "image/jpeg"
            ]
          },
          "sizeBytes": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ReceiptReturn": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptLine"
            }
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "returnedAt": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "want": {
            "type": "string",
            "enum": [
              "none",
              "credit_note",
              "replacement"
            ]
          },
          "attachment": {
            "$ref": "#/components/schemas/ReceiptAttachment"
          },
          "by": {
            "type": "string"
          },
          "byName": {
            "type": "string"
          },
          "at": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "AiSpendResponse": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string"
          },
          "asOf": {
            "type": "string"
          },
          "totals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSpendTotal"
            }
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSpendGroup"
            }
          },
          "unattributed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSpendUnattributed"
            }
          },
          "notReadable": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoicerId": {
                  "type": "string"
                },
                "invoicer": {
                  "type": "string",
                  "enum": [
                    "aws",
                    "gcp",
                    "azure",
                    "oci",
                    "openai",
                    "anthropic",
                    "mistral",
                    "cohere",
                    "xai",
                    "openrouter",
                    "snowflake",
                    "databricks",
                    "coreweave",
                    "lambda",
                    "nebius",
                    "crusoe",
                    "cursor",
                    "github",
                    "microsoft",
                    "slack",
                    "zoom"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "needs_current_cost",
                    "not_synced_yet"
                  ]
                }
              }
            }
          }
        }
      },
      "AiSpendTotal": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "monthToDate": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "type": "number",
            "format": "double"
          },
          "lastMonth": {
            "type": "number",
            "format": "double"
          },
          "changePct": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiSpendGroup": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "invoicerId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "monthToDate": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "type": "number",
            "format": "double"
          },
          "lastMonth": {
            "type": "number",
            "format": "double"
          },
          "changePct": {
            "type": "number",
            "format": "double"
          },
          "quantities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiMeterQuantity"
            }
          },
          "purchaseOrders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiPurchaseOrderLineRemaining"
            }
          },
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiServiceFigure"
            }
          }
        }
      },
      "AiMeterQuantity": {
        "type": "object",
        "properties": {
          "meter": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiPurchaseOrderLineRemaining": {
        "type": "object",
        "properties": {
          "poId": {
            "type": "string"
          },
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "remaining": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiServiceFigure": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "monthToDate": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "type": "number",
            "format": "double"
          },
          "lastMonth": {
            "type": "number",
            "format": "double"
          },
          "changePct": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiSpendUnattributed": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "monthToDate": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "type": "number",
            "format": "double"
          },
          "lastMonth": {
            "type": "number",
            "format": "double"
          },
          "changePct": {
            "type": "number",
            "format": "double"
          },
          "quantities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiMeterQuantity"
            }
          }
        }
      },
      "AiUsageLinesPage": {
        "type": "object",
        "properties": {
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiUsageLine"
            }
          },
          "nextCursor": {
            "type": "string"
          }
        }
      },
      "AiUsageLine": {
        "type": "object",
        "properties": {
          "invoicerId": {
            "type": "string"
          },
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "vendor": {
            "type": "string",
            "enum": [
              "unknown",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "snowflake",
              "databricks",
              "microsoft",
              "google",
              "meta",
              "amazon",
              "deepseek",
              "nvidia"
            ]
          },
          "model": {
            "type": "string"
          },
          "shape": {
            "type": "string",
            "enum": [
              "seats",
              "capacity",
              "tokens",
              "credits"
            ]
          },
          "meter": {
            "type": "string",
            "enum": [
              "images",
              "other",
              "input_tokens",
              "output_tokens",
              "cached_input_tokens",
              "cache_write_tokens",
              "batch_input_tokens",
              "batch_output_tokens",
              "audio_seconds",
              "embeddings_tokens",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "model_units_hours",
              "cluster_hours",
              "seats"
            ]
          },
          "region": {
            "type": "string"
          },
          "day": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "double"
          },
          "unit": {
            "type": "string",
            "enum": [
              "images",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "tokens",
              "1M_tokens",
              "seconds",
              "model_unit_hours",
              "units",
              "seat_months"
            ]
          },
          "credits": {
            "type": "object",
            "properties": {
              "quantity": {
                "type": "number",
                "format": "double"
              },
              "unit": {
                "type": "string",
                "enum": [
                  "credits",
                  "dbu"
                ]
              },
              "unitPrice": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "attribution": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "string"
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "billing_export",
              "cost_explorer",
              "cost_management",
              "usage_api",
              "cost_report",
              "usage_report",
              "focus"
            ]
          },
          "rawService": {
            "type": "string"
          },
          "rawUsageType": {
            "type": "string"
          }
        }
      },
      "AiSpendCheckResponse": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "over",
              "no_budget",
              "no_po",
              "fits"
            ]
          },
          "period": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "monthToDate": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "type": "number",
            "format": "double"
          },
          "purchaseOrders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSpendCheckPurchaseOrderLine"
            }
          },
          "budget": {
            "$ref": "#/components/schemas/AiSpendCheckBudget"
          }
        }
      },
      "AiSpendCheckPurchaseOrderLine": {
        "type": "object",
        "properties": {
          "poId": {
            "type": "string"
          },
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "overBy": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiSpendCheckBudget": {
        "type": "object",
        "properties": {
          "costCenter": {
            "type": "string"
          },
          "budget": {
            "type": "number",
            "format": "double"
          },
          "committed": {
            "type": "number",
            "format": "double"
          },
          "actual": {
            "type": "number",
            "format": "double"
          },
          "accruing": {
            "type": "number",
            "format": "double"
          },
          "remaining": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiRateCardEntry": {
        "type": "object",
        "properties": {
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "vendor": {
            "type": "string",
            "enum": [
              "unknown",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "snowflake",
              "databricks",
              "microsoft",
              "google",
              "meta",
              "amazon",
              "deepseek",
              "nvidia"
            ]
          },
          "model": {
            "type": "string"
          },
          "meter": {
            "type": "string",
            "enum": [
              "images",
              "other",
              "input_tokens",
              "output_tokens",
              "cached_input_tokens",
              "cache_write_tokens",
              "batch_input_tokens",
              "batch_output_tokens",
              "audio_seconds",
              "embeddings_tokens",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "model_units_hours",
              "cluster_hours",
              "seats"
            ]
          },
          "region": {
            "type": "string"
          },
          "unit": {
            "type": "string",
            "enum": [
              "images",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "tokens",
              "1M_tokens",
              "seconds",
              "model_unit_hours",
              "units",
              "seat_months"
            ]
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "effectiveFrom": {
            "type": "string"
          },
          "effectiveTo": {
            "type": "string"
          },
          "sourceUrl": {
            "type": "string"
          }
        }
      },
      "AiPoLineSuggestions": {
        "type": "object",
        "properties": {
          "invoicerId": {
            "type": "string"
          },
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "period": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiPoLineSuggestion"
            }
          }
        }
      },
      "AiPoLineSuggestion": {
        "type": "object",
        "properties": {
          "ai": {
            "type": "object",
            "properties": {
              "invoicer": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci",
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "openrouter",
                  "snowflake",
                  "databricks",
                  "coreweave",
                  "lambda",
                  "nebius",
                  "crusoe",
                  "cursor",
                  "github",
                  "microsoft",
                  "slack",
                  "zoom"
                ]
              },
              "vendor": {
                "type": "string",
                "enum": [
                  "unknown",
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "snowflake",
                  "databricks",
                  "microsoft",
                  "google",
                  "meta",
                  "amazon",
                  "deepseek",
                  "nvidia"
                ]
              },
              "model": {
                "type": "string"
              },
              "meter": {
                "type": "string",
                "enum": [
                  "images",
                  "other",
                  "input_tokens",
                  "output_tokens",
                  "cached_input_tokens",
                  "cache_write_tokens",
                  "batch_input_tokens",
                  "batch_output_tokens",
                  "audio_seconds",
                  "embeddings_tokens",
                  "requests",
                  "gpu_hours",
                  "ptu_hours",
                  "model_units_hours",
                  "cluster_hours",
                  "seats"
                ]
              },
              "region": {
                "type": "string"
              }
            }
          },
          "unit": {
            "type": "string",
            "enum": [
              "images",
              "requests",
              "gpu_hours",
              "ptu_hours",
              "tokens",
              "1M_tokens",
              "seconds",
              "model_unit_hours",
              "units",
              "seat_months"
            ]
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "priceSource": {
            "type": "string",
            "enum": [
              "list",
              "contract",
              "billed"
            ]
          },
          "contractId": {
            "type": "string"
          },
          "contractTermId": {
            "type": "string"
          },
          "periodQuantity": {
            "type": "number",
            "format": "double"
          },
          "periodAmount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiRecommendations": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string"
          },
          "basisPeriod": {
            "type": "string"
          },
          "uncovered": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiUncoveredSpend"
            }
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiUncoveredSpend"
            }
          },
          "savings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSavingRecommendation"
            }
          }
        }
      },
      "AiUncoveredSpend": {
        "type": "object",
        "properties": {
          "invoicerId": {
            "type": "string"
          },
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "label": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "monthToDate": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "type": "number",
            "format": "double"
          },
          "covered": {
            "type": "number",
            "format": "double"
          },
          "gap": {
            "type": "number",
            "format": "double"
          },
          "reason": {
            "type": "string",
            "enum": [
              "no_po",
              "over_po"
            ]
          },
          "poIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "draftPoIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pendingPoIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AiSavingRecommendation": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "batch",
              "cache",
              "reserve"
            ]
          },
          "invoicerId": {
            "type": "string"
          },
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "label": {
            "type": "string"
          },
          "vendor": {
            "type": "string",
            "enum": [
              "unknown",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "snowflake",
              "databricks",
              "microsoft",
              "google",
              "meta",
              "amazon",
              "deepseek",
              "nvidia"
            ]
          },
          "model": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "spend": {
            "type": "number",
            "format": "double"
          },
          "saving": {
            "type": "number",
            "format": "double"
          },
          "detail": {
            "type": "object",
            "properties": {
              "interactiveRate": {
                "type": "number",
                "format": "double"
              },
              "batchRate": {
                "type": "number",
                "format": "double"
              },
              "inputRate": {
                "type": "number",
                "format": "double"
              },
              "cachedRate": {
                "type": "number",
                "format": "double"
              },
              "cachedShare": {
                "type": "number",
                "format": "double"
              },
              "daysUsed": {
                "type": "number",
                "format": "double"
              },
              "steadyHoursPerDay": {
                "type": "number",
                "format": "double"
              },
              "reservableUnits": {
                "type": "number",
                "format": "double"
              }
            }
          }
        }
      },
      "AiDraftOrdersResult": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "account",
              "ai"
            ]
          },
          "drafts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoicerId": {
                  "type": "string"
                },
                "poId": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "total": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "skipped": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoicerId": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "no_usage",
                    "no_supplier",
                    "no_forecast",
                    "already_drafted"
                  ]
                },
                "poId": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "messageId": {
                  "type": "string"
                },
                "params": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "AiCommitmentView": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "seats",
              "prepaid_credit",
              "capacity",
              "spend"
            ]
          },
          "contractId": {
            "type": "string"
          },
          "contractTitle": {
            "type": "string"
          },
          "termId": {
            "type": "string"
          },
          "poId": {
            "type": "string"
          },
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "supplier": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "ai": {
            "type": "object",
            "properties": {
              "invoicer": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci",
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "openrouter",
                  "snowflake",
                  "databricks",
                  "coreweave",
                  "lambda",
                  "nebius",
                  "crusoe",
                  "cursor",
                  "github",
                  "microsoft",
                  "slack",
                  "zoom"
                ]
              },
              "vendor": {
                "type": "string",
                "enum": [
                  "unknown",
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "snowflake",
                  "databricks",
                  "microsoft",
                  "google",
                  "meta",
                  "amazon",
                  "deepseek",
                  "nvidia"
                ]
              },
              "model": {
                "type": "string"
              },
              "meter": {
                "type": "string"
              }
            }
          },
          "currency": {
            "type": "string"
          },
          "termStart": {
            "type": "string"
          },
          "termEnd": {
            "type": "string"
          },
          "committed": {
            "type": "number",
            "format": "double"
          },
          "used": {
            "type": "number",
            "format": "double"
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "usedPct": {
            "type": "number",
            "format": "double"
          },
          "projected": {
            "type": "number",
            "format": "double"
          },
          "unit": {
            "type": "string"
          }
        }
      },
      "AiRenewalRule": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "dayOfMonth": {
            "type": "number",
            "format": "double"
          },
          "ownerSub": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "draftedFor": {
            "type": "string"
          },
          "lastRun": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "period": {
                "type": "string"
              },
              "drafts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poId": {
                      "type": "string"
                    },
                    "draftId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "draftUncovered": {
            "type": "boolean"
          },
          "uncoveredCheckedOn": {
            "type": "string"
          },
          "uncoveredDrafted": {
            "type": "object",
            "properties": {
              "period": {
                "type": "string"
              },
              "invoicerIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "lastUncoveredRun": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "period": {
                "type": "string"
              },
              "drafts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "invoicerId": {
                      "type": "string"
                    },
                    "poId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "AiAttributionResponse": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string"
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiAttributionRuleView"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "updatedAt": {
            "type": "string"
          },
          "unattributed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "unmatchedValues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoicerId": {
                  "type": "string"
                },
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          }
        }
      },
      "AiAttributionRuleView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "invoicerId": {
            "type": "string"
          },
          "dimension": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "costCenter": {
            "type": "string"
          },
          "matched": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "AiCostCentersResponse": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string"
          },
          "budgetMode": {
            "type": "string"
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiCostCenterRow"
            }
          },
          "unattributed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "monthToDate": {
                  "type": "number",
                  "format": "double"
                },
                "forecast": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "thresholds": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            }
          }
        }
      },
      "AiCostCenterRow": {
        "type": "object",
        "properties": {
          "costCenter": {
            "type": "string"
          },
          "costCenterName": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "budget": {
            "type": "number",
            "format": "double"
          },
          "committed": {
            "type": "number",
            "format": "double"
          },
          "actual": {
            "type": "number",
            "format": "double"
          },
          "accruing": {
            "type": "number",
            "format": "double"
          },
          "forecast": {
            "type": "number",
            "format": "double"
          },
          "pctWithForecast": {
            "type": "number",
            "format": "double"
          },
          "alert": {
            "type": "object",
            "properties": {
              "threshold": {
                "type": "number",
                "format": "double"
              },
              "sentAt": {
                "type": "string"
              }
            }
          }
        }
      },
      "AiSeatCount": {
        "type": "object",
        "properties": {
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci",
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom"
            ]
          },
          "product": {
            "type": "string"
          },
          "period": {
            "type": "string"
          },
          "activeUsers": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "okta",
              "entra",
              "google_workspace",
              "jumpcloud",
              "provider_console"
            ]
          },
          "recordedAt": {
            "type": "string"
          },
          "recordedBy": {
            "type": "string"
          }
        }
      },
      "FocusExportList": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "exports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FocusExportSummary"
            }
          }
        }
      },
      "FocusExportSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "enum": [
              "1.2",
              "1.4"
            ]
          },
          "include": {
            "type": "string",
            "enum": [
              "all",
              "non_cloud"
            ]
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "parquet"
            ]
          },
          "rowCount": {
            "type": "number",
            "format": "double"
          },
          "documentCount": {
            "type": "number",
            "format": "double"
          },
          "expiresAt": {
            "type": "string"
          },
          "commitmentCount": {
            "type": "number",
            "format": "double"
          }
        },
        "required": [
          "id"
        ]
      },
      "FocusExport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "enum": [
              "1.2",
              "1.4"
            ]
          },
          "include": {
            "type": "string",
            "enum": [
              "all",
              "non_cloud"
            ]
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "parquet"
            ]
          },
          "rowCount": {
            "type": "number",
            "format": "double"
          },
          "documentCount": {
            "type": "number",
            "format": "double"
          },
          "expiresAt": {
            "type": "string"
          },
          "commitmentCount": {
            "type": "number",
            "format": "double"
          },
          "downloadUrl": {
            "type": "string"
          },
          "metadataUrl": {
            "type": "string"
          },
          "commitmentsUrl": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "FocusSourceView": {
        "type": "object",
        "properties": {
          "s3": {
            "type": "object",
            "properties": {
              "endpoint": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "bucket": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "accessKeyId": {
                "type": "string"
              },
              "keyHint": {
                "type": "string"
              }
            }
          },
          "aws": {
            "type": "object",
            "properties": {
              "bucket": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "region": {
                "type": "string"
              }
            }
          },
          "gcp": {
            "type": "object",
            "properties": {
              "table": {
                "type": "string"
              }
            }
          },
          "azure": {
            "type": "object",
            "properties": {
              "storageAccount": {
                "type": "string"
              },
              "container": {
                "type": "string"
              },
              "directory": {
                "type": "string"
              }
            }
          },
          "oci": {
            "type": "object",
            "properties": {
              "region": {
                "type": "string"
              }
            }
          },
          "provider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "oci",
              "upload",
              "aws_s3",
              "azure_blob",
              "gcp_bigquery",
              "s3_compatible"
            ]
          },
          "label": {
            "type": "string"
          },
          "connectionId": {
            "type": "string"
          },
          "periods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "lastRun": {
            "$ref": "#/components/schemas/FocusRun"
          },
          "tagKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "commitments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderCommitment"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "FocusRun": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string"
          },
          "startedAt": {
            "type": "string"
          },
          "finishedAt": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "failed",
              "ok",
              "partial"
            ]
          },
          "trigger": {
            "type": "string",
            "enum": [
              "manual",
              "upload",
              "schedule"
            ]
          },
          "periods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "type": "number",
            "format": "double"
          },
          "rows": {
            "type": "number",
            "format": "double"
          },
          "skipped": {
            "type": "number",
            "format": "double"
          },
          "skippedByReason": {
            "type": "object",
            "properties": {
              "noBillingPeriod": {
                "type": "number",
                "format": "double"
              },
              "badNumber": {
                "type": "number",
                "format": "double"
              },
              "badCurrency": {
                "type": "number",
                "format": "double"
              },
              "badChargePeriod": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "version": {
            "type": "string",
            "enum": [
              "1.2",
              "1.4",
              "1.0",
              "1.1",
              "1.3"
            ]
          },
          "ignoredFiles": {
            "type": "number",
            "format": "double"
          },
          "failure": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "other",
                  "unreachable",
                  "accessDenied",
                  "notFound",
                  "wrongRegion",
                  "notFocus",
                  "parquetUnsupported",
                  "connectionMissing",
                  "credentialRejected"
                ]
              },
              "detail": {
                "type": "string"
              }
            }
          }
        }
      },
      "ProviderCommitment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "periodStart": {
            "type": "string"
          },
          "periodEnd": {
            "type": "string"
          },
          "cost": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "double"
          },
          "unit": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "FocusIssuerView": {
        "type": "object",
        "properties": {
          "issuer": {
            "type": "string"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "mappedBy": {
            "type": "string",
            "enum": [
              "name",
              "person"
            ]
          },
          "totals": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          }
        }
      },
      "FocusInvoiceTotal": {
        "type": "object",
        "properties": {
          "issuer": {
            "type": "string"
          },
          "billingAccountId": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "byCategory": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          },
          "byService": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          },
          "corrections": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "FocusCostCenterTotal": {
        "type": "object",
        "properties": {
          "costCenter": {
            "type": "string"
          },
          "serviceCategory": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "AiLimitCredential": {
        "type": "object",
        "properties": {
          "invoicerId": {
            "type": "string"
          },
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "openai",
              "anthropic"
            ]
          },
          "aws": {
            "type": "object",
            "properties": {
              "roleArn": {
                "type": "string"
              },
              "externalId": {
                "type": "string"
              },
              "executionRoleArn": {
                "type": "string"
              },
              "denyPolicyArn": {
                "type": "string"
              },
              "roleNames": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "gcp": {
            "type": "object",
            "properties": {
              "serviceAccountEmail": {
                "type": "string"
              }
            }
          },
          "azure": {
            "type": "object",
            "properties": {
              "clientId": {
                "type": "string"
              }
            }
          },
          "keyHint": {
            "type": "string"
          },
          "notifyEmail": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          }
        }
      },
      "AiSpendLimit": {
        "type": "object",
        "properties": {
          "poId": {
            "type": "string"
          },
          "lineNo": {
            "type": "number",
            "format": "double"
          },
          "invoicerId": {
            "type": "string"
          },
          "invoicer": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "openai",
              "anthropic"
            ]
          },
          "target": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "period": {
            "type": "string"
          },
          "providerRef": {
            "type": "string"
          },
          "enforcement": {
            "type": "string",
            "enum": [
              "deny",
              "alert"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "failed",
              "removed",
              "set"
            ]
          },
          "readBack": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "at": {
                "type": "string"
              }
            }
          },
          "error": {
            "type": "string"
          },
          "setAt": {
            "type": "string"
          },
          "setBy": {
            "type": "string"
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "by": {
                  "type": "string"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "failed",
                    "set",
                    "raise",
                    "remove"
                  ]
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "readBack": {
                  "type": "number",
                  "format": "double"
                },
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BuyerSourcingEventSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "canceled",
              "closed",
              "open",
              "awarded"
            ]
          },
          "currency": {
            "type": "string"
          },
          "dueAt": {
            "type": "string"
          },
          "sealed": {
            "type": "boolean"
          },
          "sealedNow": {
            "type": "boolean"
          },
          "answers": {
            "$ref": "#/components/schemas/SourcingAnswerCounts"
          },
          "lineCount": {
            "type": "number",
            "format": "double"
          },
          "lowestTotal": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "fromRequestId": {
            "type": "string"
          },
          "award": {
            "type": "object",
            "properties": {
              "supplierName": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "order": {
                "type": "string",
                "enum": [
                  "submit",
                  "none",
                  "draft"
                ]
              },
              "total": {
                "type": "number",
                "format": "double"
              },
              "poId": {
                "type": "string"
              }
            }
          },
          "awards": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "supplierName": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "contractId": {
                  "type": "string"
                },
                "order": {
                  "type": "string",
                  "enum": [
                    "submit",
                    "none",
                    "draft"
                  ]
                },
                "total": {
                  "type": "number",
                  "format": "double"
                },
                "poId": {
                  "type": "string"
                },
                "supplierKey": {
                  "type": "string"
                }
              }
            }
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "SourcingAnswerCounts": {
        "type": "object",
        "properties": {
          "invited": {
            "type": "number",
            "format": "double"
          },
          "submitted": {
            "type": "number",
            "format": "double"
          },
          "declined": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "BuyerSourcingEventView": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "canceled",
              "closed",
              "open",
              "awarded"
            ]
          },
          "currency": {
            "type": "string"
          },
          "dueAt": {
            "type": "string"
          },
          "sealed": {
            "type": "boolean"
          },
          "sealedNow": {
            "type": "boolean"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingLine"
            }
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingAttachment"
            }
          },
          "fromRequestId": {
            "type": "string"
          },
          "costCenter": {
            "type": "string"
          },
          "glCode": {
            "type": "string"
          },
          "award": {
            "$ref": "#/components/schemas/SourcingAward"
          },
          "awards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingAward"
            }
          },
          "questionnaire": {
            "$ref": "#/components/schemas/SourcingQuestionnaire"
          },
          "scoring": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "$ref": "#/components/schemas/SourcingFieldScoring"
            }
          },
          "manualPoints": {
            "$ref": "#/components/schemas/SourcingManualPoints"
          },
          "assistantRead": {
            "$ref": "#/components/schemas/SourcingAssistantRead"
          },
          "round": {
            "type": "number",
            "format": "double"
          },
          "rounds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingRound"
            }
          },
          "criteria": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingCriterion"
            }
          },
          "evaluators": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdBy": {
            "type": "string"
          },
          "createdByName": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "publishedAt": {
            "type": "string"
          },
          "closedAt": {
            "type": "string"
          },
          "canceledAt": {
            "type": "string"
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "invitees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyerSourcingInviteeView"
            }
          },
          "answers": {
            "$ref": "#/components/schemas/SourcingAnswerCounts"
          },
          "responses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyerSourcingResponseView"
            }
          },
          "questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuyerSourcingQuestionView"
            }
          },
          "activity": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingActivity"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "SourcingLine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unit": {
            "type": "string"
          },
          "neededBy": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "targetUnitPrice": {
            "type": "number",
            "format": "double"
          }
        },
        "required": [
          "id"
        ]
      },
      "SourcingAttachment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "number",
            "format": "double"
          },
          "addedAt": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "request",
              "upload"
            ]
          },
          "shared": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "SourcingAward": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingAwardLine"
            }
          },
          "awardedAt": {
            "type": "string"
          },
          "awardedBy": {
            "type": "string"
          },
          "order": {
            "type": "string",
            "enum": [
              "submit",
              "none",
              "draft"
            ]
          },
          "poId": {
            "type": "string"
          },
          "quoteImportId": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "contract",
              "order",
              "both"
            ]
          },
          "contractId": {
            "type": "string"
          }
        }
      },
      "SourcingAwardLine": {
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unit": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SourcingQuestionnaire": {
        "type": "object",
        "properties": {
          "templateId": {
            "type": "string"
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "name": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionnaireFieldDef"
            }
          }
        }
      },
      "SourcingFieldScoring": {
        "type": "object",
        "properties": {
          "weight": {
            "type": "number",
            "format": "double"
          },
          "optionPoints": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          }
        }
      },
      "SourcingManualPoints": {
        "type": "object",
        "properties": {},
        "additionalProperties": {
          "type": "object",
          "properties": {},
          "additionalProperties": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SourcingAssistantRead": {
        "type": "object",
        "properties": {
          "sentences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantReadSentence"
            }
          },
          "model": {
            "type": "string"
          },
          "generatedAt": {
            "type": "string"
          },
          "inputHash": {
            "type": "string"
          }
        }
      },
      "AssistantReadSentence": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "cites": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantReadCite"
            }
          }
        }
      },
      "AssistantReadCite": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "lineId": {
            "type": "string"
          },
          "field": {
            "type": "string",
            "enum": [
              "validUntil",
              "declined",
              "total",
              "unitPrice",
              "leadTime",
              "neededBy",
              "paymentTerms",
              "score",
              "risk",
              "weighted",
              "evaluation"
            ]
          }
        }
      },
      "SourcingRound": {
        "type": "object",
        "properties": {
          "round": {
            "type": "number",
            "format": "double"
          },
          "supplierKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dueAt": {
            "type": "string"
          },
          "feedback": {
            "type": "string",
            "enum": [
              "none",
              "rank",
              "gap"
            ]
          },
          "feedbackBySupplier": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "rank"
                      ]
                    },
                    "rank": {
                      "type": "number",
                      "format": "double"
                    },
                    "of": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "gap"
                      ]
                    },
                    "lowest": {
                      "type": "boolean"
                    },
                    "gapPct": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              ]
            }
          },
          "openedAt": {
            "type": "string"
          },
          "openedBy": {
            "type": "string"
          },
          "closedAt": {
            "type": "string"
          }
        }
      },
      "SourcingCriterion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "weight": {
            "type": "number",
            "format": "double"
          },
          "kind": {
            "type": "string",
            "enum": [
              "price",
              "questionnaire",
              "evaluators"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "BuyerSourcingInviteeView": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "onPleaxy": {
            "type": "boolean"
          },
          "state": {
            "type": "string",
            "enum": [
              "invited",
              "declined",
              "viewed",
              "responded"
            ]
          },
          "declineReason": {
            "type": "string"
          },
          "invitedAt": {
            "type": "string"
          },
          "viewedAt": {
            "type": "string"
          },
          "declinedAt": {
            "type": "string"
          },
          "submittedAt": {
            "type": "string"
          },
          "submissions": {
            "type": "number",
            "format": "double"
          },
          "shortlisted": {
            "type": "boolean"
          }
        }
      },
      "BuyerSourcingResponseView": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingResponseLine"
            }
          },
          "validUntil": {
            "type": "string"
          },
          "paymentTermsDays": {
            "type": "number",
            "format": "double"
          },
          "reference": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingAttachment"
            }
          },
          "quoteImportId": {
            "type": "string"
          },
          "submittedAt": {
            "type": "string"
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "answers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingQuestionAnswer"
            }
          },
          "answeredVia": {
            "type": "string",
            "enum": [
              "link"
            ]
          },
          "answeredByEmail": {
            "type": "string"
          },
          "carriedFrom": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SourcingResponseLine": {
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number",
            "format": "double"
          },
          "leadTimeDays": {
            "type": "number",
            "format": "double"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "SourcingQuestionAnswer": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string"
          },
          "textAnswer": {
            "type": "string"
          },
          "selectedOptionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fileId": {
            "type": "string"
          }
        }
      },
      "BuyerSourcingQuestionView": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "askedAt": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          },
          "answeredAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "SourcingActivity": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "actor": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier",
              "system"
            ]
          },
          "actorName": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "invited",
              "canceled",
              "closed",
              "withdrawn",
              "reopened",
              "declined",
              "awarded",
              "viewed",
              "created",
              "edited",
              "published",
              "deadline_moved",
              "answer_saved",
              "answer_submitted",
              "question_asked",
              "question_answered",
              "scored",
              "round_opened",
              "scorecard_submitted"
            ]
          },
          "supplierKey": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "detail": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number",
                  "format": "double"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          }
        }
      },
      "SourcingComparison": {
        "type": "object",
        "properties": {
          "rfqId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "canceled",
              "closed",
              "open",
              "awarded"
            ]
          },
          "currency": {
            "type": "string"
          },
          "today": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingComparisonLine"
            }
          },
          "responders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingComparisonResponder"
            }
          },
          "lowestTotal": {
            "type": "object",
            "properties": {
              "supplierKey": {
                "type": "string"
              },
              "total": {
                "type": "number",
                "format": "double"
              }
            },
            "nullable": true
          },
          "declined": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "supplierKey": {
                  "type": "string"
                },
                "supplierName": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                }
              }
            }
          },
          "noAnswer": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "supplierKey": {
                  "type": "string"
                },
                "supplierName": {
                  "type": "string"
                }
              }
            }
          },
          "questionnaire": {
            "type": "object",
            "properties": {
              "templateId": {
                "type": "string"
              },
              "version": {
                "type": "number",
                "format": "double"
              },
              "name": {
                "type": "string"
              },
              "fields": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SourcingComparisonField"
                }
              }
            }
          },
          "round": {
            "type": "number",
            "format": "double"
          },
          "rounds": {
            "type": "number",
            "format": "double"
          },
          "criteria": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingCriterion"
            }
          },
          "evaluation": {
            "type": "object",
            "properties": {
              "criteria": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SourcingEvaluationCriterion"
                }
              },
              "evaluators": {
                "type": "number",
                "format": "double"
              },
              "submitted": {
                "type": "number",
                "format": "double"
              },
              "complete": {
                "type": "boolean"
              },
              "hidden": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "SourcingComparisonLine": {
        "type": "object",
        "properties": {
          "lineId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "qty": {
            "type": "number",
            "format": "double"
          },
          "unit": {
            "type": "string"
          },
          "neededBy": {
            "type": "string"
          },
          "targetUnitPrice": {
            "type": "number",
            "format": "double"
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingComparisonOffer"
            }
          }
        }
      },
      "SourcingComparisonOffer": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "lineTotal": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "leadTimeDays": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "note": {
            "type": "string"
          },
          "lowest": {
            "type": "boolean"
          },
          "meetsNeededBy": {
            "type": "boolean",
            "nullable": true
          }
        }
      },
      "SourcingComparisonResponder": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "total": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "complete": {
            "type": "boolean"
          },
          "lowestTotal": {
            "type": "boolean"
          },
          "longestLeadTimeDays": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "meetsNeededBy": {
            "type": "boolean",
            "nullable": true
          },
          "paymentTermsDays": {
            "type": "number",
            "format": "double"
          },
          "validUntil": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "quoteImportId": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingAttachment"
            }
          },
          "submittedAt": {
            "type": "string"
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "answeredVia": {
            "type": "string",
            "enum": [
              "link"
            ]
          },
          "answeredByEmail": {
            "type": "string"
          },
          "riskLevel": {
            "type": "string",
            "enum": [
              "ok",
              "attention",
              "blocked"
            ],
            "nullable": true
          },
          "onboarding": {
            "type": "string",
            "enum": [
              "pending_invite",
              "invited",
              "in_progress",
              "submitted",
              "approved",
              "rejected"
            ],
            "nullable": true
          },
          "score": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "scoreComplete": {
            "type": "boolean"
          },
          "carriedFrom": {
            "type": "number",
            "format": "double"
          },
          "weighted": {
            "$ref": "#/components/schemas/SourcingWeightedScore"
          },
          "evaluation": {
            "type": "object",
            "properties": {
              "byCriterion": {
                "type": "object",
                "properties": {},
                "additionalProperties": {
                  "$ref": "#/components/schemas/SourcingEvaluationAggregate"
                }
              }
            }
          }
        }
      },
      "SourcingWeightedScore": {
        "type": "object",
        "properties": {
          "total": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "byCriterion": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "nullable": true,
              "format": "double"
            }
          }
        }
      },
      "SourcingEvaluationAggregate": {
        "type": "object",
        "properties": {
          "average": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "lowest": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "highest": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "count": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "SourcingComparisonField": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "number",
              "text",
              "long_text",
              "yes_no",
              "single_choice",
              "multi_choice",
              "date",
              "file"
            ]
          },
          "section": {
            "type": "string"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionOption"
            }
          },
          "weight": {
            "type": "number",
            "format": "double"
          },
          "scoring": {
            "type": "string",
            "enum": [
              "manual",
              "choice"
            ],
            "nullable": true
          },
          "optionPoints": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          },
          "answers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourcingComparisonAnswer"
            }
          }
        }
      },
      "SourcingComparisonAnswer": {
        "type": "object",
        "properties": {
          "supplierKey": {
            "type": "string"
          },
          "asked": {
            "type": "boolean"
          },
          "fileName": {
            "type": "string"
          },
          "points": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "flagged": {
            "type": "boolean"
          },
          "fileId": {
            "type": "string"
          },
          "textAnswer": {
            "type": "string"
          },
          "selectedOptionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "SourcingEvaluationCriterion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "builtIn": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "SupplierRisk": {
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "ok",
              "attention",
              "blocked"
            ]
          },
          "bank": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "ok",
                  "none",
                  "attention",
                  "blocked"
                ]
              },
              "waiting": {
                "type": "number",
                "format": "double"
              },
              "status": {
                "type": "string",
                "enum": [
                  "approved",
                  "none",
                  "changing",
                  "waiting"
                ]
              }
            }
          },
          "screening": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "ok",
                  "none",
                  "attention",
                  "blocked"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "off",
                  "clear",
                  "possible_match",
                  "confirmed_match",
                  "not_screened"
                ]
              },
              "checkedAt": {
                "type": "string"
              }
            }
          },
          "flaggedAnswers": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "ok",
                  "none",
                  "attention",
                  "blocked"
                ]
              },
              "count": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "missingDocuments": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "ok",
                  "none",
                  "attention",
                  "blocked"
                ]
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PurchaseOrderEmails": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "emails": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InboundEmail"
            }
          }
        }
      },
      "InboundEmail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "poId": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "fromName": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "receivedAt": {
            "type": "string"
          },
          "trust": {
            "type": "string",
            "enum": [
              "unverified",
              "verified"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "text",
              "cxml"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "failed",
              "draft",
              "applied",
              "held",
              "noAction",
              "test",
              "ignored"
            ]
          },
          "reasonCode": {
            "type": "string",
            "enum": [
              "refused",
              "autoReply",
              "dailyLimit",
              "readingLimit",
              "notFulfillment",
              "otherOrder",
              "unreadable"
            ]
          },
          "reason": {
            "type": "string"
          },
          "reasonMessageId": {
            "type": "string"
          },
          "reasonParams": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "summary": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "size": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "draft": {
            "$ref": "#/components/schemas/InboundEmailDraft"
          },
          "result": {
            "type": "object",
            "properties": {
              "confirmationId": {
                "type": "string"
              },
              "shipmentId": {
                "type": "string"
              }
            }
          },
          "decision": {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "recorded",
                  "dismissed"
                ]
              },
              "by": {
                "type": "string"
              },
              "at": {
                "type": "string"
              },
              "confirmationId": {
                "type": "string"
              },
              "shipmentId": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "InboundEmailDraft": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "confirmation",
              "shipNotice"
            ]
          },
          "summary": {
            "type": "string"
          },
          "confirmation": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "accept",
                  "reject",
                  "backordered",
                  "detail"
                ]
              },
              "confirmId": {
                "type": "string"
              },
              "operation": {
                "type": "string",
                "enum": [
                  "new",
                  "update"
                ]
              },
              "deliveryDate": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "lineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "accept",
                        "reject",
                        "backordered",
                        "change"
                      ]
                    },
                    "qty": {
                      "type": "number",
                      "format": "double"
                    },
                    "unitPrice": {
                      "type": "number",
                      "format": "double"
                    },
                    "substitute": {
                      "$ref": "#/components/schemas/OrderConfirmationSubstitute"
                    },
                    "shipmentDate": {
                      "type": "string"
                    },
                    "deliveryDate": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "shipNotice": {
            "type": "object",
            "properties": {
              "shipmentId": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "canceled",
                  "planned",
                  "shipped"
                ]
              },
              "shipmentDate": {
                "type": "string"
              },
              "deliveryDate": {
                "type": "string"
              },
              "carrier": {
                "type": "string"
              },
              "trackingNumber": {
                "type": "string"
              },
              "trackingUrl": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "lines": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ShipNoticeLine"
                }
              }
            }
          },
          "payloadId": {
            "type": "string"
          }
        }
      },
      "InvoiceActivityEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "at": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "approved",
              "rejected",
              "approval",
              "received",
              "payment",
              "replacement",
              "corrects",
              "control_findings",
              "match",
              "sent_for_approval",
              "reminder",
              "early_payment_offer",
              "held_back",
              "hold_ended",
              "comment"
            ]
          },
          "actorName": {
            "type": "string"
          },
          "actorKey": {
            "type": "string"
          },
          "actorSide": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier",
              "system"
            ]
          },
          "data": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number",
                  "format": "double"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          "comment": {
            "$ref": "#/components/schemas/DocumentCommentView"
          }
        },
        "required": [
          "id"
        ]
      },
      "DocumentCommentView": {
        "type": "object",
        "properties": {
          "authorKey": {
            "type": "string"
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommentMention"
            }
          },
          "meeting": {
            "$ref": "#/components/schemas/CommentMeetingView"
          },
          "viewerIsAuthor": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "documentKind": {
            "type": "string",
            "enum": [
              "invoice",
              "purchase_order",
              "contract"
            ]
          },
          "documentId": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "internal",
              "shared"
            ]
          },
          "authorSide": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "authorName": {
            "type": "string"
          },
          "authorOrgName": {
            "type": "string"
          },
          "deletedAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "CommentMention": {
        "type": "object",
        "properties": {
          "employeeKey": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "CommentMeetingView": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "expired",
              "cancelled",
              "open",
              "declined"
            ]
          },
          "attendees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommentMeetingAttendee"
            }
          },
          "canAnswer": {
            "type": "boolean"
          },
          "canPropose": {
            "type": "boolean"
          },
          "canCancel": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string"
          },
          "link": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "durationMinutes": {
            "type": "number",
            "format": "double"
          },
          "timeZone": {
            "type": "string"
          },
          "times": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "proposedBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "proposerName": {
            "type": "string"
          },
          "counterProposals": {
            "type": "number",
            "format": "double"
          },
          "acceptedTime": {
            "type": "string"
          },
          "attendeeName": {
            "type": "string"
          },
          "attendeeSide": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "declineReason": {
            "type": "string"
          },
          "closedBySide": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "closedByName": {
            "type": "string"
          }
        }
      },
      "CommentMeetingAttendee": {
        "type": "object",
        "properties": {
          "side": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          }
        }
      },
      "BillingSummary": {
        "type": "object",
        "properties": {
          "billingEnabled": {
            "type": "boolean"
          },
          "plan": {
            "type": "string",
            "enum": [
              "assisted",
              "managed",
              "autonomous",
              "enterprise",
              "supplier-free",
              "supplier-plus",
              "supplier-enterprise"
            ]
          },
          "managedBy": {
            "type": "string",
            "enum": [
              "self-serve",
              "platform",
              "aws-marketplace"
            ]
          },
          "awsMarketplace": {
            "type": "object",
            "properties": {
              "regionsCovered": {
                "type": "number",
                "format": "double"
              },
              "endsAt": {
                "type": "string"
              }
            }
          },
          "hasBillingAccount": {
            "type": "boolean"
          },
          "subscriptionStatus": {
            "type": "string",
            "enum": [
              "active",
              "canceled",
              "unpaid",
              "trialing",
              "past_due",
              "incomplete",
              "incomplete_expired",
              "paused"
            ]
          },
          "currentPeriodEnd": {
            "type": "string"
          },
          "cancelAtPeriodEnd": {
            "type": "boolean"
          },
          "pastDueSince": {
            "type": "string"
          },
          "buyerRegionCount": {
            "type": "number",
            "format": "double"
          },
          "supplierRegionCount": {
            "type": "number",
            "format": "double"
          },
          "interval": {
            "type": "string",
            "enum": [
              "month",
              "year"
            ]
          },
          "availablePlans": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "plan": {
                  "type": "string",
                  "enum": [
                    "managed",
                    "autonomous",
                    "supplier-plus"
                  ]
                },
                "monthlyPriceLabel": {
                  "type": "string"
                },
                "monthlyPrice": {
                  "$ref": "#/components/schemas/PriceAmount"
                },
                "yearlyPriceLabel": {
                  "type": "string"
                },
                "yearlyPrice": {
                  "$ref": "#/components/schemas/PriceAmount"
                },
                "additionalRegionPriceLabels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "additionalRegionPrices": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionTierPrice"
                  }
                }
              }
            }
          },
          "currentPriceLabel": {
            "type": "string"
          },
          "currentPrice": {
            "$ref": "#/components/schemas/PriceAmount"
          },
          "currentTotalLabel": {
            "type": "string"
          },
          "currentTotal": {
            "$ref": "#/components/schemas/PriceAmount"
          },
          "modules": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "invoice",
                "sourcing",
                "contracts",
                "suppliers",
                "payment",
                "order",
                "receipt",
                "request",
                "aiSpend"
              ]
            }
          },
          "moduleOffers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModuleOffer"
            }
          },
          "pendingModuleRemoval": {
            "type": "object",
            "properties": {
              "modules": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "invoice",
                    "sourcing",
                    "contracts",
                    "suppliers",
                    "payment",
                    "order",
                    "receipt",
                    "request",
                    "aiSpend"
                  ]
                }
              },
              "at": {
                "type": "string"
              }
            }
          }
        }
      },
      "PriceAmount": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "interval": {
            "type": "string",
            "enum": [
              "month",
              "year"
            ]
          }
        }
      },
      "RegionTierPrice": {
        "type": "object",
        "properties": {
          "fromRegion": {
            "type": "number",
            "format": "double"
          },
          "toRegion": {
            "type": "number",
            "nullable": true,
            "format": "double"
          },
          "price": {
            "$ref": "#/components/schemas/PriceAmount"
          }
        }
      },
      "ModuleOffer": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "enum": [
              "invoice",
              "sourcing",
              "contracts",
              "suppliers",
              "payment",
              "source",
              "order",
              "receipt",
              "request",
              "aiSpend",
              "procureToPay",
              "suite"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "suite",
              "module",
              "group"
            ]
          },
          "modules": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "invoice",
                "sourcing",
                "contracts",
                "suppliers",
                "payment",
                "order",
                "receipt",
                "request",
                "aiSpend"
              ]
            }
          },
          "monthlyPriceLabel": {
            "type": "string"
          },
          "monthlyPrice": {
            "$ref": "#/components/schemas/PriceAmount"
          },
          "yearlyPriceLabel": {
            "type": "string"
          },
          "yearlyPrice": {
            "$ref": "#/components/schemas/PriceAmount"
          }
        }
      },
      "StripePaymentStatus": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "not_configured",
              "not_approved",
              "bank_details_held",
              "payment_locked",
              "paid_in_erp",
              "supplier_not_on_pleaxy",
              "supplier_not_connected",
              "unsupported_currency",
              "amount_too_small"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "checkout_open",
              "processing",
              "succeeded"
            ]
          },
          "paymentMethodType": {
            "type": "string",
            "enum": [
              "card",
              "us_bank_account"
            ]
          },
          "quote": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number",
                "format": "double"
              },
              "fee": {
                "type": "number",
                "format": "double"
              },
              "total": {
                "type": "number",
                "format": "double"
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              }
            }
          },
          "earlyPayment": {
            "type": "object",
            "properties": {
              "percent": {
                "type": "number",
                "format": "double"
              },
              "amount": {
                "type": "number",
                "format": "double"
              },
              "deadline": {
                "type": "string"
              },
              "quote": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "fee": {
                    "type": "number",
                    "format": "double"
                  },
                  "total": {
                    "type": "number",
                    "format": "double"
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "USD"
                    ]
                  }
                }
              },
              "taken": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "UsageAlertsResponse": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string"
          },
          "settings": {
            "$ref": "#/components/schemas/UsageAlertSettings"
          },
          "preset": {
            "$ref": "#/components/schemas/SensitivityPreset"
          },
          "currencies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageAlertCurrency"
            }
          },
          "alerts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageAlertView"
            }
          },
          "generatedAt": {
            "type": "string"
          }
        }
      },
      "UsageAlertSettings": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "sensitivity": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "minimums": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          },
          "updatedAt": {
            "type": "string"
          },
          "updatedBy": {
            "type": "string"
          }
        }
      },
      "SensitivityPreset": {
        "type": "object",
        "properties": {
          "spikePct": {
            "type": "number",
            "format": "double"
          },
          "pacePct": {
            "type": "number",
            "format": "double"
          },
          "minAmount": {
            "type": "number",
            "format": "double"
          },
          "minimums": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "format": "double"
            }
          }
        }
      },
      "UsageAlertCurrency": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "minimum": {
            "type": "number",
            "format": "double"
          },
          "defaultMinimum": {
            "type": "number",
            "format": "double"
          },
          "custom": {
            "type": "boolean"
          }
        }
      },
      "UsageAlertView": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "finding": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SpikeFinding"
              },
              {
                "$ref": "#/components/schemas/PaceFinding"
              },
              {
                "$ref": "#/components/schemas/CapFinding"
              },
              {
                "$ref": "#/components/schemas/TierFinding"
              },
              {
                "$ref": "#/components/schemas/CommitmentFinding"
              },
              {
                "$ref": "#/components/schemas/AiCommitmentFinding"
              }
            ]
          },
          "title": {
            "type": "string"
          },
          "titleMessageId": {
            "type": "string"
          },
          "titleParams": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "body": {
            "type": "string"
          },
          "bodyMessageId": {
            "type": "string"
          },
          "bodyParams": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "sentAt": {
            "type": "string"
          }
        }
      },
      "SpikeFinding": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "spike"
            ]
          },
          "subject": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ai_invoicer"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "invoicerId": {
                    "type": "string"
                  },
                  "invoicer": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci",
                      "openai",
                      "anthropic",
                      "mistral",
                      "cohere",
                      "xai",
                      "openrouter",
                      "snowflake",
                      "databricks",
                      "coreweave",
                      "lambda",
                      "nebius",
                      "crusoe",
                      "cursor",
                      "github",
                      "microsoft",
                      "slack",
                      "zoom"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ai_model"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "invoicerId": {
                    "type": "string"
                  },
                  "invoicer": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci",
                      "openai",
                      "anthropic",
                      "mistral",
                      "cohere",
                      "xai",
                      "openrouter",
                      "snowflake",
                      "databricks",
                      "coreweave",
                      "lambda",
                      "nebius",
                      "crusoe",
                      "cursor",
                      "github",
                      "microsoft",
                      "slack",
                      "zoom"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "cloud_account"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "connectionId": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "cloud_service"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "connectionId": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "service": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "recentFrom": {
            "type": "string"
          },
          "recentTo": {
            "type": "string"
          },
          "baselineFrom": {
            "type": "string"
          },
          "baselineTo": {
            "type": "string"
          },
          "recentPerDay": {
            "type": "number",
            "format": "double"
          },
          "baselinePerDay": {
            "type": "number",
            "format": "double"
          },
          "risePct": {
            "type": "number",
            "format": "double"
          },
          "excess": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "PaceFinding": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "pace"
            ]
          },
          "subject": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ai_invoicer"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "invoicerId": {
                    "type": "string"
                  },
                  "invoicer": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci",
                      "openai",
                      "anthropic",
                      "mistral",
                      "cohere",
                      "xai",
                      "openrouter",
                      "snowflake",
                      "databricks",
                      "coreweave",
                      "lambda",
                      "nebius",
                      "crusoe",
                      "cursor",
                      "github",
                      "microsoft",
                      "slack",
                      "zoom"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ai_model"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "invoicerId": {
                    "type": "string"
                  },
                  "invoicer": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci",
                      "openai",
                      "anthropic",
                      "mistral",
                      "cohere",
                      "xai",
                      "openrouter",
                      "snowflake",
                      "databricks",
                      "coreweave",
                      "lambda",
                      "nebius",
                      "crusoe",
                      "cursor",
                      "github",
                      "microsoft",
                      "slack",
                      "zoom"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "cloud_account"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "connectionId": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "cloud_service"
                    ]
                  },
                  "key": {
                    "type": "string"
                  },
                  "connectionId": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "azure",
                      "oci"
                    ]
                  },
                  "account": {
                    "type": "string"
                  },
                  "service": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "monthToDate": {
            "type": "number",
            "format": "double"
          },
          "asOf": {
            "type": "string"
          },
          "projected": {
            "type": "number",
            "format": "double"
          },
          "lastMonth": {
            "type": "number",
            "format": "double"
          },
          "lastMonthSource": {
            "type": "string",
            "enum": [
              "invoice",
              "snapshot"
            ]
          },
          "risePct": {
            "type": "number",
            "format": "double"
          },
          "excess": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "CapFinding": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "contract_cap"
            ]
          },
          "billed": {
            "type": "number",
            "format": "double"
          },
          "projected": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "cap": {
            "type": "number",
            "format": "double"
          },
          "excess": {
            "type": "number",
            "format": "double"
          },
          "contractId": {
            "type": "string"
          },
          "contractTitle": {
            "type": "string"
          },
          "supplier": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          }
        }
      },
      "TierFinding": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "contract_tier"
            ]
          },
          "billed": {
            "type": "number",
            "format": "double"
          },
          "projected": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "tierFrom": {
            "type": "number",
            "format": "double"
          },
          "percent": {
            "type": "number",
            "format": "double"
          },
          "windowStart": {
            "type": "string"
          },
          "windowEnd": {
            "type": "string"
          },
          "excess": {
            "type": "number",
            "enum": [
              0
            ],
            "format": "double"
          },
          "contractId": {
            "type": "string"
          },
          "contractTitle": {
            "type": "string"
          },
          "supplier": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          }
        }
      },
      "CommitmentFinding": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "contract_commitment"
            ]
          },
          "committed": {
            "type": "number",
            "format": "double"
          },
          "billed": {
            "type": "number",
            "format": "double"
          },
          "projected": {
            "type": "number",
            "format": "double"
          },
          "total": {
            "type": "number",
            "format": "double"
          },
          "windowStart": {
            "type": "string"
          },
          "windowEnd": {
            "type": "string"
          },
          "excess": {
            "type": "number",
            "format": "double"
          },
          "contractId": {
            "type": "string"
          },
          "contractTitle": {
            "type": "string"
          },
          "supplier": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          }
        }
      },
      "AiCommitmentFinding": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "ai_commitment"
            ]
          },
          "termId": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "committed": {
            "type": "number",
            "format": "double"
          },
          "projected": {
            "type": "number",
            "format": "double"
          },
          "windowStart": {
            "type": "string"
          },
          "windowEnd": {
            "type": "string"
          },
          "excess": {
            "type": "number",
            "format": "double"
          },
          "contractId": {
            "type": "string"
          },
          "contractTitle": {
            "type": "string"
          },
          "supplier": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "statusCode",
          "message"
        ],
        "properties": {
          "statusCode": {
            "type": "integer",
            "description": "The HTTP status, repeated."
          },
          "code": {
            "type": "string",
            "description": "A stable, machine-readable reason, when the API names one - e.g. PO_ID_AMBIGUOUS."
          },
          "message": {
            "description": "What went wrong, for a person; one entry per problem when the body failed validation.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "error": {
            "type": "string",
            "description": "The status text, e.g. Bad Request."
          }
        }
      },
      "CreateApiKeyResult": {
        "type": "object",
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "keyId": {
            "type": "string"
          },
          "regionId": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "procurementRole": {
            "type": "string",
            "enum": [
              "administrator",
              "read-only",
              "contracts-and-suppliers",
              "relationships",
              "requisitions",
              "finance",
              "agent"
            ]
          },
          "supplierRole": {
            "type": "string",
            "enum": [
              "administrator",
              "read-only",
              "accounts-receivable",
              "sales",
              "fulfillment",
              "member"
            ]
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "invoices:feed",
                "payments:record",
                "orders:fulfill"
              ]
            }
          },
          "label": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "revoked": {
            "type": "boolean"
          }
        }
      },
      "ListCloudConnectionsResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/CloudConnectionPage"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CloudConnection"
            }
          }
        ]
      },
      "AddCloudProviderAsSupplierResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "buyerName": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "invitedAsName": {
            "type": "string"
          },
          "supplierContactEmail": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_invite",
              "invited",
              "in_progress",
              "submitted",
              "approved",
              "rejected"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "rfq"
            ]
          },
          "questionnaireRequested": {
            "type": "boolean"
          },
          "questionnaireTemplateId": {
            "type": "string"
          },
          "questionnaireTemplateVersion": {
            "type": "number",
            "format": "double"
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionnaireFieldDef"
            }
          },
          "responses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionnaireResponseItem"
            }
          },
          "createdAt": {
            "type": "string"
          },
          "invitedAt": {
            "type": "string"
          },
          "respondedAt": {
            "type": "string"
          },
          "reviewedAt": {
            "type": "string"
          },
          "reviewedBy": {
            "type": "string"
          },
          "rejectionReason": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "aiProvider": {
            "type": "string",
            "enum": [
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom",
              "datadog",
              "twilio",
              "mongodb",
              "confluent",
              "vercel"
            ]
          },
          "billingCurrency": {
            "type": "string"
          },
          "paymentCurrency": {
            "type": "string"
          },
          "offPlatformInvoicesRecorded": {
            "type": "boolean"
          },
          "supplierRegion": {
            "$ref": "#/components/schemas/SupplierRegionRequest"
          },
          "acceptedRegionName": {
            "type": "string"
          },
          "acceptedRegionMatchesRequest": {
            "type": "boolean"
          },
          "invoiceFeedEnabled": {
            "type": "boolean"
          },
          "invoiceFeedUpdatedAt": {
            "type": "string"
          },
          "invoiceFeedUpdatedBy": {
            "type": "string"
          },
          "commentsMuted": {
            "type": "boolean"
          },
          "commentsMutedAt": {
            "type": "string"
          },
          "commentsMutedBy": {
            "type": "string"
          },
          "feedLastAttemptAt": {
            "type": "string"
          },
          "feedLastAcceptedAt": {
            "type": "string"
          },
          "feedAcceptedCount": {
            "type": "number",
            "format": "double"
          },
          "feedLastRefusedAt": {
            "type": "string"
          },
          "feedLastRefusedCode": {
            "type": "string"
          },
          "feedLastValidAt": {
            "type": "string"
          },
          "feedValidCount": {
            "type": "number",
            "format": "double"
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "lateFeeTermsUpdatedAt": {
            "type": "string"
          },
          "earlyPaymentStandingOffer": {
            "$ref": "#/components/schemas/EarlyPaymentStandingOffer"
          },
          "lateFeeTermsAttestedAt": {
            "type": "string"
          },
          "lateFeeTermsAttestationVersion": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "SetSupplierCurrenciesResult": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "buyerOrgId": {
                "type": "string"
              },
              "buyerName": {
                "type": "string"
              },
              "supplierOrgId": {
                "type": "string"
              },
              "supplierName": {
                "type": "string"
              },
              "invitedAsName": {
                "type": "string"
              },
              "supplierContactEmail": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending_invite",
                  "invited",
                  "in_progress",
                  "submitted",
                  "approved",
                  "rejected"
                ]
              },
              "origin": {
                "type": "string",
                "enum": [
                  "rfq"
                ]
              },
              "questionnaireRequested": {
                "type": "boolean"
              },
              "questionnaireTemplateId": {
                "type": "string"
              },
              "questionnaireTemplateVersion": {
                "type": "number",
                "format": "double"
              },
              "fields": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/QuestionnaireFieldDef"
                }
              },
              "responses": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/QuestionnaireResponseItem"
                }
              },
              "createdAt": {
                "type": "string"
              },
              "invitedAt": {
                "type": "string"
              },
              "respondedAt": {
                "type": "string"
              },
              "reviewedAt": {
                "type": "string"
              },
              "reviewedBy": {
                "type": "string"
              },
              "rejectionReason": {
                "type": "string"
              },
              "cloudProvider": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci"
                ]
              },
              "aiProvider": {
                "type": "string",
                "enum": [
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "openrouter",
                  "snowflake",
                  "databricks",
                  "coreweave",
                  "lambda",
                  "nebius",
                  "crusoe",
                  "cursor",
                  "github",
                  "microsoft",
                  "slack",
                  "zoom",
                  "datadog",
                  "twilio",
                  "mongodb",
                  "confluent",
                  "vercel"
                ]
              },
              "billingCurrency": {
                "type": "string"
              },
              "paymentCurrency": {
                "type": "string"
              },
              "offPlatformInvoicesRecorded": {
                "type": "boolean"
              },
              "supplierRegion": {
                "$ref": "#/components/schemas/SupplierRegionRequest"
              },
              "acceptedRegionName": {
                "type": "string"
              },
              "acceptedRegionMatchesRequest": {
                "type": "boolean"
              },
              "invoiceFeedEnabled": {
                "type": "boolean"
              },
              "invoiceFeedUpdatedAt": {
                "type": "string"
              },
              "invoiceFeedUpdatedBy": {
                "type": "string"
              },
              "commentsMuted": {
                "type": "boolean"
              },
              "commentsMutedAt": {
                "type": "string"
              },
              "commentsMutedBy": {
                "type": "string"
              },
              "feedLastAttemptAt": {
                "type": "string"
              },
              "feedLastAcceptedAt": {
                "type": "string"
              },
              "feedAcceptedCount": {
                "type": "number",
                "format": "double"
              },
              "feedLastRefusedAt": {
                "type": "string"
              },
              "feedLastRefusedCode": {
                "type": "string"
              },
              "feedLastValidAt": {
                "type": "string"
              },
              "feedValidCount": {
                "type": "number",
                "format": "double"
              },
              "lateFeeTerms": {
                "$ref": "#/components/schemas/LateFeeTerms"
              },
              "lateFeeTermsUpdatedAt": {
                "type": "string"
              },
              "earlyPaymentStandingOffer": {
                "$ref": "#/components/schemas/EarlyPaymentStandingOffer"
              },
              "lateFeeTermsAttestedAt": {
                "type": "string"
              },
              "lateFeeTermsAttestationVersion": {
                "type": "string"
              }
            },
            "required": [
              "id"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "buyerOrgId": {
                "type": "string"
              },
              "buyerName": {
                "type": "string"
              },
              "supplierOrgId": {
                "type": "string"
              },
              "supplierName": {
                "type": "string"
              },
              "invitedAsName": {
                "type": "string"
              },
              "supplierContactEmail": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending_invite",
                  "invited",
                  "in_progress",
                  "submitted",
                  "approved",
                  "rejected"
                ]
              },
              "origin": {
                "type": "string",
                "enum": [
                  "rfq"
                ]
              },
              "questionnaireRequested": {
                "type": "boolean"
              },
              "questionnaireTemplateId": {
                "type": "string"
              },
              "questionnaireTemplateVersion": {
                "type": "number",
                "format": "double"
              },
              "createdAt": {
                "type": "string"
              },
              "invitedAt": {
                "type": "string"
              },
              "respondedAt": {
                "type": "string"
              },
              "reviewedAt": {
                "type": "string"
              },
              "reviewedBy": {
                "type": "string"
              },
              "rejectionReason": {
                "type": "string"
              },
              "cloudProvider": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci"
                ]
              },
              "aiProvider": {
                "type": "string",
                "enum": [
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "openrouter",
                  "snowflake",
                  "databricks",
                  "coreweave",
                  "lambda",
                  "nebius",
                  "crusoe",
                  "cursor",
                  "github",
                  "microsoft",
                  "slack",
                  "zoom",
                  "datadog",
                  "twilio",
                  "mongodb",
                  "confluent",
                  "vercel"
                ]
              },
              "billingCurrency": {
                "type": "string"
              },
              "paymentCurrency": {
                "type": "string"
              },
              "offPlatformInvoicesRecorded": {
                "type": "boolean"
              },
              "supplierRegion": {
                "$ref": "#/components/schemas/SupplierRegionRequest"
              },
              "acceptedRegionName": {
                "type": "string"
              },
              "acceptedRegionMatchesRequest": {
                "type": "boolean"
              },
              "invoiceFeedEnabled": {
                "type": "boolean"
              },
              "invoiceFeedUpdatedAt": {
                "type": "string"
              },
              "invoiceFeedUpdatedBy": {
                "type": "string"
              },
              "commentsMuted": {
                "type": "boolean"
              },
              "commentsMutedAt": {
                "type": "string"
              },
              "commentsMutedBy": {
                "type": "string"
              },
              "feedLastAttemptAt": {
                "type": "string"
              },
              "feedLastAcceptedAt": {
                "type": "string"
              },
              "feedAcceptedCount": {
                "type": "number",
                "format": "double"
              },
              "feedLastRefusedAt": {
                "type": "string"
              },
              "feedLastRefusedCode": {
                "type": "string"
              },
              "feedLastValidAt": {
                "type": "string"
              },
              "feedValidCount": {
                "type": "number",
                "format": "double"
              },
              "lateFeeTerms": {
                "$ref": "#/components/schemas/LateFeeTerms"
              },
              "lateFeeTermsUpdatedAt": {
                "type": "string"
              },
              "earlyPaymentStandingOffer": {
                "$ref": "#/components/schemas/EarlyPaymentStandingOffer"
              },
              "lateFeeTermsAttestedAt": {
                "type": "string"
              },
              "lateFeeTermsAttestationVersion": {
                "type": "string"
              },
              "questionnaireRedacted": {
                "type": "boolean"
              }
            },
            "required": [
              "id"
            ]
          }
        ]
      },
      "SetInvoiceFeedResult": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "feedReadiness": {
                "type": "string",
                "enum": [
                  "not_connected",
                  "off",
                  "no_key",
                  "untested",
                  "tested",
                  "live"
                ]
              },
              "id": {
                "type": "string"
              },
              "buyerOrgId": {
                "type": "string"
              },
              "buyerName": {
                "type": "string"
              },
              "supplierOrgId": {
                "type": "string"
              },
              "supplierName": {
                "type": "string"
              },
              "invitedAsName": {
                "type": "string"
              },
              "supplierContactEmail": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending_invite",
                  "invited",
                  "in_progress",
                  "submitted",
                  "approved",
                  "rejected"
                ]
              },
              "origin": {
                "type": "string",
                "enum": [
                  "rfq"
                ]
              },
              "questionnaireRequested": {
                "type": "boolean"
              },
              "questionnaireTemplateId": {
                "type": "string"
              },
              "questionnaireTemplateVersion": {
                "type": "number",
                "format": "double"
              },
              "fields": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/QuestionnaireFieldDef"
                }
              },
              "responses": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/QuestionnaireResponseItem"
                }
              },
              "createdAt": {
                "type": "string"
              },
              "invitedAt": {
                "type": "string"
              },
              "respondedAt": {
                "type": "string"
              },
              "reviewedAt": {
                "type": "string"
              },
              "reviewedBy": {
                "type": "string"
              },
              "rejectionReason": {
                "type": "string"
              },
              "cloudProvider": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci"
                ]
              },
              "aiProvider": {
                "type": "string",
                "enum": [
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "openrouter",
                  "snowflake",
                  "databricks",
                  "coreweave",
                  "lambda",
                  "nebius",
                  "crusoe",
                  "cursor",
                  "github",
                  "microsoft",
                  "slack",
                  "zoom",
                  "datadog",
                  "twilio",
                  "mongodb",
                  "confluent",
                  "vercel"
                ]
              },
              "billingCurrency": {
                "type": "string"
              },
              "paymentCurrency": {
                "type": "string"
              },
              "offPlatformInvoicesRecorded": {
                "type": "boolean"
              },
              "supplierRegion": {
                "$ref": "#/components/schemas/SupplierRegionRequest"
              },
              "acceptedRegionName": {
                "type": "string"
              },
              "acceptedRegionMatchesRequest": {
                "type": "boolean"
              },
              "invoiceFeedEnabled": {
                "type": "boolean"
              },
              "invoiceFeedUpdatedAt": {
                "type": "string"
              },
              "invoiceFeedUpdatedBy": {
                "type": "string"
              },
              "commentsMuted": {
                "type": "boolean"
              },
              "commentsMutedAt": {
                "type": "string"
              },
              "commentsMutedBy": {
                "type": "string"
              },
              "feedLastAttemptAt": {
                "type": "string"
              },
              "feedLastAcceptedAt": {
                "type": "string"
              },
              "feedAcceptedCount": {
                "type": "number",
                "format": "double"
              },
              "feedLastRefusedAt": {
                "type": "string"
              },
              "feedLastRefusedCode": {
                "type": "string"
              },
              "feedLastValidAt": {
                "type": "string"
              },
              "feedValidCount": {
                "type": "number",
                "format": "double"
              },
              "lateFeeTerms": {
                "$ref": "#/components/schemas/LateFeeTerms"
              },
              "lateFeeTermsUpdatedAt": {
                "type": "string"
              },
              "earlyPaymentStandingOffer": {
                "$ref": "#/components/schemas/EarlyPaymentStandingOffer"
              },
              "lateFeeTermsAttestedAt": {
                "type": "string"
              },
              "lateFeeTermsAttestationVersion": {
                "type": "string"
              }
            },
            "required": [
              "id"
            ]
          },
          {
            "type": "object",
            "properties": {
              "feedReadiness": {
                "type": "string",
                "enum": [
                  "not_connected",
                  "off",
                  "no_key",
                  "untested",
                  "tested",
                  "live"
                ]
              },
              "id": {
                "type": "string"
              },
              "buyerOrgId": {
                "type": "string"
              },
              "buyerName": {
                "type": "string"
              },
              "supplierOrgId": {
                "type": "string"
              },
              "supplierName": {
                "type": "string"
              },
              "invitedAsName": {
                "type": "string"
              },
              "supplierContactEmail": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending_invite",
                  "invited",
                  "in_progress",
                  "submitted",
                  "approved",
                  "rejected"
                ]
              },
              "origin": {
                "type": "string",
                "enum": [
                  "rfq"
                ]
              },
              "questionnaireRequested": {
                "type": "boolean"
              },
              "questionnaireTemplateId": {
                "type": "string"
              },
              "questionnaireTemplateVersion": {
                "type": "number",
                "format": "double"
              },
              "createdAt": {
                "type": "string"
              },
              "invitedAt": {
                "type": "string"
              },
              "respondedAt": {
                "type": "string"
              },
              "reviewedAt": {
                "type": "string"
              },
              "reviewedBy": {
                "type": "string"
              },
              "rejectionReason": {
                "type": "string"
              },
              "cloudProvider": {
                "type": "string",
                "enum": [
                  "aws",
                  "gcp",
                  "azure",
                  "oci"
                ]
              },
              "aiProvider": {
                "type": "string",
                "enum": [
                  "openai",
                  "anthropic",
                  "mistral",
                  "cohere",
                  "xai",
                  "openrouter",
                  "snowflake",
                  "databricks",
                  "coreweave",
                  "lambda",
                  "nebius",
                  "crusoe",
                  "cursor",
                  "github",
                  "microsoft",
                  "slack",
                  "zoom",
                  "datadog",
                  "twilio",
                  "mongodb",
                  "confluent",
                  "vercel"
                ]
              },
              "billingCurrency": {
                "type": "string"
              },
              "paymentCurrency": {
                "type": "string"
              },
              "offPlatformInvoicesRecorded": {
                "type": "boolean"
              },
              "supplierRegion": {
                "$ref": "#/components/schemas/SupplierRegionRequest"
              },
              "acceptedRegionName": {
                "type": "string"
              },
              "acceptedRegionMatchesRequest": {
                "type": "boolean"
              },
              "invoiceFeedEnabled": {
                "type": "boolean"
              },
              "invoiceFeedUpdatedAt": {
                "type": "string"
              },
              "invoiceFeedUpdatedBy": {
                "type": "string"
              },
              "commentsMuted": {
                "type": "boolean"
              },
              "commentsMutedAt": {
                "type": "string"
              },
              "commentsMutedBy": {
                "type": "string"
              },
              "feedLastAttemptAt": {
                "type": "string"
              },
              "feedLastAcceptedAt": {
                "type": "string"
              },
              "feedAcceptedCount": {
                "type": "number",
                "format": "double"
              },
              "feedLastRefusedAt": {
                "type": "string"
              },
              "feedLastRefusedCode": {
                "type": "string"
              },
              "feedLastValidAt": {
                "type": "string"
              },
              "feedValidCount": {
                "type": "number",
                "format": "double"
              },
              "lateFeeTerms": {
                "$ref": "#/components/schemas/LateFeeTerms"
              },
              "lateFeeTermsUpdatedAt": {
                "type": "string"
              },
              "earlyPaymentStandingOffer": {
                "$ref": "#/components/schemas/EarlyPaymentStandingOffer"
              },
              "lateFeeTermsAttestedAt": {
                "type": "string"
              },
              "lateFeeTermsAttestationVersion": {
                "type": "string"
              },
              "questionnaireRedacted": {
                "type": "boolean"
              }
            },
            "required": [
              "id"
            ]
          }
        ]
      },
      "GetOrgProfileResult": {
        "type": "object",
        "properties": {
          "images": {
            "$ref": "#/components/schemas/ProfileImages"
          },
          "id": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "regionId": {
            "type": "string"
          },
          "regionName": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "billingEmail": {
            "type": "string"
          },
          "billingAddress": {
            "type": "string"
          },
          "billingAddressParts": {
            "$ref": "#/components/schemas/PostalAddress"
          },
          "billingAddressLegacyText": {
            "type": "string"
          },
          "billingAddressNeedsReview": {
            "type": "boolean"
          },
          "taxId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "otherCurrencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "paymentCurrencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fxWarningPct": {
            "type": "number",
            "format": "double"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "geography": {
            "$ref": "#/components/schemas/Geography"
          },
          "timeZone": {
            "type": "string"
          },
          "locale": {
            "type": "string",
            "enum": [
              "en",
              "es",
              "pt-BR",
              "de",
              "fr",
              "it"
            ]
          },
          "primaryContactName": {
            "type": "string"
          },
          "primaryContactEmail": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "sameDomainAcknowledged": {
            "$ref": "#/components/schemas/SameDomainAcknowledgement"
          },
          "verified": {
            "type": "boolean"
          },
          "listedInDirectory": {
            "type": "boolean"
          },
          "directoryId": {
            "type": "string"
          },
          "sellsCategories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sellsSegments": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sponsoredUntil": {
            "type": "string"
          },
          "sponsoredContract": {
            "type": "string"
          },
          "setupGoal": {
            "type": "string",
            "enum": [
              "audit",
              "network"
            ]
          },
          "eInvoicing": {
            "$ref": "#/components/schemas/EInvoicingProfileSettings"
          }
        },
        "required": [
          "id"
        ]
      },
      "GetBuyerWorkspaceResult": {
        "type": "object",
        "properties": {
          "viewerIsSoleInvoiceReviewer": {
            "type": "boolean"
          },
          "recentPurchaseOrders": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/PurchaseOrder"
                },
                {
                  "$ref": "#/components/schemas/PurchaseOrderSupplierView"
                }
              ]
            }
          },
          "recentInvoices": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                },
                {
                  "$ref": "#/components/schemas/InvoiceSupplierView"
                }
              ]
            }
          },
          "cloudConnections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CloudConnection"
            }
          },
          "purchaseOrders": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/PurchaseOrder"
                },
                {
                  "$ref": "#/components/schemas/PurchaseOrderSupplierView"
                }
              ]
            }
          },
          "invoices": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                },
                {
                  "$ref": "#/components/schemas/InvoiceSupplierView"
                }
              ]
            }
          }
        }
      },
      "GetSupplierWorkspaceResult": {
        "type": "object",
        "properties": {
          "recentIncomingPOs": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/PurchaseOrder"
                },
                {
                  "$ref": "#/components/schemas/PurchaseOrderSupplierView"
                }
              ]
            }
          },
          "recentSupplierInvoices": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                },
                {
                  "$ref": "#/components/schemas/InvoiceSupplierView"
                }
              ]
            }
          },
          "incomingPOs": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/PurchaseOrder"
                },
                {
                  "$ref": "#/components/schemas/PurchaseOrderSupplierView"
                }
              ]
            }
          },
          "supplierInvoices": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/InvoiceBuyerView"
                },
                {
                  "$ref": "#/components/schemas/InvoiceSupplierView"
                }
              ]
            }
          }
        }
      },
      "ListPurchaseOrdersItem": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PurchaseOrder"
          },
          {
            "$ref": "#/components/schemas/PurchaseOrderSupplierView"
          }
        ]
      },
      "GetPurchaseOrderResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PurchaseOrder"
          },
          {
            "$ref": "#/components/schemas/PurchaseOrderSupplierView"
          }
        ]
      },
      "SetExchangeRateWarningResult": {
        "type": "object",
        "properties": {
          "warningPct": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "GetReferenceRateResult": {
        "type": "object",
        "properties": {
          "reference": {
            "$ref": "#/components/schemas/ReferenceRate"
          }
        }
      },
      "SubmitFeedInvoiceResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/InvoiceSupplierView"
          },
          {
            "$ref": "#/components/schemas/SupplierCreditNoteView"
          }
        ]
      },
      "ValidateFeedInvoiceResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ValidateFeedInvoiceResultCreditNote"
          },
          {
            "$ref": "#/components/schemas/FeedValidationResult"
          }
        ]
      },
      "ValidateFeedInvoiceResultCreditNote": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "credit_note"
            ]
          },
          "feedEnabled": {
            "type": "boolean"
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "creditNote": {
            "type": "object",
            "properties": {
              "invoiceId": {
                "type": "string"
              },
              "externalInvoiceNumber": {
                "type": "string"
              },
              "adjustments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceAdjustment"
                }
              },
              "lineItems": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceLineItem"
                }
              },
              "taxAmount": {
                "type": "number",
                "format": "double"
              },
              "refunded": {
                "type": "number",
                "format": "double"
              },
              "amount": {
                "type": "number",
                "format": "double"
              },
              "correctsBilling": {
                "type": "boolean"
              },
              "externalCreditNoteNumber": {
                "type": "string"
              },
              "issueDate": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "reason": {
                "type": "string",
                "enum": [
                  "other",
                  "returned_goods",
                  "price_adjustment",
                  "service_credit",
                  "rebate",
                  "early_payment_discount"
                ]
              }
            }
          },
          "replay": {
            "type": "object",
            "properties": {
              "creditNoteId": {
                "type": "string"
              },
              "identical": {
                "type": "boolean"
              }
            },
            "nullable": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ListInvoicesItem": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ListInvoicesItemBuyerInvoice"
          },
          {
            "$ref": "#/components/schemas/ListInvoicesItemSupplierInvoice"
          },
          {
            "$ref": "#/components/schemas/ListInvoicesItemSupplierCreditNote"
          },
          {
            "$ref": "#/components/schemas/ListInvoicesItemBuyerCreditNote"
          }
        ]
      },
      "ListInvoicesItemBuyerInvoice": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "settlement": {
            "$ref": "#/components/schemas/InvoiceSettlement"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          },
          "usageAmountSimulated": {
            "type": "boolean"
          },
          "usageSimulatedAfterDisconnect": {
            "type": "boolean"
          },
          "usageCurrency": {
            "type": "string"
          },
          "usageSource": {
            "type": "string",
            "enum": [
              "aws_invoice",
              "billing_export",
              "mca_invoice",
              "ea_balance",
              "usage_api_closed_month",
              "osp_invoice",
              "focus_export",
              "cost_explorer_month"
            ]
          },
          "usageLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceUsageLine"
            }
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "unverifiedReason": {
            "type": "string",
            "enum": [
              "no_purchase_order",
              "no_billing_connection",
              "debit_note",
              "payer_account_unclear",
              "no_po_first_invoice",
              "no_usage_figure"
            ]
          },
          "matchBasis": {
            "type": "string",
            "enum": [
              "purchase_order",
              "no_po_history"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "receiptCheckSkipped": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "small_invoice"
                ]
              },
              "at": {
                "type": "string"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceControlFinding"
                }
              }
            }
          },
          "receiptToleranceApplied": {
            "type": "object",
            "properties": {
              "over": {
                "type": "number",
                "format": "double"
              },
              "received": {
                "type": "number",
                "format": "double"
              },
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poLineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "over": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "at": {
                "type": "string"
              }
            }
          },
          "matchType": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "discrepancyReason": {
            "type": "string",
            "enum": [
              "amount",
              "currency",
              "controls",
              "no_po_variance"
            ]
          },
          "controlFindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceControlFinding"
            }
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/InvoicePaymentRecord"
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRemittance"
            }
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentHistoryEntry"
            }
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/InvoicePaymentProblem"
          },
          "receiptConfirmationRemindedAt": {
            "type": "string"
          },
          "exportAvailableFrom": {
            "type": "string"
          },
          "previousExportedAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "cloudConnectionId": {
            "type": "string"
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "sodExcludedKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "feedPayloadHash": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "heldBack": {
            "$ref": "#/components/schemas/InvoiceHeldBack"
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "rateWarnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRateWarning"
            }
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "remittanceCheck": {
            "$ref": "#/components/schemas/RemittanceCheck"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/BankDetailsConfirmation"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "viewerIsSupplierMember": {
            "type": "boolean"
          },
          "nextApproverReminderAt": {
            "type": "string"
          },
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "ListInvoicesItemSupplierInvoice": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "canOfferEarlyPayment": {
            "type": "boolean"
          },
          "heldBack": {
            "$ref": "#/components/schemas/SupplierHeldBackView"
          },
          "settlement": {
            "$ref": "#/components/schemas/SupplierSettlementView"
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/SupplierPaymentProblemView"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/SupplierBankDetailsConfirmationView"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "approval": {
            "$ref": "#/components/schemas/SupplierApprovalView"
          },
          "payment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "withdrawnPayment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierRemittanceView"
            }
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "nextReminderAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "ListInvoicesItemSupplierCreditNote": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "invoiceId": {
                  "type": "string"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "rejected",
                    "accepted",
                    "exported",
                    "removed",
                    "issued",
                    "applied",
                    "returned",
                    "voided"
                  ]
                },
                "exportId": {
                  "type": "string"
                }
              }
            }
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note",
              "credit_note"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "ListInvoicesItemBuyerCreditNote": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "acceptedByName": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteHistoryEntry"
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note",
              "credit_note"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "CreateInvoiceResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/CreateInvoiceResultSupplierCreditNote"
          },
          {
            "$ref": "#/components/schemas/CreateInvoiceResultBuyerCreditNote"
          },
          {
            "$ref": "#/components/schemas/CreateInvoiceResultBuyerInvoice"
          },
          {
            "$ref": "#/components/schemas/CreateInvoiceResultSupplierInvoice"
          }
        ]
      },
      "CreateInvoiceResultSupplierCreditNote": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "invoiceId": {
                  "type": "string"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "rejected",
                    "accepted",
                    "exported",
                    "removed",
                    "issued",
                    "applied",
                    "returned",
                    "voided"
                  ]
                },
                "exportId": {
                  "type": "string"
                }
              }
            }
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "credit_note"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "CreateInvoiceResultBuyerCreditNote": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "acceptedByName": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteHistoryEntry"
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "credit_note"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "CreateInvoiceResultBuyerInvoice": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "settlement": {
            "$ref": "#/components/schemas/InvoiceSettlement"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          },
          "usageAmountSimulated": {
            "type": "boolean"
          },
          "usageSimulatedAfterDisconnect": {
            "type": "boolean"
          },
          "usageCurrency": {
            "type": "string"
          },
          "usageSource": {
            "type": "string",
            "enum": [
              "aws_invoice",
              "billing_export",
              "mca_invoice",
              "ea_balance",
              "usage_api_closed_month",
              "osp_invoice",
              "focus_export",
              "cost_explorer_month"
            ]
          },
          "usageLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceUsageLine"
            }
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "unverifiedReason": {
            "type": "string",
            "enum": [
              "no_purchase_order",
              "no_billing_connection",
              "debit_note",
              "payer_account_unclear",
              "no_po_first_invoice",
              "no_usage_figure"
            ]
          },
          "matchBasis": {
            "type": "string",
            "enum": [
              "purchase_order",
              "no_po_history"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "receiptCheckSkipped": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "small_invoice"
                ]
              },
              "at": {
                "type": "string"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceControlFinding"
                }
              }
            }
          },
          "receiptToleranceApplied": {
            "type": "object",
            "properties": {
              "over": {
                "type": "number",
                "format": "double"
              },
              "received": {
                "type": "number",
                "format": "double"
              },
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poLineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "over": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "at": {
                "type": "string"
              }
            }
          },
          "matchType": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "discrepancyReason": {
            "type": "string",
            "enum": [
              "amount",
              "currency",
              "controls",
              "no_po_variance"
            ]
          },
          "controlFindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceControlFinding"
            }
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/InvoicePaymentRecord"
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRemittance"
            }
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentHistoryEntry"
            }
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/InvoicePaymentProblem"
          },
          "receiptConfirmationRemindedAt": {
            "type": "string"
          },
          "exportAvailableFrom": {
            "type": "string"
          },
          "previousExportedAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "cloudConnectionId": {
            "type": "string"
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "sodExcludedKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "feedPayloadHash": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "heldBack": {
            "$ref": "#/components/schemas/InvoiceHeldBack"
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "rateWarnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRateWarning"
            }
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "remittanceCheck": {
            "$ref": "#/components/schemas/RemittanceCheck"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/BankDetailsConfirmation"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "viewerIsSupplierMember": {
            "type": "boolean"
          },
          "nextApproverReminderAt": {
            "type": "string"
          },
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "CreateInvoiceResultSupplierInvoice": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "canOfferEarlyPayment": {
            "type": "boolean"
          },
          "heldBack": {
            "$ref": "#/components/schemas/SupplierHeldBackView"
          },
          "settlement": {
            "$ref": "#/components/schemas/SupplierSettlementView"
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/SupplierPaymentProblemView"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/SupplierBankDetailsConfirmationView"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "approval": {
            "$ref": "#/components/schemas/SupplierApprovalView"
          },
          "payment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "withdrawnPayment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierRemittanceView"
            }
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "nextReminderAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "ListInvoiceCounterpartiesResult": {
        "type": "object",
        "properties": {
          "counterparties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCounterparty"
            }
          }
        }
      },
      "GetInvoiceResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/GetInvoiceResultSupplierCreditNote"
          },
          {
            "$ref": "#/components/schemas/GetInvoiceResultBuyerCreditNote"
          },
          {
            "$ref": "#/components/schemas/GetInvoiceResultBuyerInvoice"
          },
          {
            "$ref": "#/components/schemas/GetInvoiceResultSupplierInvoice"
          }
        ]
      },
      "GetInvoiceResultSupplierCreditNote": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "invoiceId": {
                  "type": "string"
                },
                "action": {
                  "type": "string",
                  "enum": [
                    "rejected",
                    "accepted",
                    "exported",
                    "removed",
                    "issued",
                    "applied",
                    "returned",
                    "voided"
                  ]
                },
                "exportId": {
                  "type": "string"
                }
              }
            }
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "credit_note"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "GetInvoiceResultBuyerCreditNote": {
        "type": "object",
        "properties": {
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "rejected",
              "accepted",
              "pending_acceptance",
              "void"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "version": {
            "type": "number",
            "format": "double"
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "rejection": {
            "type": "object",
            "properties": {
              "at": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "note": {
            "type": "string"
          },
          "externalCreditNoteNumber": {
            "type": "string"
          },
          "issueDate": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "other",
              "returned_goods",
              "price_adjustment",
              "service_credit",
              "rebate",
              "early_payment_discount"
            ]
          },
          "correctsBilling": {
            "type": "boolean"
          },
          "refunded": {
            "type": "number",
            "format": "double"
          },
          "acceptedAt": {
            "type": "string"
          },
          "acceptedByName": {
            "type": "string"
          },
          "autoAccepted": {
            "type": "boolean"
          },
          "poEffect": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "release"
                    ]
                  },
                  "po": {
                    "type": "string"
                  },
                  "poLineNo": {
                    "type": "number",
                    "format": "double"
                  },
                  "amount": {
                    "type": "number",
                    "format": "double"
                  },
                  "qty": {
                    "type": "number",
                    "format": "double"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "none"
                    ]
                  },
                  "why": {
                    "type": "string",
                    "enum": [
                      "not_a_correction",
                      "no_po",
                      "po_closed"
                    ]
                  }
                }
              }
            ]
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteApplication"
            }
          },
          "exports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exportId": {
                  "type": "string"
                },
                "exportedAt": {
                  "type": "string"
                }
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteHistoryEntry"
            }
          },
          "remaining": {
            "type": "number",
            "format": "double"
          },
          "hasPdf": {
            "type": "boolean"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "credit_note"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "GetInvoiceResultBuyerInvoice": {
        "type": "object",
        "properties": {
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          },
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "settlement": {
            "$ref": "#/components/schemas/InvoiceSettlement"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          },
          "usageAmountSimulated": {
            "type": "boolean"
          },
          "usageSimulatedAfterDisconnect": {
            "type": "boolean"
          },
          "usageCurrency": {
            "type": "string"
          },
          "usageSource": {
            "type": "string",
            "enum": [
              "aws_invoice",
              "billing_export",
              "mca_invoice",
              "ea_balance",
              "usage_api_closed_month",
              "osp_invoice",
              "focus_export",
              "cost_explorer_month"
            ]
          },
          "usageLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceUsageLine"
            }
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "unverifiedReason": {
            "type": "string",
            "enum": [
              "no_purchase_order",
              "no_billing_connection",
              "debit_note",
              "payer_account_unclear",
              "no_po_first_invoice",
              "no_usage_figure"
            ]
          },
          "matchBasis": {
            "type": "string",
            "enum": [
              "purchase_order",
              "no_po_history"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "receiptCheckSkipped": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "small_invoice"
                ]
              },
              "at": {
                "type": "string"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceControlFinding"
                }
              }
            }
          },
          "receiptToleranceApplied": {
            "type": "object",
            "properties": {
              "over": {
                "type": "number",
                "format": "double"
              },
              "received": {
                "type": "number",
                "format": "double"
              },
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poLineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "over": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "at": {
                "type": "string"
              }
            }
          },
          "matchType": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "discrepancyReason": {
            "type": "string",
            "enum": [
              "amount",
              "currency",
              "controls",
              "no_po_variance"
            ]
          },
          "controlFindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceControlFinding"
            }
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/InvoicePaymentRecord"
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRemittance"
            }
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentHistoryEntry"
            }
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/InvoicePaymentProblem"
          },
          "receiptConfirmationRemindedAt": {
            "type": "string"
          },
          "exportAvailableFrom": {
            "type": "string"
          },
          "previousExportedAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "cloudConnectionId": {
            "type": "string"
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "sodExcludedKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "feedPayloadHash": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "heldBack": {
            "$ref": "#/components/schemas/InvoiceHeldBack"
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "rateWarnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRateWarning"
            }
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "remittanceCheck": {
            "$ref": "#/components/schemas/RemittanceCheck"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/BankDetailsConfirmation"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "viewerIsSupplierMember": {
            "type": "boolean"
          },
          "nextApproverReminderAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "GetInvoiceResultSupplierInvoice": {
        "type": "object",
        "properties": {
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          },
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "canOfferEarlyPayment": {
            "type": "boolean"
          },
          "heldBack": {
            "$ref": "#/components/schemas/SupplierHeldBackView"
          },
          "settlement": {
            "$ref": "#/components/schemas/SupplierSettlementView"
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/SupplierPaymentProblemView"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/SupplierBankDetailsConfirmationView"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "approval": {
            "$ref": "#/components/schemas/SupplierApprovalView"
          },
          "payment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "withdrawnPayment": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "withholdings": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/InvoiceBreakdownEntry"
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "other",
                      "card",
                      "ach",
                      "wire",
                      "check",
                      "credit",
                      "nothing_due"
                    ]
                  },
                  "paymentDate": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string"
                  },
                  "adviceVersion": {
                    "type": "number",
                    "format": "double"
                  },
                  "paidAmount": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "format": "double"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "rate": {
                        "type": "number",
                        "format": "double"
                      },
                      "rateDate": {
                        "type": "string"
                      }
                    }
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "recorded"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "stripe"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "succeeded"
                    ]
                  },
                  "paymentMethodType": {
                    "type": "string",
                    "enum": [
                      "card",
                      "us_bank_account"
                    ]
                  },
                  "succeededAt": {
                    "type": "string"
                  },
                  "earlyPaymentDiscount": {
                    "$ref": "#/components/schemas/EarlyPaymentDiscountTaken"
                  }
                }
              }
            ]
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupplierRemittanceView"
            }
          },
          "buyerWorkspaceId": {
            "type": "string"
          },
          "nextReminderAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "GetInvoiceReconciliationResult": {
        "type": "object",
        "properties": {
          "ucp": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              },
              "capabilities": {
                "type": "object",
                "properties": {
                  "ai.pleaxy.procurement.reconciliation": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "version": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "reconciliation": {
            "$ref": "#/components/schemas/ReconciliationResult"
          }
        }
      },
      "AddInvoiceReplacementLinksResult": {
        "type": "object",
        "properties": {
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          },
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "settlement": {
            "$ref": "#/components/schemas/InvoiceSettlement"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          },
          "usageAmountSimulated": {
            "type": "boolean"
          },
          "usageSimulatedAfterDisconnect": {
            "type": "boolean"
          },
          "usageCurrency": {
            "type": "string"
          },
          "usageSource": {
            "type": "string",
            "enum": [
              "aws_invoice",
              "billing_export",
              "mca_invoice",
              "ea_balance",
              "usage_api_closed_month",
              "osp_invoice",
              "focus_export",
              "cost_explorer_month"
            ]
          },
          "usageLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceUsageLine"
            }
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "unverifiedReason": {
            "type": "string",
            "enum": [
              "no_purchase_order",
              "no_billing_connection",
              "debit_note",
              "payer_account_unclear",
              "no_po_first_invoice",
              "no_usage_figure"
            ]
          },
          "matchBasis": {
            "type": "string",
            "enum": [
              "purchase_order",
              "no_po_history"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "receiptCheckSkipped": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "small_invoice"
                ]
              },
              "at": {
                "type": "string"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceControlFinding"
                }
              }
            }
          },
          "receiptToleranceApplied": {
            "type": "object",
            "properties": {
              "over": {
                "type": "number",
                "format": "double"
              },
              "received": {
                "type": "number",
                "format": "double"
              },
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poLineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "over": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "at": {
                "type": "string"
              }
            }
          },
          "matchType": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "discrepancyReason": {
            "type": "string",
            "enum": [
              "amount",
              "currency",
              "controls",
              "no_po_variance"
            ]
          },
          "controlFindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceControlFinding"
            }
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/InvoicePaymentRecord"
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRemittance"
            }
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentHistoryEntry"
            }
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/InvoicePaymentProblem"
          },
          "receiptConfirmationRemindedAt": {
            "type": "string"
          },
          "exportAvailableFrom": {
            "type": "string"
          },
          "previousExportedAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "cloudConnectionId": {
            "type": "string"
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "sodExcludedKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "feedPayloadHash": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "heldBack": {
            "$ref": "#/components/schemas/InvoiceHeldBack"
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "rateWarnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRateWarning"
            }
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "remittanceCheck": {
            "$ref": "#/components/schemas/RemittanceCheck"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/BankDetailsConfirmation"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "viewerIsSupplierMember": {
            "type": "boolean"
          },
          "nextApproverReminderAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "RemoveInvoiceReplacementLinkResult": {
        "type": "object",
        "properties": {
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          },
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "settlement": {
            "$ref": "#/components/schemas/InvoiceSettlement"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          },
          "usageAmountSimulated": {
            "type": "boolean"
          },
          "usageSimulatedAfterDisconnect": {
            "type": "boolean"
          },
          "usageCurrency": {
            "type": "string"
          },
          "usageSource": {
            "type": "string",
            "enum": [
              "aws_invoice",
              "billing_export",
              "mca_invoice",
              "ea_balance",
              "usage_api_closed_month",
              "osp_invoice",
              "focus_export",
              "cost_explorer_month"
            ]
          },
          "usageLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceUsageLine"
            }
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "unverifiedReason": {
            "type": "string",
            "enum": [
              "no_purchase_order",
              "no_billing_connection",
              "debit_note",
              "payer_account_unclear",
              "no_po_first_invoice",
              "no_usage_figure"
            ]
          },
          "matchBasis": {
            "type": "string",
            "enum": [
              "purchase_order",
              "no_po_history"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "receiptCheckSkipped": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "small_invoice"
                ]
              },
              "at": {
                "type": "string"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceControlFinding"
                }
              }
            }
          },
          "receiptToleranceApplied": {
            "type": "object",
            "properties": {
              "over": {
                "type": "number",
                "format": "double"
              },
              "received": {
                "type": "number",
                "format": "double"
              },
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poLineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "over": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "at": {
                "type": "string"
              }
            }
          },
          "matchType": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "discrepancyReason": {
            "type": "string",
            "enum": [
              "amount",
              "currency",
              "controls",
              "no_po_variance"
            ]
          },
          "controlFindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceControlFinding"
            }
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/InvoicePaymentRecord"
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRemittance"
            }
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentHistoryEntry"
            }
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/InvoicePaymentProblem"
          },
          "receiptConfirmationRemindedAt": {
            "type": "string"
          },
          "exportAvailableFrom": {
            "type": "string"
          },
          "previousExportedAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "cloudConnectionId": {
            "type": "string"
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "sodExcludedKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "feedPayloadHash": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "invoice",
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "heldBack": {
            "$ref": "#/components/schemas/InvoiceHeldBack"
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "rateWarnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRateWarning"
            }
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "remittanceCheck": {
            "$ref": "#/components/schemas/RemittanceCheck"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/BankDetailsConfirmation"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "viewerIsSupplierMember": {
            "type": "boolean"
          },
          "nextApproverReminderAt": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "GetInvoiceBankAccountResult": {
        "type": "object",
        "properties": {
          "hold": {
            "type": "string",
            "enum": [
              "first_payment",
              "differs_from_file"
            ]
          },
          "account": {
            "$ref": "#/components/schemas/SupplierBankAccount"
          },
          "supplierKey": {
            "type": "string"
          }
        }
      },
      "RecordPaymentResult": {
        "type": "object",
        "properties": {
          "alreadyRecorded": {
            "type": "boolean"
          },
          "supplier": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "settlement": {
            "$ref": "#/components/schemas/InvoiceSettlement"
          },
          "approvalVersion": {
            "type": "number",
            "format": "double"
          },
          "approval": {
            "$ref": "#/components/schemas/ApprovalChain"
          },
          "supplierConnectionId": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "buyerOrgName": {
            "type": "string"
          },
          "buyerRegionName": {
            "type": "string"
          },
          "supplierRegionName": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineItem"
            }
          },
          "po": {
            "type": "string"
          },
          "poLineNo": {
            "type": "number",
            "format": "double"
          },
          "billsNoPoLine": {
            "type": "boolean"
          },
          "partyDetails": {
            "type": "object",
            "properties": {
              "supplier": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              },
              "buyer": {
                "$ref": "#/components/schemas/InvoicePartyDetails"
              }
            }
          },
          "usageAmount": {
            "type": "number",
            "format": "double"
          },
          "usageAmountSimulated": {
            "type": "boolean"
          },
          "usageSimulatedAfterDisconnect": {
            "type": "boolean"
          },
          "usageCurrency": {
            "type": "string"
          },
          "usageSource": {
            "type": "string",
            "enum": [
              "aws_invoice",
              "billing_export",
              "mca_invoice",
              "ea_balance",
              "usage_api_closed_month",
              "osp_invoice",
              "focus_export",
              "cost_explorer_month"
            ]
          },
          "usageLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceUsageLine"
            }
          },
          "tolerancePct": {
            "type": "number",
            "format": "double"
          },
          "matchStatus": {
            "type": "string",
            "enum": [
              "pending",
              "matched",
              "discrepancy",
              "unverified"
            ]
          },
          "unverifiedReason": {
            "type": "string",
            "enum": [
              "no_purchase_order",
              "no_billing_connection",
              "debit_note",
              "payer_account_unclear",
              "no_po_first_invoice",
              "no_usage_figure"
            ]
          },
          "matchBasis": {
            "type": "string",
            "enum": [
              "purchase_order",
              "no_po_history"
            ]
          },
          "noPoComparison": {
            "$ref": "#/components/schemas/NoPoComparison"
          },
          "paymentRoute": {
            "type": "string",
            "enum": [
              "pleaxy",
              "erp"
            ]
          },
          "receiptCheckSkipped": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": [
                  "small_invoice"
                ]
              },
              "at": {
                "type": "string"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvoiceControlFinding"
                }
              }
            }
          },
          "receiptToleranceApplied": {
            "type": "object",
            "properties": {
              "over": {
                "type": "number",
                "format": "double"
              },
              "received": {
                "type": "number",
                "format": "double"
              },
              "percent": {
                "type": "number",
                "format": "double"
              },
              "maxAmount": {
                "type": "number",
                "format": "double"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "poLineNo": {
                      "type": "number",
                      "format": "double"
                    },
                    "over": {
                      "type": "number",
                      "format": "double"
                    }
                  }
                }
              },
              "at": {
                "type": "string"
              }
            }
          },
          "matchType": {
            "type": "string",
            "enum": [
              "two_way",
              "three_way",
              "usage"
            ]
          },
          "discrepancyReason": {
            "type": "string",
            "enum": [
              "amount",
              "currency",
              "controls",
              "no_po_variance"
            ]
          },
          "controlFindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceControlFinding"
            }
          },
          "paid": {
            "type": "boolean"
          },
          "dueInDays": {
            "type": "number",
            "format": "double"
          },
          "dueDate": {
            "type": "string"
          },
          "paidAt": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/InvoicePaymentRecord"
          },
          "remittances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRemittance"
            }
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentHistoryEntry"
            }
          },
          "paymentProblem": {
            "$ref": "#/components/schemas/InvoicePaymentProblem"
          },
          "receiptConfirmationRemindedAt": {
            "type": "string"
          },
          "exportAvailableFrom": {
            "type": "string"
          },
          "previousExportedAt": {
            "type": "string"
          },
          "dueDateSource": {
            "type": "string",
            "enum": [
              "default",
              "stated"
            ]
          },
          "earlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "contractEarlyPayment": {
            "$ref": "#/components/schemas/InvoiceEarlyPayment"
          },
          "earlyPaymentCreditNoteId": {
            "type": "string"
          },
          "lastRemindedAt": {
            "type": "string"
          },
          "lastApproverRemindedAt": {
            "type": "string"
          },
          "rejection": {
            "$ref": "#/components/schemas/InvoiceRejection"
          },
          "replacesInvoiceId": {
            "type": "string"
          },
          "replacesInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replacedByInvoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possibleDuplicates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDuplicateRef"
            }
          },
          "duplicatesChecked": {
            "type": "boolean"
          },
          "hasLookupRows": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "po-flip",
              "direct",
              "feed",
              "cloud_sync"
            ]
          },
          "cloudConnectionId": {
            "type": "string"
          },
          "enteredBy": {
            "type": "string",
            "enum": [
              "buyer",
              "supplier"
            ]
          },
          "invoiceDate": {
            "type": "string"
          },
          "sodExcludedKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "submittedFormat": {
            "type": "string",
            "enum": [
              "json",
              "ubl",
              "cxml",
              "cii",
              "fatturapa",
              "facturae",
              "nfe",
              "nfse"
            ]
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceSummary"
          },
          "eInvoiceDetails": {
            "$ref": "#/components/schemas/InvoiceEInvoiceDetails"
          },
          "eInvoiceBuyerDownloadedAt": {
            "type": "string"
          },
          "issuedInBillingSoftware": {
            "type": "boolean"
          },
          "submittedBy": {
            "type": "string"
          },
          "feedPayloadHash": {
            "type": "string"
          },
          "externalInvoiceNumber": {
            "type": "string"
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceAdjustment"
            }
          },
          "taxAmount": {
            "type": "number",
            "format": "double"
          },
          "taxBreakdown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "withholdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceBreakdownEntry"
            }
          },
          "documentType": {
            "type": "string",
            "enum": [
              "debit_note"
            ]
          },
          "amendsInvoiceId": {
            "type": "string"
          },
          "amendsExternalInvoiceNumber": {
            "type": "string"
          },
          "debitNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "invoiceKind": {
            "type": "string",
            "enum": [
              "prepayment"
            ]
          },
          "deductions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceDeduction"
            }
          },
          "creditApplications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreditApplication"
            }
          },
          "heldBack": {
            "$ref": "#/components/schemas/InvoiceHeldBack"
          },
          "creditNoteIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "creditVersion": {
            "type": "number",
            "format": "double"
          },
          "paymentCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "taxCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceCurrencyAmount"
          },
          "rateWarnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceRateWarning"
            }
          },
          "remittanceInstructions": {
            "$ref": "#/components/schemas/RemittanceInstructions"
          },
          "remittanceCheck": {
            "$ref": "#/components/schemas/RemittanceCheck"
          },
          "bankDetailsConfirmation": {
            "$ref": "#/components/schemas/BankDetailsConfirmation"
          },
          "bankLane": {
            "type": "string"
          },
          "sourceDocument": {
            "$ref": "#/components/schemas/InvoiceSourceDocument"
          },
          "hasOriginalPdf": {
            "type": "boolean"
          },
          "baseCurrencyAmount": {
            "$ref": "#/components/schemas/InvoiceBaseCurrencyAmount"
          },
          "viewerIsSupplierMember": {
            "type": "boolean"
          },
          "nextApproverReminderAt": {
            "type": "string"
          },
          "replacement": {
            "$ref": "#/components/schemas/InvoiceReplacementCheck"
          },
          "uncreditedOriginals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UncreditedOriginal"
            }
          }
        },
        "required": [
          "id"
        ]
      },
      "RecordPaymentsResult": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "number",
                  "format": "double"
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "messageId": {
                  "type": "string"
                },
                "params": {
                  "$ref": "#/components/schemas/ErrorParams"
                },
                "invoiceId": {
                  "type": "string"
                },
                "outcome": {
                  "type": "string",
                  "enum": [
                    "refused",
                    "recorded",
                    "already_recorded"
                  ]
                }
              }
            }
          },
          "recorded": {
            "type": "number",
            "format": "double"
          },
          "alreadyRecorded": {
            "type": "number",
            "format": "double"
          },
          "refused": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RequestRemittanceUploadResult": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "uploadUrl": {
            "type": "string"
          },
          "maxBytes": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "GetRemittanceFileResult": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          }
        }
      },
      "GetSupplierScreeningResult": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "screening": {
            "$ref": "#/components/schemas/SupplierScreening"
          }
        }
      },
      "DeleteAiProviderResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "AddAiProviderSupplierResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "buyerOrgId": {
            "type": "string"
          },
          "buyerName": {
            "type": "string"
          },
          "supplierOrgId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "invitedAsName": {
            "type": "string"
          },
          "supplierContactEmail": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_invite",
              "invited",
              "in_progress",
              "submitted",
              "approved",
              "rejected"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "rfq"
            ]
          },
          "questionnaireRequested": {
            "type": "boolean"
          },
          "questionnaireTemplateId": {
            "type": "string"
          },
          "questionnaireTemplateVersion": {
            "type": "number",
            "format": "double"
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionnaireFieldDef"
            }
          },
          "responses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuestionnaireResponseItem"
            }
          },
          "createdAt": {
            "type": "string"
          },
          "invitedAt": {
            "type": "string"
          },
          "respondedAt": {
            "type": "string"
          },
          "reviewedAt": {
            "type": "string"
          },
          "reviewedBy": {
            "type": "string"
          },
          "rejectionReason": {
            "type": "string"
          },
          "cloudProvider": {
            "type": "string",
            "enum": [
              "aws",
              "gcp",
              "azure",
              "oci"
            ]
          },
          "aiProvider": {
            "type": "string",
            "enum": [
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom",
              "datadog",
              "twilio",
              "mongodb",
              "confluent",
              "vercel"
            ]
          },
          "billingCurrency": {
            "type": "string"
          },
          "paymentCurrency": {
            "type": "string"
          },
          "offPlatformInvoicesRecorded": {
            "type": "boolean"
          },
          "supplierRegion": {
            "$ref": "#/components/schemas/SupplierRegionRequest"
          },
          "acceptedRegionName": {
            "type": "string"
          },
          "acceptedRegionMatchesRequest": {
            "type": "boolean"
          },
          "invoiceFeedEnabled": {
            "type": "boolean"
          },
          "invoiceFeedUpdatedAt": {
            "type": "string"
          },
          "invoiceFeedUpdatedBy": {
            "type": "string"
          },
          "commentsMuted": {
            "type": "boolean"
          },
          "commentsMutedAt": {
            "type": "string"
          },
          "commentsMutedBy": {
            "type": "string"
          },
          "feedLastAttemptAt": {
            "type": "string"
          },
          "feedLastAcceptedAt": {
            "type": "string"
          },
          "feedAcceptedCount": {
            "type": "number",
            "format": "double"
          },
          "feedLastRefusedAt": {
            "type": "string"
          },
          "feedLastRefusedCode": {
            "type": "string"
          },
          "feedLastValidAt": {
            "type": "string"
          },
          "feedValidCount": {
            "type": "number",
            "format": "double"
          },
          "lateFeeTerms": {
            "$ref": "#/components/schemas/LateFeeTerms"
          },
          "lateFeeTermsUpdatedAt": {
            "type": "string"
          },
          "earlyPaymentStandingOffer": {
            "$ref": "#/components/schemas/EarlyPaymentStandingOffer"
          },
          "lateFeeTermsAttestedAt": {
            "type": "string"
          },
          "lateFeeTermsAttestationVersion": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "ListAiInvoicersItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "openai",
              "anthropic",
              "mistral",
              "cohere",
              "xai",
              "openrouter",
              "snowflake",
              "databricks",
              "coreweave",
              "lambda",
              "nebius",
              "crusoe",
              "cursor",
              "github",
              "microsoft",
              "slack",
              "zoom",
              "datadog",
              "twilio",
              "mongodb",
              "confluent",
              "vercel"
            ]
          },
          "name": {
            "type": "string"
          },
          "legalEntities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "region": {
                  "type": "string",
                  "enum": [
                    "default",
                    "eu",
                    "us"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                }
              }
            }
          },
          "billingCurrencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "billing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "invoice",
                "prepaid_credits"
              ]
            }
          },
          "senderDomains": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "credential": {
            "type": "string",
            "enum": [
              "none",
              "admin_key",
              "key_pair"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "seats",
              "usage",
              "direct",
              "data_platform",
              "host",
              "neocloud"
            ]
          },
          "shape": {
            "type": "string",
            "enum": [
              "seats",
              "usage",
              "capacity",
              "tokens",
              "credits"
            ]
          },
          "credentialCanChangeBilling": {
            "type": "boolean"
          },
          "credentialHasAdminRights": {
            "type": "boolean"
          },
          "contactHint": {
            "type": "string"
          },
          "connectable": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "GetBudgetStatusResult": {
        "type": "object",
        "properties": {
          "settings": {
            "$ref": "#/components/schemas/BudgetControlSettings"
          },
          "period": {
            "$ref": "#/components/schemas/BudgetPeriod"
          },
          "currency": {
            "type": "string"
          },
          "costCenters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BudgetStatus"
            }
          },
          "unassigned": {
            "$ref": "#/components/schemas/SpendFigures"
          },
          "unassignedByCurrency": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "committed": {
                  "type": "number",
                  "format": "double"
                },
                "actual": {
                  "type": "number",
                  "format": "double"
                },
                "pending": {
                  "type": "number",
                  "format": "double"
                },
                "unconverted": {
                  "type": "number",
                  "format": "double"
                },
                "currency": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ListCreditNotesResult": {
        "type": "object",
        "properties": {
          "creditNotes": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/SupplierCreditNoteView"
                },
                {
                  "$ref": "#/components/schemas/BuyerCreditNoteView"
                }
              ]
            }
          }
        }
      },
      "CreateCreditNoteResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/SupplierCreditNoteView"
          },
          {
            "$ref": "#/components/schemas/BuyerCreditNoteView"
          }
        ]
      },
      "GetCreditSettlementResult": {
        "type": "object",
        "properties": {
          "creditSettlement": {
            "type": "string",
            "enum": [
              "pleaxy",
              "accounting_system"
            ]
          },
          "chosen": {
            "type": "boolean"
          }
        }
      },
      "SetCreditSettlementResult": {
        "type": "object",
        "properties": {
          "creditSettlement": {
            "type": "string",
            "enum": [
              "pleaxy",
              "accounting_system"
            ]
          },
          "chosen": {
            "type": "boolean"
          }
        }
      },
      "GetCreditNoteResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/SupplierCreditNoteView"
          },
          {
            "$ref": "#/components/schemas/BuyerCreditNoteView"
          }
        ]
      },
      "ListAvailableCreditsResult": {
        "type": "object",
        "properties": {
          "amountDue": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string"
          },
          "credits": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "creditNoteId": {
                  "type": "string"
                },
                "externalCreditNoteNumber": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "other",
                    "returned_goods",
                    "price_adjustment",
                    "service_credit",
                    "rebate",
                    "early_payment_discount"
                  ]
                },
                "issueDate": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                },
                "remaining": {
                  "type": "number",
                  "format": "double"
                },
                "suggested": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "pending": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "creditNoteId": {
                  "type": "string"
                },
                "externalCreditNoteNumber": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "other",
                    "returned_goods",
                    "price_adjustment",
                    "service_credit",
                    "rebate",
                    "early_payment_discount"
                  ]
                },
                "amount": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "suggestedTotal": {
            "type": "number",
            "format": "double"
          },
          "locked": {
            "type": "string",
            "enum": [
              "rejected",
              "paid",
              "exported",
              "otherCurrency"
            ]
          },
          "creditSettlement": {
            "type": "string",
            "enum": [
              "pleaxy",
              "accounting_system"
            ]
          }
        }
      },
      "ApplyCreditsResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/InvoiceBuyerView"
          },
          {
            "$ref": "#/components/schemas/InvoiceSupplierView"
          }
        ]
      },
      "RemoveCreditApplicationResult": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/InvoiceBuyerView"
          },
          {
            "$ref": "#/components/schemas/InvoiceSupplierView"
          }
        ]
      },
      "ApplyConfirmationChangesResult": {
        "type": "object",
        "properties": {
          "purchaseOrder": {
            "$ref": "#/components/schemas/PurchaseOrder"
          },
          "confirmation": {
            "$ref": "#/components/schemas/OrderConfirmation"
          }
        }
      },
      "ListWebhooksResult": {
        "type": "object",
        "properties": {
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpointView"
            }
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "purchase_order.issued",
                "purchase_order.changed",
                "purchase_order.canceled",
                "purchase_order.rejected",
                "purchase_order.updated",
                "purchase_order.confirmed",
                "purchase_order.shipped",
                "invoice.received",
                "invoice.approved",
                "invoice.rejected",
                "invoice.paid",
                "invoice.payment_withdrawn",
                "invoice.payment",
                "invoice.remittance_sent",
                "invoice.credit_applied",
                "invoice.updated",
                "credit_note.received",
                "credit_note.accepted",
                "credit_note.rejected"
              ]
            }
          }
        }
      },
      "CreateWebhookResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "purchase_order.issued",
                "purchase_order.changed",
                "purchase_order.canceled",
                "purchase_order.rejected",
                "purchase_order.updated",
                "purchase_order.confirmed",
                "purchase_order.shipped",
                "invoice.received",
                "invoice.approved",
                "invoice.rejected",
                "invoice.paid",
                "invoice.payment_withdrawn",
                "invoice.payment",
                "invoice.remittance_sent",
                "invoice.credit_applied",
                "invoice.updated",
                "credit_note.received",
                "credit_note.accepted",
                "credit_note.rejected"
              ]
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "lastAttemptAt": {
            "type": "string"
          },
          "lastStatus": {
            "type": "number",
            "format": "double"
          },
          "lastErrorCode": {
            "type": "string",
            "enum": [
              "failed",
              "http_status",
              "blocked_address",
              "unreachable",
              "timeout",
              "redirect",
              "too_large",
              "endpoint_off"
            ]
          },
          "lastSuccessAt": {
            "type": "string"
          },
          "failedDeliveries": {
            "type": "number",
            "format": "double"
          },
          "secretHint": {
            "type": "string"
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "RotateWebhookSecretResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "purchase_order.issued",
                "purchase_order.changed",
                "purchase_order.canceled",
                "purchase_order.rejected",
                "purchase_order.updated",
                "purchase_order.confirmed",
                "purchase_order.shipped",
                "invoice.received",
                "invoice.approved",
                "invoice.rejected",
                "invoice.paid",
                "invoice.payment_withdrawn",
                "invoice.payment",
                "invoice.remittance_sent",
                "invoice.credit_applied",
                "invoice.updated",
                "credit_note.received",
                "credit_note.accepted",
                "credit_note.rejected"
              ]
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "lastAttemptAt": {
            "type": "string"
          },
          "lastStatus": {
            "type": "number",
            "format": "double"
          },
          "lastErrorCode": {
            "type": "string",
            "enum": [
              "failed",
              "http_status",
              "blocked_address",
              "unreachable",
              "timeout",
              "redirect",
              "too_large",
              "endpoint_off"
            ]
          },
          "lastSuccessAt": {
            "type": "string"
          },
          "failedDeliveries": {
            "type": "number",
            "format": "double"
          },
          "secretHint": {
            "type": "string"
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "TestWebhookResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "status": {
            "type": "number",
            "format": "double"
          },
          "errorCode": {
            "type": "string",
            "enum": [
              "failed",
              "http_status",
              "blocked_address",
              "unreachable",
              "timeout",
              "redirect",
              "too_large",
              "endpoint_off"
            ]
          },
          "durationMs": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ListWebhookDeliveriesResult": {
        "type": "object",
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDelivery"
            }
          }
        }
      },
      "RequestPurchaseRequestFileUploadResult": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "uploadUrl": {
            "type": "string"
          },
          "maxBytes": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "GetPurchaseRequestFileResult": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          }
        }
      },
      "ConvertPurchaseRequestResult": {
        "type": "object",
        "properties": {
          "request": {
            "$ref": "#/components/schemas/PurchaseRequest"
          },
          "purchaseOrder": {
            "$ref": "#/components/schemas/PurchaseOrder"
          }
        }
      },
      "ListFocusSourcesResult": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FocusSourceView"
            }
          }
        }
      },
      "CreateFocusUploadResult": {
        "type": "object",
        "properties": {
          "sourceId": {
            "type": "string"
          },
          "uploadId": {
            "type": "string"
          },
          "uploadUrl": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "maxBytes": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "DeleteFocusSourceResult": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "boolean"
          }
        }
      },
      "GetFocusSourcePeriodResult": {
        "type": "object",
        "properties": {
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FocusInvoiceTotal"
            }
          },
          "costCenters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FocusCostCenterTotal"
            }
          },
          "sourceId": {
            "type": "string"
          },
          "period": {
            "type": "string"
          },
          "rows": {
            "type": "number",
            "format": "double"
          },
          "totals": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "object",
              "properties": {
                "billed": {
                  "type": "number",
                  "format": "double"
                },
                "effective": {
                  "type": "number",
                  "format": "double"
                }
              }
            }
          },
          "issuers": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "object",
              "properties": {},
              "additionalProperties": {
                "type": "number",
                "format": "double"
              }
            }
          },
          "version": {
            "type": "string",
            "enum": [
              "1.2",
              "1.4",
              "1.0",
              "1.1",
              "1.3"
            ]
          },
          "asOf": {
            "type": "string"
          }
        }
      },
      "ListAiSpendLimitsResult": {
        "type": "object",
        "properties": {
          "credentials": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiLimitCredential"
            }
          },
          "limits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSpendLimit"
            }
          },
          "awsSetup": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoicerId": {
                  "type": "string"
                },
                "pleaxyAccountId": {
                  "type": "string"
                },
                "externalId": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RemoveAiLimitCredentialResult": {
        "type": "object",
        "properties": {
          "invoicerId": {
            "type": "string"
          }
        }
      },
      "GetInvoiceActivityResult": {
        "type": "object",
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceActivityEntry"
            }
          }
        }
      },
      "ListInvoiceCommentsResult": {
        "type": "object",
        "properties": {
          "sharing": {
            "type": "string"
          },
          "comments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentCommentView"
            }
          },
          "awaitingReply": {
            "type": "boolean"
          },
          "meetingRequests": {
            "type": "string"
          }
        }
      },
      "ListPurchaseOrderCommentsResult": {
        "type": "object",
        "properties": {
          "sharing": {
            "type": "string"
          },
          "comments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentCommentView"
            }
          },
          "awaitingReply": {
            "type": "boolean"
          },
          "meetingRequests": {
            "type": "string"
          }
        }
      },
      "StartStripePaymentResult": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "checkout_open",
              "processing",
              "succeeded"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "apiKey": []
    },
    {
      "session": []
    }
  ]
}
