{
    "openapi": "3.1.0",
    "info": {
        "title": "Reevio Public API",
        "version": "1.0.0",
        "summary": "Read and write a Reevio workspace from another system.",
        "description": "- Authenticate with a bearer token issued by a workspace administrator in\n  Administration → API Tokens. The token acts as its user; access is the user's role\n  narrowed by the token's scopes. Each operation names its scope in `x-scope`.\n- Ids are opaque ULID strings. Decimals (money, quantities, rates, percents) are strings.\n  Calendar dates (`*_on`) are `YYYY-MM-DD` on the workspace calendar; instants (`*_at`)\n  are ISO-8601 UTC.\n- Within v1 changes are additive only. Ignore fields you do not recognise.\n- Every `POST` accepts `Idempotency-Key`. Every error has a stable `code`.\n"
    },
    "servers": [
        {
            "url": "https://{workspace}/api/public/v1",
            "variables": {
                "workspace": {
                    "default": "your-workspace.reevio.app",
                    "description": "The address you open Reevio at. A token only works on its own workspace's address."
                }
            }
        }
    ],
    "security": [
        {
            "bearerToken": []
        }
    ],
    "tags": [
        {
            "name": "Discovery",
            "description": "What the calling token is and which workspace it belongs to."
        },
        {
            "name": "Reference data",
            "description": "Branches, warehouses, currencies, tax rates and pricing structures other records point at."
        },
        {
            "name": "Catalog",
            "description": "Products and product categories."
        },
        {
            "name": "Stock",
            "description": "Live on-hand, reserved and available quantities."
        },
        {
            "name": "Customers",
            "description": "Customers and their credit position."
        },
        {
            "name": "Vendors",
            "description": "Suppliers."
        },
        {
            "name": "Quotations",
            "description": "Sales quotations."
        },
        {
            "name": "Sales orders",
            "description": "Sales orders. Drafts can be created, replaced and moved to Trash."
        },
        {
            "name": "Delivery notes",
            "description": "Deliveries against sales orders. Quantities only. Drafted from an order's reserved stock, then issued."
        },
        {
            "name": "Invoices",
            "description": "Sales invoices."
        },
        {
            "name": "Credit notes",
            "description": "Sales credit notes."
        },
        {
            "name": "Customer payments",
            "description": "Money received from customers and how it is applied."
        },
        {
            "name": "Treasury",
            "description": "Cash locations and bank accounts a payment can be recorded into."
        },
        {
            "name": "Purchasing",
            "description": "Purchase orders, vendor invoices and vendor payments."
        }
    ],
    "paths": {
        "/token": {
            "get": {
                "tags": [
                    "Discovery"
                ],
                "operationId": "getToken",
                "summary": "Describe the calling token, its user and the workspace",
                "description": "No scope needed. Call it first to learn the functional currency, timezone and today's business date.",
                "x-scope": null,
                "responses": {
                    "200": {
                        "description": "The token.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/TokenInfo"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    }
                }
            }
        },
        "/branches": {
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "listBranches",
                "summary": "List branches",
                "description": "Branches the token's user can see. A user limited to some branches sees only those.\n",
                "x-scope": "administration.branches.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/BranchList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/branches/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "getBranch",
                "summary": "Retrieve a branch",
                "description": "One branch by id.\n",
                "x-scope": "administration.branches.read",
                "responses": {
                    "200": {
                        "description": "The branch.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Branch"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/warehouses": {
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "listWarehouses",
                "summary": "List warehouses",
                "description": "Warehouses your workspace marks \"Hide from the API\" are never returned, here or\nanywhere else, and neither are warehouses the token's user cannot open in Reevio.\n",
                "x-scope": "inventory.warehouses.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/WarehouseList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/warehouses/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "getWarehouse",
                "summary": "Retrieve a warehouse",
                "description": "One warehouse by id. A warehouse hidden from the API, or one the user cannot open, is a `404`.\n",
                "x-scope": "inventory.warehouses.read",
                "responses": {
                    "200": {
                        "description": "The warehouse.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Warehouse"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/currencies": {
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "listCurrencies",
                "summary": "List enabled currencies with exchange rates",
                "description": "The functional currency first, then every currency the workspace transacts in, each with the accounting rate on `on` (default: today) and the current selling rate. Not paged.\n",
                "x-scope": "accounting.exchange_rates.read",
                "parameters": [
                    {
                        "name": "on",
                        "in": "query",
                        "description": "Business date for the accounting rate. Defaults to today on the workspace calendar.",
                        "schema": {
                            "$ref": "#/components/schemas/Date"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Every currency the workspace can transact in. Not paged.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Currency"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/tax-rates": {
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "listTaxRates",
                "summary": "List tax rates",
                "description": "Every tax rate, inactive ones included (`is_active: false`).\n",
                "x-scope": "accounting.tax_rates.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/TaxRateList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/price-tiers": {
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "listPriceTiers",
                "summary": "List price tiers",
                "description": "The price tiers customers can be assigned to.\n",
                "x-scope": "catalog.price_tiers.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/PriceTierList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/price-lists": {
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "listPriceLists",
                "summary": "List price lists (headers only)",
                "description": "Price list headers: name, currency, priority and validity dates. The prices themselves are not exposed yet.\n",
                "x-scope": "sales.price_lists.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/PriceListList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customer-categories": {
            "get": {
                "tags": [
                    "Reference data"
                ],
                "operationId": "listCustomerCategories",
                "summary": "List customer categories",
                "description": "The categories customers can be grouped in.\n",
                "x-scope": "sales.customer_categories.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomerCategoryList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/products": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "operationId": "listProducts",
                "summary": "List products",
                "description": "`cost` is present only when the token also holds `catalog.products.view_cost`.",
                "x-scope": "catalog.products.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Exact SKU or any barcode, or the start of the name.",
                        "schema": {
                            "type": "string",
                            "maxLength": 255
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "$ref": "#/components/schemas/ProductStatus"
                        },
                        "description": "Only records with this status."
                    },
                    {
                        "name": "category_id",
                        "in": "query",
                        "schema": {
                            "$ref": "#/components/schemas/Id"
                        },
                        "description": "Only products in this category, by id."
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Catalog"
                ],
                "operationId": "createProduct",
                "summary": "Create a product",
                "description": "Creates a product. The SKU is generated when the workspace numbers SKUs automatically, and required when it numbers them by hand.\n",
                "x-scope": "catalog.products.create",
                "x-scope-conditional": {
                    "cost": "catalog.products.update_cost"
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ProductCreate"
                            },
                            "example": {
                                "name": "Black tea 500 g",
                                "sku": "TEA-500",
                                "barcodes": [
                                    "6260000000017"
                                ],
                                "price": "4500.00"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/ProductCreated"
                    },
                    "200": {
                        "$ref": "#/components/responses/ProductReplayed"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/products/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Catalog"
                ],
                "operationId": "getProduct",
                "summary": "Retrieve a product",
                "description": "One product by id, with its barcodes, categories, prices and image links.\n",
                "x-scope": "catalog.products.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Catalog"
                ],
                "operationId": "updateProduct",
                "summary": "Update a product",
                "description": "Only the fields you send change; send `null` to clear one. `barcodes` and\n`category_ids`, when sent, replace the whole list. Writing `cost` needs the\n`catalog.products.update_cost` scope.\n",
                "x-scope": "catalog.products.update",
                "x-scope-conditional": {
                    "cost": "catalog.products.update_cost"
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ProductUpdate"
                            },
                            "example": {
                                "price": "4750.00",
                                "description": null
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/products/{id}/images/{index}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                },
                {
                    "name": "index",
                    "in": "path",
                    "required": true,
                    "description": "Zero-based position in the product's `images` list. Not an id.",
                    "schema": {
                        "type": "integer",
                        "minimum": 0
                    }
                }
            ],
            "get": {
                "tags": [
                    "Catalog"
                ],
                "operationId": "getProductImage",
                "summary": "Download a product image",
                "description": "Prefer the `url_small` / `url_large` embedded in the product over building this path.",
                "x-scope": "catalog.products.read",
                "parameters": [
                    {
                        "name": "variant",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "small",
                                "large"
                            ],
                            "default": "large"
                        },
                        "description": "Image size: `small` or `large`."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The image bytes.",
                        "content": {
                            "image/jpeg": {},
                            "image/png": {},
                            "image/webp": {}
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/product-categories": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "operationId": "listProductCategories",
                "summary": "List product categories",
                "description": "Product categories as a tree: each names its `parent`. Filter with `parent_id`, or `root` for the top level.\n",
                "x-scope": "catalog.categories.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "name": "parent_id",
                        "in": "query",
                        "description": "Only direct children of this category. Use `parent_id=root` for top-level categories.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductCategoryList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/product-categories/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Catalog"
                ],
                "operationId": "getProductCategory",
                "summary": "Retrieve a product category",
                "description": "One category by id.\n",
                "x-scope": "catalog.categories.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductCategoryOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/stock-levels": {
            "get": {
                "tags": [
                    "Stock"
                ],
                "operationId": "listStockLevels",
                "summary": "Current stock per product and warehouse",
                "description": "A live snapshot, one row per product × warehouse with stock or holds. There is no\n`updated_since`: stock holds change and expire without touching any row a sync\ncould watch. Poll, filtered by the products you care about.\n\n`available` = `on_hand` − `reserved`, floored at zero, counted only in warehouses\nthat allow sales reservations. A warehouse excluded from available stock shows its\n`on_hand` with `available` `\"0\"` and `is_counted_as_available: false`.\n",
                "x-scope": "inventory.stock_levels.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "name": "product_id",
                        "in": "query",
                        "description": "Up to 100 product ids, comma-separated.",
                        "style": "form",
                        "explode": false,
                        "schema": {
                            "type": "array",
                            "maxItems": 100,
                            "items": {
                                "$ref": "#/components/schemas/Id"
                            }
                        }
                    },
                    {
                        "name": "sku",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Only this SKU."
                    },
                    {
                        "name": "warehouse_id",
                        "in": "query",
                        "schema": {
                            "$ref": "#/components/schemas/Id"
                        },
                        "description": "Only this warehouse, by id."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Stock rows.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data",
                                        "meta"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/StockLevel"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/ListMeta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customers": {
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "listCustomers",
                "summary": "List customers",
                "description": "Customers the token's user can see. `search` matches a code, phone or email exactly, or the start of a name.\n",
                "x-scope": "sales.customers.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Exact code, phone (punctuation ignored) or email, or the start of the name.",
                        "schema": {
                            "type": "string",
                            "maxLength": 255
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "active",
                                "inactive"
                            ]
                        },
                        "description": "Only records with this status."
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomerList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Customers"
                ],
                "operationId": "createCustomer",
                "summary": "Create a customer",
                "description": "Phone, email and code are checked against every customer and contact in the workspace.\nA match returns `422 customer_already_exists` with the customer to reuse, or\n`customer_identifiers_conflict` when the fields belong to different customers.\n",
                "x-scope": "sales.customers.create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CustomerCreate"
                            },
                            "example": {
                                "name": "Acme Trading",
                                "phone": "+964 770 123 4567",
                                "email": "ops@acme.example",
                                "country_code": "IQ",
                                "city_name": "Baghdad"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/CustomerCreated"
                    },
                    "200": {
                        "$ref": "#/components/responses/CustomerReplayed"
                    },
                    "422": {
                        "description": "Validation failed, or the customer already exists.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ValidationError"
                                        },
                                        {
                                            "$ref": "#/components/schemas/CustomerDuplicateError"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customers/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "getCustomer",
                "summary": "Retrieve a customer",
                "description": "One customer by id.\n",
                "x-scope": "sales.customers.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomerOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Customers"
                ],
                "operationId": "updateCustomer",
                "summary": "Update a customer",
                "description": "Only the fields you send change; send `null` to clear one. The `code` cannot change\n(`422 field_immutable`). Send country and city together. Credit settings cannot be\nchanged through the API.\n",
                "x-scope": "sales.customers.update",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CustomerUpdate"
                            },
                            "example": {
                                "email": "orders@acme.example",
                                "notes": null
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomerOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customers/{id}/balance": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "getCustomerBalance",
                "summary": "A customer's receivable and credit position",
                "description": "What the customer owes and how credit control sees them: the same figures the Issue button checks.\n",
                "x-scope": "sales.credit_details",
                "responses": {
                    "200": {
                        "description": "The position, in the functional currency.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/CustomerBalance"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customers/{id}/statement": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Customers"
                ],
                "operationId": "getCustomerStatement",
                "summary": "A customer's statement",
                "description": "The customer's account in one currency, as Accounting → Customer Statements and the\nprinted statement show it: every posted invoice, credit note, payment, reversal and\nopening balance on the customer's receivable, oldest first, with a running balance.\nApplying an advance or a credit note to an invoice only moves money between the\ncustomer's own balances, so it is left out, as on the page.\n\nWithout `starts_on` the statement starts at the customer's first entry. The token's\nuser sees the entries of the branches they can open; `branch_id` narrows to one of\nthem. A customer with entries in several currencies has a statement per currency:\n`currencies` lists them and `currency_code` picks one. By default it is the\nfunctional currency when the customer has entries in it.\n",
                "x-scope": "accounting.receivables_reports.read",
                "parameters": [
                    {
                        "name": "starts_on",
                        "in": "query",
                        "description": "First day of the period, on the workspace calendar. Entries before it make up `opening_balance`.",
                        "schema": {
                            "$ref": "#/components/schemas/Date"
                        }
                    },
                    {
                        "name": "ends_on",
                        "in": "query",
                        "description": "Last day of the period, not before `starts_on`. Without it, everything posted so far.",
                        "schema": {
                            "$ref": "#/components/schemas/Date"
                        }
                    },
                    {
                        "name": "currency_code",
                        "in": "query",
                        "description": "The statement's currency, by ISO code.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The statement.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/CustomerStatement"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/vendors": {
            "get": {
                "tags": [
                    "Vendors"
                ],
                "operationId": "listVendors",
                "summary": "List vendors",
                "description": "Vendors. `search` matches a code, phone or email exactly, or the start of a name.\n",
                "x-scope": "procurement.vendors.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Exact code, phone or email, or the start of the name.",
                        "schema": {
                            "type": "string",
                            "maxLength": 255
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/VendorList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/vendors/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Vendors"
                ],
                "operationId": "getVendor",
                "summary": "Retrieve a vendor",
                "description": "One vendor by id.\n",
                "x-scope": "procurement.vendors.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/VendorOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/quotations": {
            "get": {
                "tags": [
                    "Quotations"
                ],
                "operationId": "listQuotations",
                "summary": "List quotations",
                "description": "Quotation headers, without lines; retrieve one for its lines. Filter by date, status, customer or branch.\n",
                "x-scope": "sales.quotations.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/CustomerIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/QuotationList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/quotations/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Quotations"
                ],
                "operationId": "getQuotation",
                "summary": "Retrieve a quotation",
                "description": "One quotation by id, with its lines.\n",
                "x-scope": "sales.quotations.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/QuotationOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/sales-orders": {
            "get": {
                "tags": [
                    "Sales orders"
                ],
                "operationId": "listSalesOrders",
                "summary": "List sales orders (headers, no lines)",
                "description": "Sales order headers, without lines; retrieve one for its lines. Filter by date, status, customer or branch.\n",
                "x-scope": "sales.orders.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/CustomerIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/SalesOrderList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Sales orders"
                ],
                "operationId": "createSalesOrder",
                "summary": "Create a draft sales order",
                "description": "Prices are optional and resolve like the sales screen (price tier, price list,\nproduct price). Send `price` and `discounted_price` to set them; selling below the\nresolved price needs the role's below-price permission. One product on more than one\nline needs `accept_duplicate_products`.\n\n**From a quotation:** send `quotation_id` (also needs `sales.quotations.convert`).\nThe order takes the quotation's customer, branch, currency, rate and pricing\nmoment, and, unless you send `lines`, its lines at the quotation's prices; its\nstock holds move to the order. The quotation turns `converted` when the order is\nissued. `409 invalid_state` when the quotation is not issued or already has a live\norder (`details.sales_order` names it).\n",
                "x-scope": "sales.orders.create",
                "x-scope-conditional": {
                    "quotation_id": "sales.quotations.convert"
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SalesOrderInput"
                            },
                            "example": {
                                "customer_id": "01K2ZQ7M4X8N6P3R9T5V7W1Y2A",
                                "delivery_on": "2026-11-05",
                                "notes": "Website order 8842",
                                "lines": [
                                    {
                                        "sku": "TEA-500",
                                        "quantity": "2"
                                    },
                                    {
                                        "barcode": "6260000000024",
                                        "quantity": "1",
                                        "price": "4500.00",
                                        "discounted_price": "4200.00"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/SalesOrderCreated"
                    },
                    "200": {
                        "$ref": "#/components/responses/SalesOrderReplayed"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/sales-orders/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Sales orders"
                ],
                "operationId": "getSalesOrder",
                "summary": "Retrieve a sales order with lines",
                "description": "One sales order by id, with its lines and what has been delivered and invoiced on each.\n",
                "x-scope": "sales.orders.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/SalesOrderOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "put": {
                "tags": [
                    "Sales orders"
                ],
                "operationId": "replaceSalesOrder",
                "summary": "Replace a draft sales order",
                "description": "Replaces the whole draft, lines included: lines you leave out are removed.\n`409 invalid_state` once the order is issued (`details.status`, `details.number`) or\nat a workflow step that does not allow editing; `409 record_locked` while someone\nelse has it open.\n",
                "x-scope": "sales.orders.update",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SalesOrderInput"
                            },
                            "example": {
                                "customer_id": "01K2ZQ7M4X8N6P3R9T5V7W1Y2A",
                                "delivery_on": "2026-11-05",
                                "lines": [
                                    {
                                        "sku": "TEA-500",
                                        "quantity": "3"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/SalesOrderOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Sales orders"
                ],
                "operationId": "trashSalesOrder",
                "summary": "Move a draft sales order to Trash",
                "description": "Only a draft that never had a number can move to Trash. An order that was ever issued\nkeeps its number and is canceled in Reevio instead. Otherwise `409 invalid_state`,\nwith `details.reason` `numbered` or `workflow_step` (the order's workflow step does\nnot allow it); `409 record_locked` while someone else has it open.\n",
                "x-scope": "sales.orders.trash",
                "responses": {
                    "204": {
                        "description": "Moved to Trash; its stock, quotation and Awaiting Supply holds released."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/sales-orders/{id}/issue": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "post": {
                "tags": [
                    "Sales orders"
                ],
                "operationId": "issueSalesOrder",
                "summary": "Issue a sales order",
                "description": "Runs what the Issue button runs: quantity steps and price floors, the stock check\nfor confirmed lines, credit control, sale limits, then the number, reservations,\nbackorders and supply status. When the workspace auto-drafts delivery notes, one\nis drafted. Prices and rate are the draft's own; issuing never re-prices.\n\nRefusals are `409`, and nothing changes: `credit_warning` (resend with\n`confirm_credit_warning`), `credit_limit_exceeded` (resend with `credit_override`\nand a reason; needs `sales.credit_override`), `sale_limit_exceeded` (resend with\n`sale_limit_override` and a reason; needs `sales.sale_limit_override`),\n`stock_unavailable` (change confirmed lines to backorder, or wait),\n`workflow_blocked`, `record_locked`, or `invalid_state` (not a draft, or\nincomplete). `details.violations` lists what credit control or the sale limits found.\n",
                "x-scope": "sales.orders.issue",
                "x-scope-conditional": {
                    "credit_override": "sales.credit_override",
                    "sale_limit_override": "sales.sale_limit_override"
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/IssueOptions"
                            },
                            "example": {
                                "confirm_credit_warning": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/SalesOrderOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/sales-orders/{id}/cancel": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "post": {
                "tags": [
                    "Sales orders"
                ],
                "operationId": "cancelSalesOrder",
                "summary": "Cancel a sales order",
                "description": "Cancels an issued order, or a draft that was issued once and reverted; its stock\nholds and Awaiting Supply items are released and its number stays used.\n`409 invalid_state` for any other order or while it has active delivery notes or\ninvoices; `409 workflow_blocked` when the workspace's workflow does not let this\nuser cancel at the order's step.\n",
                "x-scope": "sales.orders.cancel",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/SalesOrderOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/delivery-notes": {
            "get": {
                "tags": [
                    "Delivery notes"
                ],
                "operationId": "listDeliveryNotes",
                "summary": "List delivery notes",
                "description": "Delivery note headers, without lines. Delivery notes carry quantities, not money.\n",
                "x-scope": "sales.delivery_notes.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/CustomerIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/DeliveryNoteList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Delivery notes"
                ],
                "operationId": "createDeliveryNote",
                "summary": "Draft a delivery note for a sales order",
                "description": "Drafts the delivery note for an issued sales order from the stock reserved for it,\nas Create Delivery Note on the sales orders list does: one line per order line and\nwarehouse holding its reservation, up to what the line still owes. Lines come only\nfrom warehouses the token's user can ship from and the API can see. Quantities,\nwarehouses and lots are not sent; to change them, edit the draft in Reevio.\n\nRefusals are `409`: `invalid_state` when the order is not issued, already has a\ndraft delivery note (`details.delivery_note`; issue that one), or was delivered and\nthe workspace does not allow partial deliveries; `stock_unavailable` when nothing\non the order is reserved yet; `workflow_blocked` when the workspace's workflow does\nnot let this user deliver the order at its step.\n",
                "x-scope": "sales.delivery_notes.create",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DeliveryNoteInput"
                            },
                            "example": {
                                "sales_order_id": "01K3C4D5E6F7G8H9J0K1M2N3P4"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/DeliveryNoteCreated"
                    },
                    "200": {
                        "$ref": "#/components/responses/DeliveryNoteReplayed"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/delivery-notes/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Delivery notes"
                ],
                "operationId": "getDeliveryNote",
                "summary": "Retrieve a delivery note",
                "description": "One delivery note by id, with its lines and the warehouse each ships from.\n",
                "x-scope": "sales.delivery_notes.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/DeliveryNoteOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Delivery notes"
                ],
                "operationId": "trashDeliveryNote",
                "summary": "Move a draft delivery note to Trash",
                "description": "Drafts only; an issued delivery note is canceled instead. The order can then be\ndrafted again. `409 invalid_state` for any other note, or when the note's workflow\nstep does not allow it.\n",
                "x-scope": "sales.delivery_notes.trash",
                "responses": {
                    "204": {
                        "description": "Moved to Trash."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/delivery-notes/{id}/issue": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "post": {
                "tags": [
                    "Delivery notes"
                ],
                "operationId": "issueDeliveryNote",
                "summary": "Issue a delivery note",
                "description": "Runs what the Issue button runs: every line is checked against its order line and\nwhat it still owes, the note is numbered, the order's reservations are consumed and\nthe stock leaves each line's warehouse. A line without a lot takes Reevio's own lot\nchoice. The order's supply status follows, and when the workspace drafts invoices\nfrom delivery notes, the invoice draft is made; otherwise bill the order with\n`POST /invoices` and its `sales_order_id`.\n\nRefusals are `409`, and nothing changes: `invalid_state` (not a draft, or a line\nships from a warehouse hidden from the API: issue that one in Reevio),\n`stock_unavailable` (the stock is no longer there), `workflow_blocked`. A line that\nno longer fits its order, for example because more was delivered meanwhile, is\n`422 validation_failed` on `lines.N.*`.\n",
                "x-scope": "sales.delivery_notes.issue",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/DeliveryNoteOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/delivery-notes/{id}/cancel": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "post": {
                "tags": [
                    "Delivery notes"
                ],
                "operationId": "cancelDeliveryNote",
                "summary": "Cancel a delivery note",
                "description": "Cancels an issued delivery note: the stock returns to the warehouses it left, the\norder's reservations are restored and the order owes those quantities again. The\nnumber stays used. `409 invalid_state` for any other note, while the order has an\nactive invoice (credit it first), or when a line is in a warehouse hidden from the\nAPI; `409 workflow_blocked` when the workspace's workflow does not allow it.\n",
                "x-scope": "sales.delivery_notes.cancel",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/DeliveryNoteOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/invoices": {
            "get": {
                "tags": [
                    "Invoices"
                ],
                "operationId": "listInvoices",
                "summary": "List invoices (headers, no lines)",
                "description": "Invoice headers, without lines; retrieve one for its lines. `is_open=true` lists the\ninvoices still owing money; `due_to` lists the open invoices falling due by that date.\n",
                "x-scope": "sales.invoices.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/CustomerIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    },
                    {
                        "name": "due_to",
                        "in": "query",
                        "description": "Only invoices with a balance due on or before this date.",
                        "schema": {
                            "$ref": "#/components/schemas/Date"
                        }
                    },
                    {
                        "name": "is_open",
                        "in": "query",
                        "description": "`true`: issued invoices still owing money, a `balance` above zero after payments\nand the credit notes raised against them. `false`: issued invoices with nothing\nleft to pay (paid, credited, or of zero value). Drafts and canceled invoices are\nneither. Credit the customer holds but has not applied to an invoice does not\nlower its balance; `GET /customers/{id}/balance` nets it.\n",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/InvoiceList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Invoices"
                ],
                "operationId": "createInvoice",
                "summary": "Create a draft invoice",
                "description": "**For a sales order:** send `sales_order_id` (also needs `sales.orders.convert`).\nThe draft bills the issued order's lines at their ordered quantities and the\norder's prices, with its shipping charge, for its customer, branch and currency;\nsend no `lines`. One active invoice per order: `409 invalid_state` with\n`details.invoice` when it has one. An order that sells stock needs an issued\ndelivery note first (`409 invalid_state`).\n\n**Direct invoice:** send `customer_id` and `lines`, priced like a sales order\ndraft. On issue Reevio creates an issued order and delivery note and moves the\nstock. Never use a direct invoice to re-bill a credited invoice: that moves stock\ntwice. Re-bill from the order instead.\n",
                "x-scope": "sales.invoices.create",
                "x-scope-conditional": {
                    "sales_order_id": "sales.orders.convert"
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/InvoiceInput"
                            },
                            "example": {
                                "sales_order_id": "01K3C4D5E6F7G8H9J0K1M2N3P4",
                                "issued_on": "2026-10-31",
                                "due_on": "2026-11-30"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/InvoiceCreated"
                    },
                    "200": {
                        "$ref": "#/components/responses/InvoiceReplayed"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/invoices/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Invoices"
                ],
                "operationId": "getInvoice",
                "summary": "Retrieve an invoice with lines",
                "description": "One invoice by id, with its lines.\n",
                "x-scope": "sales.invoices.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/InvoiceOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "put": {
                "tags": [
                    "Invoices"
                ],
                "operationId": "replaceInvoice",
                "summary": "Replace a draft invoice",
                "description": "A direct draft is replaced whole, lines included; its branch cannot change. A\nsales order's draft is rebuilt from the order with the dates, notes and\nsalesperson you send; send no `lines` and no `sales_order_id`.\n`409 invalid_state` once issued or at a workflow step that does not allow\nediting; `409 record_locked` while someone else has it open.\n",
                "x-scope": "sales.invoices.update",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/InvoiceInput"
                            },
                            "example": {
                                "customer_id": "01K2ZQ7M4X8N6P3R9T5V7W1Y2A",
                                "due_on": "2026-11-30",
                                "lines": [
                                    {
                                        "sku": "TEA-500",
                                        "quantity": "2"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/InvoiceOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Invoices"
                ],
                "operationId": "trashInvoice",
                "summary": "Move a draft invoice to Trash",
                "description": "Drafts never posted, paid or journaled only; its stock hold is released. An\nissued invoice is corrected with a credit note in Reevio. `409 invalid_state`\notherwise or at a workflow step that does not allow it; `409 record_locked`\nwhile someone else has it open.\n",
                "x-scope": "sales.invoices.trash",
                "responses": {
                    "204": {
                        "description": "Moved to Trash; its stock hold released."
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/invoices/{id}/pdf": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Invoices"
                ],
                "operationId": "getInvoicePdf",
                "summary": "Download the invoice PDF",
                "description": "Needs the `sales.invoices.print` scope. Only issued invoices have a PDF, as on the\nPrint button; a draft is `409 invalid_state`.\n",
                "x-scope": "sales.invoices.print",
                "parameters": [
                    {
                        "name": "lang",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ar",
                                "en"
                            ]
                        },
                        "description": "Language of the PDF; defaults to the request's `Accept-Language`."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The invoice, rendered with the workspace's template, in `lang` (default the request's language).",
                        "content": {
                            "application/pdf": {}
                        }
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/invoices/{id}/issue": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "post": {
                "tags": [
                    "Invoices"
                ],
                "operationId": "issueInvoice",
                "summary": "Issue (post) an invoice",
                "description": "Runs what the Issue button runs: price floors and quantity steps, the number,\ncredit control (direct invoices only), sale limits, and the journal entry. A\ndirect invoice also gets an issued sales order and delivery note that move the\nstock; a quantity the stock does not cover becomes a backorder when the workspace\nallows backorders, otherwise `409 stock_unavailable`.\n\nOther refusals are `409`, and nothing changes: `credit_warning`,\n`credit_limit_exceeded` and `sale_limit_exceeded` (resend with the answer in the\nbody, as for sales orders), `workflow_blocked`, `record_locked`, or\n`invalid_state` (not a draft, incomplete, or a correction draft, which is issued\nin Reevio).\n",
                "x-scope": "sales.invoices.post",
                "x-scope-conditional": {
                    "credit_override": "sales.credit_override",
                    "sale_limit_override": "sales.sale_limit_override"
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/IssueOptions"
                            },
                            "example": {
                                "credit_override": true,
                                "credit_override_reason": "Paid in cash at the counter"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/InvoiceOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/credit-notes": {
            "get": {
                "tags": [
                    "Credit notes"
                ],
                "operationId": "listCreditNotes",
                "summary": "List credit notes",
                "description": "Credit note headers, without lines; retrieve one for its lines.\n",
                "x-scope": "sales.credit_notes.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/CustomerIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CreditNoteList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/credit-notes/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Credit notes"
                ],
                "operationId": "getCreditNote",
                "summary": "Retrieve a credit note",
                "description": "One credit note by id, with its lines and the invoice it credits.\n",
                "x-scope": "sales.credit_notes.read",
                "responses": {
                    "200": {
                        "description": "The credit note.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/CreditNote"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customer-payments": {
            "get": {
                "tags": [
                    "Customer payments"
                ],
                "operationId": "listCustomerPayments",
                "summary": "List customer payments",
                "description": "`issued_from` / `issued_to` filter on `paid_on`.",
                "x-scope": "sales.customer_payments.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/CustomerIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomerPaymentList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Customer payments"
                ],
                "operationId": "createCustomerPayment",
                "summary": "Record a customer payment",
                "description": "A draft by default. `status: posted` posts it at once: it gets its number and its\njournal entry (needs `sales.customer_payments.post`). `applications` settle open\ninvoices of the customer and need `status: posted` and\n`sales.customer_payments.apply`; whatever is not applied becomes the customer's\nadvance. Cash goes to a `treasury_location_id`; bank transfers and cards to a\n`bank_account_id` in the payment's currency (see Treasury). A payment in another\ncurrency than the functional one needs `exchange_rate`.\n\nSettlement discounts (`discount_fixed`, in the functional currency, or\n`discount_percent`) need applications that use the whole payment. Refusals of the\namounts (more than an invoice's balance, more than the payment) are `422` on\n`applications`.\n",
                "x-scope": "sales.customer_payments.create",
                "x-scope-conditional": {
                    "status=posted": "sales.customer_payments.post",
                    "applications": "sales.customer_payments.apply"
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CustomerPaymentInput"
                            },
                            "example": {
                                "customer_id": "01K2ZQ7M4X8N6P3R9T5V7W1Y2A",
                                "status": "posted",
                                "paid_on": "2026-10-31",
                                "method": "cash",
                                "treasury_location_id": "01K3B7Q2M9X4N6P8R1T3V5W7Y9",
                                "currency_amount": "250000.00",
                                "applications": [
                                    {
                                        "invoice_id": "01K3A1B2C3D4E5F6G7H8J9K0MN",
                                        "applied_amount": "180000.00"
                                    }
                                ],
                                "notes": "Counter receipt 4471"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/CustomerPaymentCreated"
                    },
                    "200": {
                        "$ref": "#/components/responses/CustomerPaymentReplayed"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customer-payments/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Customer payments"
                ],
                "operationId": "getCustomerPayment",
                "summary": "Retrieve a customer payment",
                "description": "One customer payment by id, with where the money went and how it was applied.\n",
                "x-scope": "sales.customer_payments.read",
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomerPaymentOne"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customer-payments/{id}/applications": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "post": {
                "tags": [
                    "Customer payments"
                ],
                "operationId": "applyCustomerPayment",
                "summary": "Apply a posted payment to invoices",
                "description": "Settles open invoices of the same customer and branch from the payment's\n`unapplied_amount`. Later applications need the invoice in the payment's currency.\n`applied_on` defaults to today and may not be in the future. `409 invalid_state`\nunless the payment is posted; amount refusals are `422` on `applications`.\n",
                "x-scope": "sales.customer_payments.apply",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "applications"
                                ],
                                "properties": {
                                    "applied_on": {
                                        "$ref": "#/components/schemas/Date",
                                        "description": "Defaults to today on the workspace calendar."
                                    },
                                    "applications": {
                                        "type": "array",
                                        "description": "The invoices to settle and how much of the payment goes to each.",
                                        "minItems": 1,
                                        "maxItems": 200,
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "invoice_id",
                                                "applied_amount"
                                            ],
                                            "properties": {
                                                "invoice_id": {
                                                    "$ref": "#/components/schemas/Id",
                                                    "description": "An open invoice of the payment's customer and branch, in the payment's currency."
                                                },
                                                "applied_amount": {
                                                    "description": "In the payment's currency.",
                                                    "$ref": "#/components/schemas/Decimal"
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "applied_on": "2026-10-31",
                                "applications": [
                                    {
                                        "invoice_id": "01K3A1B2C3D4E5F6G7H8J9K0MN",
                                        "applied_amount": "70000.00"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/CustomerPaymentOne"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/treasury-locations": {
            "get": {
                "tags": [
                    "Treasury"
                ],
                "operationId": "listTreasuryLocations",
                "summary": "List cash locations the user may record payments into",
                "description": "The active cash locations (drawers, vaults, collector wallets) this user may\noperate, as the payment screen offers them. With `branch_id`, only those a\npayment recorded in that branch may use. Send one as `treasury_location_id` on a\ncash payment.\n",
                "x-scope": "accounting.cash_locations.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/TreasuryLocationList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/bank-accounts": {
            "get": {
                "tags": [
                    "Treasury"
                ],
                "operationId": "listBankAccounts",
                "summary": "List bank accounts the user may record payments into",
                "description": "The active bank accounts this user may operate, each in one currency. With\n`branch_id`, only those a payment recorded in that branch may use. Send one as\n`bank_account_id` on a bank transfer or card payment in the account's currency.\n",
                "x-scope": "accounting.bank_accounts.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/BankAccountList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/purchase-orders": {
            "get": {
                "tags": [
                    "Purchasing"
                ],
                "operationId": "listPurchaseOrders",
                "summary": "List purchase orders",
                "description": "Purchase order headers, without lines. Filter by date, status, vendor or branch.\n",
                "x-scope": "procurement.purchase_orders.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/VendorIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/PurchaseOrderList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/purchase-orders/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Purchasing"
                ],
                "operationId": "getPurchaseOrder",
                "summary": "Retrieve a purchase order",
                "description": "One purchase order by id, with what has been received and invoiced on each line.\n",
                "x-scope": "procurement.purchase_orders.read",
                "responses": {
                    "200": {
                        "description": "The purchase order.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/PurchaseOrder"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/vendor-invoices": {
            "get": {
                "tags": [
                    "Purchasing"
                ],
                "operationId": "listVendorInvoices",
                "summary": "List vendor invoices, debit notes and credit notes",
                "description": "`issued_from` / `issued_to` read the invoice date.",
                "x-scope": "procurement.vendor_invoices.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/VendorIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "invoice",
                                "debit_note",
                                "credit_note"
                            ]
                        },
                        "description": "Only this type of document."
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/VendorInvoiceList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/vendor-invoices/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Purchasing"
                ],
                "operationId": "getVendorInvoice",
                "summary": "Retrieve a vendor invoice",
                "description": "One vendor invoice, debit note or credit note by id, with its lines.\n",
                "x-scope": "procurement.vendor_invoices.read",
                "responses": {
                    "200": {
                        "description": "The vendor invoice.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/VendorInvoice"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/vendor-payments": {
            "get": {
                "tags": [
                    "Purchasing"
                ],
                "operationId": "listVendorPayments",
                "summary": "List vendor payments",
                "description": "`issued_from` / `issued_to` read the payment date.",
                "x-scope": "procurement.vendor_payments.read",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/UpdatedSince"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedFrom"
                    },
                    {
                        "$ref": "#/components/parameters/IssuedTo"
                    },
                    {
                        "$ref": "#/components/parameters/StatusFilter"
                    },
                    {
                        "$ref": "#/components/parameters/VendorIdFilter"
                    },
                    {
                        "$ref": "#/components/parameters/BranchIdFilter"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/VendorPaymentList"
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/vendor-payments/{id}": {
            "parameters": [
                {
                    "$ref": "#/components/parameters/Id"
                }
            ],
            "get": {
                "tags": [
                    "Purchasing"
                ],
                "operationId": "getVendorPayment",
                "summary": "Retrieve a vendor payment",
                "description": "One vendor payment by id, with the invoices it paid.\n",
                "x-scope": "procurement.vendor_payments.read",
                "responses": {
                    "200": {
                        "description": "The vendor payment.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/VendorPayment"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "4XX": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        }
    },
    "webhooks": {
        "event": {
            "post": {
                "operationId": "receiveWebhookEvent",
                "summary": "An event your webhook subscribed to",
                "description": "Sent from Reevio to your URL after the change commits, for records the webhook's\ntoken can read (its scopes, its user's role, branches and workflow visibility).\nSet webhooks up on the token's page in Administration → API Tokens; the signing\nsecret is shown once.\n\nVerify `Reevio-Signature: t=<unix>,v1=<hex>`: `v1` is HMAC-SHA256 of\n`t + \".\" + body` with your webhook secret, compared in constant time; reject\ntimestamps more than five minutes old. Answer any 2xx within 10 seconds;\nredirects are not followed. Anything else is retried with backoff for 24 hours,\nthen the webhook is switched off and the workspace's administrators are told.\n`Reevio-Delivery` is the event's id: a resend carries the same id, so drop a\nrepeat. The payload names the record; fetch it for the full, permission-checked\nshape.\n",
                "parameters": [
                    {
                        "name": "Reevio-Signature",
                        "in": "header",
                        "required": true,
                        "description": "`t=<unix>,v1=<hex HMAC-SHA256>`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Reevio-Event",
                        "in": "header",
                        "required": true,
                        "description": "The event type.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Reevio-Delivery",
                        "in": "header",
                        "required": true,
                        "description": "The event's id, the same as `id` in the body.",
                        "schema": {
                            "$ref": "#/components/schemas/Id"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEvent"
                            },
                            "example": {
                                "id": "01K4B2C3D4E5F6G7H8J9K0MNPQ",
                                "type": "invoice.issued",
                                "occurred_at": "2026-11-02T08:15:00Z",
                                "data": {
                                    "object": "invoice",
                                    "id": "01K3A1B2C3D4E5F6G7H8J9K0MN",
                                    "number": "INV-2026-00007",
                                    "status": "issued"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Received."
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerToken": {
                "type": "http",
                "scheme": "bearer",
                "description": "An API token issued in Administration → API Tokens."
            }
        },
        "schemas": {
            "Id": {
                "type": "string",
                "description": "Opaque ULID. Case-sensitive.",
                "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
                "examples": [
                    "01K2ZQ7M4X8N6P3R9T5V7W1Y2A"
                ]
            },
            "Decimal": {
                "type": "string",
                "description": "An exact decimal as a string.",
                "pattern": "^-?\\d+(\\.\\d+)?$",
                "examples": [
                    "10000.00"
                ]
            },
            "Date": {
                "type": "string",
                "format": "date",
                "description": "A calendar date on the workspace calendar.",
                "examples": [
                    "2026-11-02"
                ]
            },
            "Instant": {
                "type": "string",
                "format": "date-time",
                "description": "ISO-8601 in UTC.",
                "examples": [
                    "2026-11-02T08:15:00Z"
                ]
            },
            "ProductStatus": {
                "type": "string",
                "enum": [
                    "active",
                    "pending_review",
                    "inactive"
                ]
            },
            "Error": {
                "type": "object",
                "required": [
                    "code",
                    "message"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "Stable and machine-readable; branch on this, never on `message`. See the error table in the guide.",
                        "examples": [
                            "missing_scope"
                        ]
                    },
                    "message": {
                        "type": "string",
                        "description": "What went wrong, in English or Arabic per `Accept-Language`. Never branch on it; use `code`."
                    },
                    "required_scope": {
                        "type": "string",
                        "description": "With `missing_scope`, `scope_not_granted` and `module_unavailable`."
                    },
                    "details": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Extra figures for some 409 codes."
                    }
                }
            },
            "ValidationError": {
                "type": "object",
                "required": [
                    "code",
                    "message",
                    "errors"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "const": "validation_failed",
                        "description": "Always `validation_failed`."
                    },
                    "message": {
                        "type": "string",
                        "description": "What went wrong, in English or Arabic per `Accept-Language`. Never branch on it; use `code`."
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "examples": [
                            {
                                "lines.1.sku": [
                                    "No product has this SKU."
                                ]
                            }
                        ],
                        "description": "Field errors, keyed by field name."
                    }
                }
            },
            "CustomerDuplicateError": {
                "type": "object",
                "required": [
                    "code",
                    "message",
                    "matched_fields"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "enum": [
                            "customer_already_exists",
                            "customer_identifiers_conflict"
                        ],
                        "description": "`customer_already_exists` when one customer owns the identifiers, `customer_identifiers_conflict` when they belong to different customers."
                    },
                    "message": {
                        "type": "string",
                        "description": "What went wrong, in English or Arabic per `Accept-Language`. Never branch on it; use `code`."
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "description": "Field errors, keyed by field name."
                    },
                    "matched_fields": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "The identifiers that matched."
                    },
                    "existing_customer": {
                        "$ref": "#/components/schemas/CustomerIdentity",
                        "description": "The customer already using the identifiers. Reuse it instead of creating a new one."
                    },
                    "existing_customers": {
                        "type": "array",
                        "items": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/CustomerIdentity"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "matched_fields": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            },
                                            "description": "The identifiers that matched."
                                        }
                                    }
                                }
                            ]
                        },
                        "description": "The customers that each use one of the identifiers."
                    }
                }
            },
            "ListMeta": {
                "type": "object",
                "required": [
                    "page_size",
                    "has_more",
                    "next_page_cursor"
                ],
                "properties": {
                    "page_size": {
                        "type": "integer",
                        "description": "Records per page."
                    },
                    "has_more": {
                        "type": "boolean",
                        "description": "Whether another page follows."
                    },
                    "next_page_cursor": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Send as `page_cursor` to read the next page; null on the last page."
                    }
                }
            },
            "NamedRef": {
                "type": "object",
                "required": [
                    "id",
                    "name"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "The record's id."
                    },
                    "name": {
                        "type": "string",
                        "description": "The record's name."
                    }
                }
            },
            "CurrencyRef": {
                "type": "object",
                "required": [
                    "code",
                    "name",
                    "sign"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "examples": [
                            "IQD"
                        ],
                        "description": "ISO 4217; the sign for a currency without one."
                    },
                    "name": {
                        "type": "string",
                        "description": "The currency's name."
                    },
                    "sign": {
                        "type": "string",
                        "description": "The currency's sign, printed after amounts."
                    }
                }
            },
            "CustomerIdentity": {
                "type": "object",
                "required": [
                    "id",
                    "code",
                    "name"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the customer."
                    },
                    "code": {
                        "type": "string",
                        "examples": [
                            "CUS-000001"
                        ],
                        "description": "Customer code, e.g. `CUS-000001`."
                    },
                    "name": {
                        "type": "string",
                        "description": "The customer's name."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "inactive"
                        ],
                        "description": "Where the customer is in its life cycle."
                    },
                    "is_trashed": {
                        "type": "boolean",
                        "description": "Whether the customer is in Trash."
                    }
                }
            },
            "VendorRef": {
                "type": "object",
                "required": [
                    "id",
                    "code",
                    "name"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the vendor."
                    },
                    "code": {
                        "type": "string",
                        "examples": [
                            "VND-000001"
                        ],
                        "description": "Vendor code, e.g. `VND-000001`."
                    },
                    "name": {
                        "type": "string",
                        "description": "The vendor's name."
                    }
                }
            },
            "ProductRef": {
                "type": "object",
                "required": [
                    "id",
                    "sku",
                    "name"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the product."
                    },
                    "sku": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Stock-keeping unit, unique in the workspace."
                    },
                    "barcode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The primary barcode."
                    },
                    "name": {
                        "type": "string",
                        "description": "The product's name."
                    }
                }
            },
            "DocumentRef": {
                "type": "object",
                "required": [
                    "id",
                    "number",
                    "status"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "The document's id."
                    },
                    "number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Display code; null while a draft."
                    },
                    "status": {
                        "type": "string",
                        "description": "The document's status."
                    }
                }
            },
            "TaxRateRef": {
                "type": "object",
                "required": [
                    "id",
                    "code",
                    "rate_percent",
                    "type"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the tax rate."
                    },
                    "code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The tax rate's short code, if it has one."
                    },
                    "rate_percent": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "The rate, in percent."
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "exclusive",
                            "inclusive"
                        ],
                        "description": "`exclusive` adds tax on top of the price; `inclusive` means the price already contains it."
                    }
                }
            },
            "CountryRef": {
                "type": "object",
                "required": [
                    "code",
                    "name"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "ISO 3166-1 alpha-2."
                    },
                    "name": {
                        "type": "string",
                        "description": "The country's name."
                    }
                }
            },
            "CityRef": {
                "type": "object",
                "required": [
                    "code",
                    "name"
                ],
                "properties": {
                    "code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The city's code in Reevio, if it has one."
                    },
                    "name": {
                        "type": "string",
                        "description": "The city's name."
                    }
                }
            },
            "PaymentDestination": {
                "type": "object",
                "required": [
                    "type",
                    "id",
                    "name"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "treasury_location",
                            "bank_account"
                        ],
                        "description": "A `bank_account` or a `treasury_location` (a drawer, vault or collector wallet)."
                    },
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Id of the bank account or treasury location."
                    },
                    "name": {
                        "type": "string",
                        "description": "Name of the bank account or treasury location."
                    }
                }
            },
            "TokenInfo": {
                "type": "object",
                "required": [
                    "token",
                    "user",
                    "workspace"
                ],
                "properties": {
                    "token": {
                        "type": "object",
                        "required": [
                            "label",
                            "scopes"
                        ],
                        "properties": {
                            "label": {
                                "type": "string",
                                "description": "The token's label."
                            },
                            "scopes": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "description": "The scopes the token holds."
                            },
                            "expires_at": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Instant"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "When the token expires; null when it never does."
                            },
                            "allowed_ips": {
                                "type": [
                                    "array",
                                    "null"
                                ],
                                "items": {
                                    "type": "string"
                                },
                                "description": "Addresses the token may be used from; null for anywhere."
                            }
                        },
                        "description": "The calling token."
                    },
                    "user": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The user the token acts as. Its role is the ceiling for every call."
                    },
                    "workspace": {
                        "type": "object",
                        "required": [
                            "name",
                            "functional_currency",
                            "timezone",
                            "today"
                        ],
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "The workspace's name."
                            },
                            "functional_currency": {
                                "$ref": "#/components/schemas/CurrencyRef",
                                "description": "The workspace's functional currency."
                            },
                            "timezone": {
                                "type": "string",
                                "examples": [
                                    "Asia/Baghdad"
                                ],
                                "description": "The workspace's timezone. Dates (`*_on`) are on its calendar."
                            },
                            "today": {
                                "$ref": "#/components/schemas/Date",
                                "description": "Today's date on the workspace calendar."
                            }
                        },
                        "description": "The workspace the token belongs to."
                    }
                }
            },
            "Branch": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "status"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the branch."
                    },
                    "name": {
                        "type": "string",
                        "description": "The branch's name."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "inactive"
                        ],
                        "description": "Where the branch is in its life cycle."
                    },
                    "default_fulfillment_warehouse": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The warehouse that fulfils the branch's orders by default, if any."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the branch last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the branch was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "BranchList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Branch"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "Warehouse": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "branch",
                    "is_excluded_from_available_stock",
                    "is_excluded_from_sales_reservation"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the warehouse."
                    },
                    "name": {
                        "type": "string",
                        "description": "The warehouse's name."
                    },
                    "branch": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The branch the warehouse belongs to."
                    },
                    "is_excluded_from_available_stock": {
                        "type": "boolean",
                        "description": "Stock here does not count as available to sell."
                    },
                    "unavailable_stock_reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "damaged",
                            "awaiting_inspection",
                            "quarantine",
                            "expired",
                            "scrap",
                            "temporary_holding",
                            "in_transit",
                            "other",
                            null
                        ],
                        "description": "Why stock here is not available; null unless the warehouse is excluded from available stock."
                    },
                    "is_excluded_from_sales_reservation": {
                        "type": "boolean",
                        "description": "Sales orders cannot hold stock here. Always true where `is_excluded_from_available_stock` is."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the warehouse last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the warehouse was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "WarehouseList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Warehouse"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "Currency": {
                "type": "object",
                "required": [
                    "code",
                    "name",
                    "sign",
                    "minor_unit",
                    "is_functional",
                    "exchange_rate"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "ISO 4217 code; the sign for a currency without one."
                    },
                    "name": {
                        "type": "string",
                        "description": "The currency's name."
                    },
                    "sign": {
                        "type": "string",
                        "description": "The currency's sign, printed after amounts."
                    },
                    "symbol": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The currency's symbol, if it has one."
                    },
                    "minor_unit": {
                        "type": "integer",
                        "description": "Number of decimal places the currency uses."
                    },
                    "is_functional": {
                        "type": "boolean",
                        "description": "Whether this is the workspace's functional currency."
                    },
                    "exchange_rate": {
                        "description": "Accounting rate, this currency → functional currency, in force on the requested date. \"1.00000000\" for the functional currency; null when no rate is recorded on or before that date.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "exchange_rate_on": {
                        "description": "The date the accounting rate was recorded for; null for the functional currency.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "selling_rate": {
                        "description": "Rate catalog prices convert at right now (a same-day manual selling rate, else the accounting rate).",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "TaxRate": {
                "type": "object",
                "required": [
                    "id",
                    "code",
                    "name",
                    "rate_percent",
                    "type",
                    "is_active"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the tax rate."
                    },
                    "code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The tax rate's short code, if it has one."
                    },
                    "name": {
                        "type": "string",
                        "description": "The tax rate's name."
                    },
                    "rate_percent": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "The rate, in percent."
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "exclusive",
                            "inclusive"
                        ],
                        "description": "`exclusive` adds tax on top of the price; `inclusive` means the price already contains it."
                    },
                    "is_active": {
                        "type": "boolean",
                        "description": "Whether the tax rate can be chosen on new documents."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the tax rate last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the tax rate was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "TaxRateList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TaxRate"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "PriceTier": {
                "type": "object",
                "required": [
                    "id",
                    "name"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the price tier."
                    },
                    "name": {
                        "type": "string",
                        "description": "The price tier's name."
                    },
                    "default_currency": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CurrencyRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Currency the tier's prices are set in by default, if any."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the price tier last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the price tier was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "PriceTierList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PriceTier"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "PriceList": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "currency",
                    "status"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the price."
                    },
                    "name": {
                        "type": "string",
                        "description": "The price's name."
                    },
                    "currency": {
                        "description": "The list's currency; a list without one prices in the functional currency, shown here.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CurrencyRef"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "priority": {
                        "type": "integer",
                        "description": "Order in which price lists are considered when several apply."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "inactive"
                        ],
                        "description": "Where the price is in its life cycle."
                    },
                    "valid_from_on": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "First day the price list applies; null for no start."
                    },
                    "valid_to_on": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Last day the price list applies; null for no end."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the price last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the price was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "PriceListList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PriceList"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "CustomerCategory": {
                "type": "object",
                "required": [
                    "id",
                    "name"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the customer category."
                    },
                    "name": {
                        "type": "string",
                        "description": "The customer category's name."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the customer category last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the customer category was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "CustomerCategoryList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CustomerCategory"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "Product": {
                "type": "object",
                "required": [
                    "id",
                    "sku",
                    "name",
                    "type",
                    "status",
                    "sales_unit",
                    "barcodes",
                    "categories",
                    "price",
                    "price_currency",
                    "images",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the product."
                    },
                    "sku": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Stock-keeping unit, unique in the workspace; null when the product has none."
                    },
                    "name": {
                        "type": "string",
                        "description": "The product's name."
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "goods",
                            "services"
                        ],
                        "description": "Only goods track stock."
                    },
                    "status": {
                        "$ref": "#/components/schemas/ProductStatus",
                        "description": "Where the product is in its life cycle."
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Longer description of the product."
                    },
                    "sales_unit": {
                        "type": "string",
                        "enum": [
                            "each",
                            "fixed",
                            "hour",
                            "day",
                            "month",
                            "year"
                        ],
                        "description": "Goods are always `each`."
                    },
                    "barcodes": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                            "type": "string"
                        },
                        "description": "The first is the primary barcode."
                    },
                    "categories": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/NamedRef"
                        },
                        "description": "Product categories the product is in."
                    },
                    "brand": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The product's brand, if any."
                    },
                    "price": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Selling price, in `price_currency`."
                    },
                    "discounted_price": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "A standing sale price below `price`; null when the product is not discounted."
                    },
                    "price_currency": {
                        "$ref": "#/components/schemas/CurrencyRef",
                        "description": "Currency of `price`."
                    },
                    "cost": {
                        "description": "Present only when the token holds `catalog.products.view_cost`. Functional currency.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "default_tax_rate": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/TaxRateRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Tax rate the product gets on new lines, if any."
                    },
                    "dimensions": {
                        "type": "object",
                        "properties": {
                            "width": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Width."
                            },
                            "length": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Length."
                            },
                            "height": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Height."
                            },
                            "weight": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Weight."
                            },
                            "volume_cbm": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Volume in cubic metres."
                            }
                        },
                        "description": "Size and weight. Sending width, length or height replaces the volume."
                    },
                    "is_shown_in_store": {
                        "type": "boolean",
                        "description": "Whether the product is listed in the online store."
                    },
                    "images": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "index",
                                "url_large"
                            ],
                            "properties": {
                                "index": {
                                    "type": "integer",
                                    "description": "Position of the image, from 0."
                                },
                                "url_small": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "format": "uri",
                                    "description": "Small image URL; null when there is no small version."
                                },
                                "url_large": {
                                    "type": "string",
                                    "format": "uri",
                                    "description": "Large image URL."
                                }
                            }
                        },
                        "description": "The product's images, in order. Prefer these URLs to building the image path."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the product was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the product last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the product was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "ProductList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Product"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "ProductFields": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 255,
                        "description": "Product name. Required on create."
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "goods",
                            "services"
                        ],
                        "default": "goods",
                        "description": "Goods track stock; services do not. Defaults to goods."
                    },
                    "status": {
                        "$ref": "#/components/schemas/ProductStatus",
                        "description": "Where the product is in its life cycle."
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Description of the product."
                    },
                    "sales_unit": {
                        "type": "string",
                        "enum": [
                            "each",
                            "fixed",
                            "hour",
                            "day",
                            "month",
                            "year"
                        ],
                        "description": "How the product is sold. Goods are always `each`."
                    },
                    "barcodes": {
                        "type": "array",
                        "maxItems": 20,
                        "items": {
                            "type": "string",
                            "maxLength": 255
                        },
                        "description": "Up to 20 barcodes; the first is the primary. Sent, the list replaces the whole list."
                    },
                    "category_ids": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Id"
                        },
                        "description": "Product categories, by id. Sent, the list replaces the whole list."
                    },
                    "brand_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Brand, by id."
                    },
                    "price": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Selling price, in `price_currency`."
                    },
                    "discounted_price": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "A standing sale price below `price`; null when the product is not discounted."
                    },
                    "price_currency_code": {
                        "type": "string",
                        "description": "Defaults to the workspace's catalog price currency."
                    },
                    "cost": {
                        "description": "Needs `catalog.products.update_cost`. Accepted for services, or goods under standard costing.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "default_tax_rate_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Default tax rate, by id (see `GET /tax-rates`)."
                    },
                    "dimensions": {
                        "type": "object",
                        "properties": {
                            "width": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Width."
                            },
                            "length": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Length."
                            },
                            "height": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Height."
                            },
                            "weight": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Weight."
                            }
                        },
                        "description": "Size and weight. Sending width, length or height replaces the volume."
                    },
                    "is_shown_in_store": {
                        "type": "boolean",
                        "description": "Whether the product is listed in the online store."
                    }
                }
            },
            "ProductCreate": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ProductFields"
                    },
                    {
                        "type": "object",
                        "required": [
                            "name"
                        ],
                        "properties": {
                            "sku": {
                                "type": "string",
                                "maxLength": 255,
                                "description": "Required when the workspace's SKU mode is manual; generated when auto."
                            }
                        }
                    }
                ]
            },
            "ProductUpdate": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ProductFields"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "sku": {
                                "type": "string",
                                "maxLength": 255,
                                "description": "Changeable only in manual SKU mode."
                            }
                        }
                    }
                ]
            },
            "ProductCategory": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "parent",
                    "sort_order",
                    "is_default"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the product category."
                    },
                    "name": {
                        "type": "string",
                        "description": "The product category's name."
                    },
                    "parent": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The parent category; null at the top level."
                    },
                    "sort_order": {
                        "type": "integer",
                        "description": "Display order among sibling categories."
                    },
                    "is_default": {
                        "type": "boolean",
                        "description": "The workspace's default category. It cannot be moved to Trash."
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Description of the product category."
                    },
                    "slug": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The category's address segment in the online store."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the product category was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the product category last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the product category was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "ProductCategoryList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ProductCategory"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "StockLevel": {
                "type": "object",
                "required": [
                    "product",
                    "warehouse",
                    "on_hand",
                    "reserved",
                    "available",
                    "is_counted_as_available"
                ],
                "properties": {
                    "product": {
                        "$ref": "#/components/schemas/ProductRef",
                        "description": "The product."
                    },
                    "warehouse": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The warehouse holding the stock."
                    },
                    "on_hand": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Quantity physically in the warehouse."
                    },
                    "reserved": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Quantity held by orders and reservations still in force."
                    },
                    "available": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "What can still be sold here: `on_hand` minus `reserved`, never below zero, and `0` where the warehouse does not count as available stock."
                    },
                    "is_counted_as_available": {
                        "type": "boolean",
                        "description": "False for warehouses kept out of available stock (quarantine, damaged goods and the like)."
                    }
                }
            },
            "Customer": {
                "type": "object",
                "required": [
                    "id",
                    "code",
                    "name",
                    "status",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the customer."
                    },
                    "code": {
                        "type": "string",
                        "examples": [
                            "CUS-000001"
                        ],
                        "description": "Customer code, e.g. `CUS-000001`. Generated by Reevio unless the workspace numbers customers by hand."
                    },
                    "name": {
                        "type": "string",
                        "description": "The customer's name."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "inactive"
                        ],
                        "description": "Where the customer is in its life cycle."
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "A free-text reference, for example the customer's id in another system."
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Main phone number."
                    },
                    "phone_2": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Second phone number."
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Email address."
                    },
                    "contact": {
                        "type": "object",
                        "description": "The primary contact.",
                        "properties": {
                            "title": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "Mr",
                                    "Ms",
                                    "Mrs",
                                    "Dr",
                                    "Prof",
                                    null
                                ],
                                "description": "Contact person's title."
                            },
                            "name": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Contact person's name."
                            },
                            "position": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Contact person's job title."
                            },
                            "phone": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Contact person's phone number."
                            },
                            "email": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Contact person's email address."
                            }
                        }
                    },
                    "address": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Street address."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Internal notes on the customer."
                    },
                    "country": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CountryRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The customer's country."
                    },
                    "city": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CityRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The customer's city."
                    },
                    "latitude": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Map latitude."
                    },
                    "longitude": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Map longitude."
                    },
                    "category": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The customer category, if any."
                    },
                    "price_list": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Price list applied to the customer's sales, if any."
                    },
                    "price_tier": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Price tier the customer is priced at, if any."
                    },
                    "salesperson": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The salesperson responsible, if any."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the customer was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the customer last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the customer was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "CustomerList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Customer"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "CustomerFields": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 255,
                        "description": "Customer name. Required on create."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "inactive"
                        ],
                        "description": "Where the customer is in its life cycle."
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60,
                        "description": "A free-text reference, for example the customer's id in another system."
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Main phone number."
                    },
                    "phone_2": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Second phone number."
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "description": "Email address."
                    },
                    "contact_title": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "Mr",
                            "Ms",
                            "Mrs",
                            "Dr",
                            "Prof",
                            null
                        ],
                        "description": "Contact person's title."
                    },
                    "contact_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Contact person's name."
                    },
                    "contact_position": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Contact person's job title."
                    },
                    "contact_phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Contact person's phone number."
                    },
                    "contact_email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "description": "Contact person's email address."
                    },
                    "address": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Street address."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Notes on the customer."
                    },
                    "country_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "ISO 3166-1 alpha-2. Required with a city; country and city move together."
                    },
                    "city_code": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "City code, matched within the country. Send `city_code` or `city_name`."
                    },
                    "city_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Matched case-insensitively within the country. Send `city_code` or `city_name`."
                    },
                    "latitude": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Map latitude."
                    },
                    "longitude": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Map longitude."
                    },
                    "category_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Customer category, by id (see `GET /customer-categories`)."
                    },
                    "price_list_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Price list, by id (see `GET /price-lists`)."
                    },
                    "price_tier_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Price tier, by id (see `GET /price-tiers`)."
                    },
                    "salesperson_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Salesperson, by user id."
                    }
                }
            },
            "CustomerCreate": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/CustomerFields"
                    },
                    {
                        "type": "object",
                        "required": [
                            "name"
                        ],
                        "properties": {
                            "code": {
                                "type": "string",
                                "description": "Optional in auto mode (generated), required in manual mode. `CUS-000001` or a number 1–999999."
                            }
                        }
                    }
                ]
            },
            "CustomerUpdate": {
                "$ref": "#/components/schemas/CustomerFields"
            },
            "CustomerStatement": {
                "type": "object",
                "description": "The customer's receivable in one currency over a period, entry by entry.",
                "required": [
                    "customer",
                    "currency",
                    "currencies",
                    "starts_on",
                    "ends_on",
                    "opening_balance",
                    "total_debit",
                    "total_credit",
                    "closing_balance",
                    "entries"
                ],
                "properties": {
                    "customer": {
                        "$ref": "#/components/schemas/CustomerIdentity",
                        "description": "The customer."
                    },
                    "currency": {
                        "description": "The statement's currency; every amount is in it.",
                        "$ref": "#/components/schemas/CurrencyRef"
                    },
                    "currencies": {
                        "type": "array",
                        "description": "Every currency the customer has entries in. Ask for another with `currency_code`.",
                        "items": {
                            "$ref": "#/components/schemas/CurrencyRef"
                        }
                    },
                    "starts_on": {
                        "description": "The period's first day; null from the first entry.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "ends_on": {
                        "description": "The period's last day; null up to now.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "opening_balance": {
                        "description": "What the customer owed before `starts_on`; \"0.00\" without it. Negative means they were in credit.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "total_debit": {
                        "description": "The sum of the entries' `debit`.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "total_credit": {
                        "description": "The sum of the entries' `credit`.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "closing_balance": {
                        "description": "What the customer owes at the end of the period: `opening_balance` + `total_debit` − `total_credit`. Negative means they are in credit.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "entries": {
                        "type": "array",
                        "description": "Oldest first.",
                        "items": {
                            "$ref": "#/components/schemas/StatementEntry"
                        }
                    }
                }
            },
            "StatementEntry": {
                "type": "object",
                "required": [
                    "occurred_on",
                    "type",
                    "reference",
                    "memo",
                    "documents",
                    "debit",
                    "credit",
                    "running_balance",
                    "branch"
                ],
                "properties": {
                    "occurred_on": {
                        "description": "The entry's accounting date.",
                        "$ref": "#/components/schemas/Date"
                    },
                    "type": {
                        "type": "string",
                        "description": "What posted it: `invoice`, `credit_note`, `customer_payment`,\n`invoice_shipping_delivery` (a shipping company took over collecting the\ninvoice), `pos_transaction`, `opening_balance`, or `journal_entry` (an entry made\nby hand). New types may be added.\n"
                    },
                    "reference": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The journal entry's reference."
                    },
                    "memo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The entry's description."
                    },
                    "documents": {
                        "type": "array",
                        "description": "The invoices, credit notes and payments the entry belongs to; empty for an opening balance or a manual entry.",
                        "items": {
                            "$ref": "#/components/schemas/StatementDocument"
                        }
                    },
                    "debit": {
                        "description": "What the entry adds to the balance.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "credit": {
                        "description": "What the entry takes off.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "running_balance": {
                        "description": "The balance after this entry.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "branch": {
                        "description": "The branch the entry was posted in.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "StatementDocument": {
                "type": "object",
                "required": [
                    "type",
                    "id",
                    "number"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "invoice",
                            "credit_note",
                            "customer_payment"
                        ],
                        "description": "Which kind of document it is."
                    },
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the statement document."
                    },
                    "number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The document's number, e.g. `INV-2026-00007`."
                    }
                }
            },
            "CustomerBalance": {
                "type": "object",
                "description": "What the customer owes and how credit control sees them, in the functional\ncurrency, the same figures the Issue button checks against.\n",
                "required": [
                    "customer",
                    "currency",
                    "receivable",
                    "open_orders",
                    "exposure",
                    "credit_control",
                    "computed_at"
                ],
                "properties": {
                    "customer": {
                        "$ref": "#/components/schemas/CustomerIdentity",
                        "description": "The customer."
                    },
                    "currency": {
                        "$ref": "#/components/schemas/CurrencyRef",
                        "description": "The functional currency the figures are in."
                    },
                    "receivable": {
                        "description": "The receivables ledger balance. Positive means the customer owes you; negative means they are in credit.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "open_orders": {
                        "description": "Issued sales orders not yet invoiced.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "exposure": {
                        "description": "`receivable` plus `open_orders`: what credit control measures against the limit.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "credit_control": {
                        "type": "object",
                        "required": [
                            "mode",
                            "credit_limit",
                            "available_credit",
                            "overdue_block_days",
                            "overdue_invoice_count",
                            "oldest_overdue_days"
                        ],
                        "properties": {
                            "mode": {
                                "type": "string",
                                "enum": [
                                    "off",
                                    "warn",
                                    "block"
                                ],
                                "description": "The customer's own mode, else the workspace's."
                            },
                            "credit_limit": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "The customer's credit limit; null for none."
                            },
                            "available_credit": {
                                "description": "`credit_limit` minus `exposure`; null without a limit. Negative when over the limit.",
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Decimal"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "overdue_block_days": {
                                "type": [
                                    "integer",
                                    "null"
                                ],
                                "description": "Open invoices overdue by more than this many days block or warn."
                            },
                            "overdue_invoice_count": {
                                "type": "integer",
                                "description": "Open invoices past `overdue_block_days`; 0 when no such rule applies."
                            },
                            "oldest_overdue_days": {
                                "type": "integer",
                                "description": "Days the oldest overdue invoice is past due; 0 when none is."
                            }
                        },
                        "description": "How credit control treats the customer."
                    },
                    "computed_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When these figures were computed."
                    }
                }
            },
            "Vendor": {
                "type": "object",
                "required": [
                    "id",
                    "code",
                    "name",
                    "is_available_for_purchasing",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the vendor."
                    },
                    "code": {
                        "type": "string",
                        "examples": [
                            "VND-000001"
                        ],
                        "description": "Vendor code, e.g. `VND-000001`, assigned by Reevio."
                    },
                    "name": {
                        "type": "string",
                        "description": "The vendor's name."
                    },
                    "contact_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Contact person's name."
                    },
                    "phone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Main phone number."
                    },
                    "phone_2": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Second phone number."
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Email address."
                    },
                    "address": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Street address."
                    },
                    "country": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CountryRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The vendor's country."
                    },
                    "city": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CityRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The vendor's city."
                    },
                    "is_available_for_purchasing": {
                        "type": "boolean",
                        "description": "Whether purchase documents offer this vendor."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Internal notes on the vendor."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the vendor was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the vendor last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the vendor was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "VendorList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Vendor"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "SalesLine": {
                "type": "object",
                "required": [
                    "line_number",
                    "product",
                    "description",
                    "quantity",
                    "price",
                    "subtotal",
                    "tax_amount",
                    "line_total"
                ],
                "properties": {
                    "line_number": {
                        "type": "integer",
                        "description": "Position on the document, from 1."
                    },
                    "product": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/ProductRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The product."
                    },
                    "description": {
                        "type": "string",
                        "description": "The line's text as printed; the product name unless changed."
                    },
                    "unit": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The unit the line is sold in."
                    },
                    "quantity": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Quantity, in the line's unit."
                    },
                    "price": {
                        "description": "Price before any discount.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "discounted_price": {
                        "description": "What the customer pays per unit; null when the line is not discounted.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "subtotal": {
                        "description": "Quantity × the price paid: before exclusive tax, with inclusive tax inside it.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "tax_rate": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/TaxRateRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The tax rate applied, if any."
                    },
                    "tax_amount": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Tax on the line."
                    },
                    "line_total": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "The line's total including tax."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Notes on the sales line."
                    }
                }
            },
            "SalesLineInput": {
                "type": "object",
                "required": [
                    "quantity"
                ],
                "description": "Name the product with exactly one of `product_id`, `sku` or `barcode`.",
                "properties": {
                    "product_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "The product, by id. Send exactly one of `product_id`, `sku` or `barcode`."
                    },
                    "sku": {
                        "type": "string",
                        "description": "The product, by SKU. Send exactly one of `product_id`, `sku` or `barcode`."
                    },
                    "barcode": {
                        "type": "string",
                        "description": "The product, by any of its barcodes. Send exactly one of `product_id`, `sku` or `barcode`."
                    },
                    "quantity": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Quantity to sell, in the product's sales unit."
                    },
                    "price": {
                        "description": "Omit to price from the customer's tier, price list or the product.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "discounted_price": {
                        "description": "May not exceed `price`. Needs the role's below-price permission.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "tax_rate_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Omit or null for the product's tax rate."
                    },
                    "description": {
                        "type": "string",
                        "description": "Defaults to the product name."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Notes printed on the line."
                    }
                }
            },
            "DocumentHeader": {
                "type": "object",
                "required": [
                    "id",
                    "number",
                    "status",
                    "customer",
                    "branch",
                    "issued_on",
                    "currency",
                    "exchange_rate",
                    "total",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the document."
                    },
                    "number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Display code, e.g. `SO-2026-00042`; assigned at issue, so null on a new draft (a document reverted to draft keeps its number)."
                    },
                    "status": {
                        "type": "string",
                        "description": "Where the document is in its life cycle."
                    },
                    "customer": {
                        "description": "Null for an anonymous sale.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CustomerIdentity"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "branch": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The branch the document belongs to."
                    },
                    "salesperson": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The salesperson responsible, if any."
                    },
                    "issued_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "The document's date, on the workspace calendar."
                    },
                    "currency": {
                        "$ref": "#/components/schemas/CurrencyRef",
                        "description": "The document's currency."
                    },
                    "exchange_rate": {
                        "description": "Document currency → functional currency; null until the document is priced or issued.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "total": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Total including tax, in the document's currency."
                    },
                    "base_total": {
                        "description": "Functional currency; set at issue.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Notes on the document."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the document was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the document last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the document was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "Quotation": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/DocumentHeader"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "string",
                                "enum": [
                                    "draft",
                                    "issued",
                                    "converted",
                                    "canceled"
                                ],
                                "description": "Where the quotation is in its life cycle."
                            },
                            "expires_on": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Date"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Last day the quotation is valid; null when it does not expire."
                            },
                            "lines": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SalesLine"
                                },
                                "description": "Detail call only."
                            }
                        }
                    }
                ]
            },
            "QuotationList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Quotation"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "SalesOrderLine": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/SalesLine"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "fulfillment_mode": {
                                "type": "string",
                                "enum": [
                                    "confirmed",
                                    "backorder",
                                    "not_available"
                                ],
                                "description": "How the line is fulfilled: from stock (`confirmed`), as a `backorder`, or kept on the order but not charged (`not_available`)."
                            },
                            "is_included_in_total": {
                                "type": "boolean",
                                "description": "False for not-available lines."
                            },
                            "delivered_quantity": {
                                "$ref": "#/components/schemas/Decimal",
                                "description": "Quantity delivered so far."
                            },
                            "invoiced_quantity": {
                                "$ref": "#/components/schemas/Decimal",
                                "description": "Quantity invoiced so far."
                            },
                            "status": {
                                "type": "string",
                                "enum": [
                                    "pending",
                                    "delivered",
                                    "invoiced",
                                    "closed"
                                ],
                                "description": "The line's progress."
                            }
                        }
                    }
                ]
            },
            "SalesOrder": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/DocumentHeader"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "string",
                                "enum": [
                                    "draft",
                                    "issued",
                                    "converted",
                                    "canceled"
                                ],
                                "description": "Where the sales order is in its life cycle."
                            },
                            "supply_status": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "waiting",
                                    "partial",
                                    "ready",
                                    "delivered",
                                    "closed",
                                    null
                                ],
                                "description": "Whether the order's stock is in place; null on a draft."
                            },
                            "delivery_on": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Date"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Requested delivery date."
                            },
                            "price_tier": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/NamedRef"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "The price tier the order was priced at, if any."
                            },
                            "quotation": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/DocumentRef"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "The quotation the order was made from, if any."
                            },
                            "reserve_stock": {
                                "type": [
                                    "boolean",
                                    "null"
                                ],
                                "description": "The draft's stock-hold override; null follows Sales settings."
                            },
                            "lines": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SalesOrderLine"
                                },
                                "description": "Detail call only."
                            }
                        }
                    }
                ]
            },
            "SalesOrderList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/SalesOrder"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "SalesOrderInput": {
                "type": "object",
                "description": "`customer_id` and `lines` are required unless the order is made from a quotation.",
                "properties": {
                    "customer_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Required, except from a quotation: then the quotation's customer, and sending another is a 422."
                    },
                    "quotation_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Make the order from this issued quotation (create only; a replacement must keep it). Needs `sales.quotations.convert`."
                    },
                    "branch_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Defaults to the user's default branch (from a quotation: its branch). A replacement must keep the draft's branch."
                    },
                    "issued_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "The order date. Defaults to today on the workspace calendar."
                    },
                    "delivery_on": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Requested delivery date. Not before `issued_on`."
                    },
                    "currency_code": {
                        "type": "string",
                        "description": "Defaults to the workspace's sales currency."
                    },
                    "salesperson_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Defaults to the customer's salesperson."
                    },
                    "reserve_stock": {
                        "type": "boolean",
                        "description": "Overrides the draft stock-hold setting while a draft. Omit to follow Sales settings."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 5000,
                        "description": "Notes on the order."
                    },
                    "accept_duplicate_products": {
                        "type": "boolean",
                        "description": "Allow one product on more than one line. Without it a repeat is refused, as the sales screen refuses to save until the user accepts it."
                    },
                    "lines": {
                        "type": "array",
                        "description": "Required, except from a quotation: omit to take the quotation's lines and prices.",
                        "minItems": 1,
                        "maxItems": 200,
                        "items": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/SalesLineInput"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "fulfillment_mode": {
                                            "type": "string",
                                            "enum": [
                                                "confirmed",
                                                "backorder",
                                                "not_available"
                                            ],
                                            "default": "confirmed",
                                            "description": "How the line is fulfilled: from stock (`confirmed`), as a `backorder`, or kept on the order but not charged (`not_available`)."
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "IssueOptions": {
                "type": "object",
                "description": "Send only to answer a previous 409.",
                "properties": {
                    "confirm_credit_warning": {
                        "type": "boolean",
                        "description": "Issue despite a `credit_warning`: the workspace warns but does not block."
                    },
                    "credit_override": {
                        "type": "boolean",
                        "description": "Issue despite `credit_limit_exceeded`. Needs `sales.credit_override` on the token and the role, and a reason."
                    },
                    "credit_override_reason": {
                        "type": "string",
                        "maxLength": 500,
                        "description": "Required with `credit_override`; recorded on the customer's credit history."
                    },
                    "sale_limit_override": {
                        "type": "boolean",
                        "description": "Issue despite `sale_limit_exceeded`. Needs `sales.sale_limit_override` on the token and the role, and a reason."
                    },
                    "sale_limit_override_reason": {
                        "type": "string",
                        "maxLength": 500,
                        "description": "Required with `sale_limit_override`."
                    }
                }
            },
            "DeliveryNote": {
                "type": "object",
                "description": "A quantity document. No money.",
                "required": [
                    "id",
                    "number",
                    "status",
                    "sales_order",
                    "customer",
                    "branch",
                    "issued_on",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the delivery note."
                    },
                    "number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Display number, assigned when the delivery note is issued."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "draft",
                            "issued",
                            "converted",
                            "canceled"
                        ],
                        "description": "Where the delivery note is in its life cycle."
                    },
                    "sales_order": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/DocumentRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The sales order, if any."
                    },
                    "customer": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/CustomerIdentity"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The customer."
                    },
                    "branch": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The branch the delivery note belongs to."
                    },
                    "issued_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "The delivery note's date, on the workspace calendar."
                    },
                    "delivery_on": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Requested delivery date."
                    },
                    "confirmed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the delivery was confirmed."
                    },
                    "delivered_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the goods were delivered."
                    },
                    "lines": {
                        "type": "array",
                        "description": "Detail call only.",
                        "items": {
                            "type": "object",
                            "required": [
                                "line_number",
                                "product",
                                "quantity",
                                "warehouse"
                            ],
                            "properties": {
                                "line_number": {
                                    "type": "integer",
                                    "description": "Position on the document, from 1."
                                },
                                "product": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ProductRef"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ],
                                    "description": "The product."
                                },
                                "description": {
                                    "type": "string",
                                    "description": "Description of the line."
                                },
                                "quantity": {
                                    "$ref": "#/components/schemas/Decimal",
                                    "description": "Quantity, in the line's unit."
                                },
                                "delivered_quantity": {
                                    "$ref": "#/components/schemas/Decimal",
                                    "description": "Quantity delivered so far."
                                },
                                "warehouse": {
                                    "description": "Null when the warehouse is hidden from the API or from the token's user.",
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/NamedRef"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ]
                                },
                                "status": {
                                    "type": "string",
                                    "enum": [
                                        "pending",
                                        "delivered",
                                        "invoiced"
                                    ],
                                    "description": "The line's progress."
                                }
                            }
                        }
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the delivery note was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the delivery note last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the delivery note was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "DeliveryNoteList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DeliveryNote"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "DeliveryNoteInput": {
                "type": "object",
                "required": [
                    "sales_order_id"
                ],
                "properties": {
                    "sales_order_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "The issued sales order to deliver."
                    }
                }
            },
            "Invoice": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/DocumentHeader"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "string",
                                "enum": [
                                    "draft",
                                    "issued",
                                    "partially_paid",
                                    "fully_paid",
                                    "credited",
                                    "canceled"
                                ],
                                "description": "Where the invoice is in its life cycle."
                            },
                            "sales_order": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/DocumentRef"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "The sales order, if any."
                            },
                            "due_on": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Date"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "When payment is due; null when no due date is set."
                            },
                            "posted_at": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Instant"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "When the invoice was posted to the books."
                            },
                            "paid": {
                                "$ref": "#/components/schemas/Decimal",
                                "description": "Paid so far."
                            },
                            "balance": {
                                "$ref": "#/components/schemas/Decimal",
                                "description": "What the customer still owes after payments and credit notes."
                            },
                            "shipping_status": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "pending",
                                    "undelivered",
                                    "delivered",
                                    "returned",
                                    "partially_returned",
                                    null
                                ],
                                "description": "Delivery progress when a shipping company delivers the invoice; null otherwise."
                            },
                            "delivery_notes": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/DocumentRef"
                                },
                                "description": "The delivery notes this invoice covers."
                            },
                            "lines": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SalesLine"
                                },
                                "description": "Detail call only."
                            }
                        }
                    }
                ]
            },
            "InvoiceList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Invoice"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "InvoiceInput": {
                "type": "object",
                "description": "Either `sales_order_id` (bill an order) or `customer_id` and `lines` (a direct invoice).",
                "properties": {
                    "customer_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Required for a direct invoice. For an order, its customer; sending another is a 422."
                    },
                    "sales_order_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Bill this issued order (create only). Lines then come from the order and `lines` must be omitted. Needs `sales.orders.convert`."
                    },
                    "branch_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Defaults to the user's default branch (for an order: its branch). A replacement must keep the draft's branch."
                    },
                    "issued_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "Defaults to today on the workspace calendar."
                    },
                    "due_on": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Not before `issued_on`. Defaults from the workspace's invoice due days, else the order's delivery date."
                    },
                    "currency_code": {
                        "type": "string",
                        "description": "Defaults to the workspace's invoice currency (for an order: its currency)."
                    },
                    "salesperson_id": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Id"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Defaults to the customer's (or the order's) salesperson."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 5000,
                        "description": "Notes on the invoice."
                    },
                    "accept_duplicate_products": {
                        "type": "boolean",
                        "description": "Allow one product on more than one line of a direct invoice. Without it a repeat is refused, as the sales screen refuses to save until the user accepts it."
                    },
                    "lines": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 200,
                        "items": {
                            "$ref": "#/components/schemas/SalesLineInput"
                        },
                        "description": "Required for a direct invoice; omitted for an order."
                    }
                }
            },
            "CreditNote": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/DocumentHeader"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "string",
                                "enum": [
                                    "draft",
                                    "issued",
                                    "partially_paid",
                                    "fully_paid",
                                    "canceled"
                                ],
                                "description": "Where the credit note is in its life cycle."
                            },
                            "source_invoice": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/DocumentRef"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "The invoice being credited, if any."
                            },
                            "sales_order": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/DocumentRef"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "The sales order, if any."
                            },
                            "credit_reason": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "enum": [
                                    "goods_returned",
                                    "duplicate_or_cancelled",
                                    "consolidated",
                                    "other",
                                    null
                                ],
                                "description": "Why the credit note was issued."
                            },
                            "credit_reason_detail": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "More detail on the reason, if given."
                            },
                            "settled": {
                                "description": "Refunded or applied so far.",
                                "$ref": "#/components/schemas/Decimal"
                            },
                            "balance": {
                                "description": "Still available to refund or apply.",
                                "$ref": "#/components/schemas/Decimal"
                            },
                            "lines": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/SalesLine"
                                },
                                "description": "Detail call only."
                            }
                        }
                    }
                ]
            },
            "CreditNoteList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CreditNote"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "PaymentApplication": {
                "type": "object",
                "required": [
                    "invoice",
                    "applied_amount",
                    "applied_on",
                    "status"
                ],
                "properties": {
                    "invoice": {
                        "description": "Null when applied to the customer's opening balance.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/DocumentRef"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "is_opening_balance": {
                        "type": "boolean",
                        "description": "Applied to the customer's opening balance rather than an invoice."
                    },
                    "applied_amount": {
                        "description": "In the payment's currency.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "invoice_amount": {
                        "description": "Settled on the invoice, in the invoice's currency; differs from `applied_amount` only for a cross-currency settlement.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "applied_base_amount": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "The applied amount in the functional currency."
                    },
                    "applied_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "Date the amount was applied."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "posted",
                            "reversed"
                        ],
                        "description": "`posted`, or `reversed` once the payment is unapplied from the invoice."
                    }
                }
            },
            "PaymentApplicationInput": {
                "type": "object",
                "required": [
                    "invoice_id"
                ],
                "description": "Send `applied_amount` for an invoice in the payment's currency, `invoice_amount` for one in another currency.",
                "properties": {
                    "invoice_id": {
                        "$ref": "#/components/schemas/Id"
                    },
                    "applied_amount": {
                        "description": "What to settle, in the payment's currency; the invoice is in the same currency.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "invoice_amount": {
                        "description": "What to settle, in the invoice's currency. Needed when the invoice is in another currency than the payment.",
                        "$ref": "#/components/schemas/Decimal"
                    }
                }
            },
            "CustomerPayment": {
                "type": "object",
                "required": [
                    "id",
                    "number",
                    "status",
                    "customer",
                    "branch",
                    "paid_on",
                    "method",
                    "currency",
                    "currency_amount",
                    "exchange_rate",
                    "base_amount",
                    "unapplied_amount",
                    "applications",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the customer payment."
                    },
                    "number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "e.g. `CP-2026-00003`; assigned when the receipt is recorded, so a draft may already carry one."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "draft",
                            "posted",
                            "reversed"
                        ],
                        "description": "`draft` until posted; `reversed` once the payment is reversed."
                    },
                    "customer": {
                        "$ref": "#/components/schemas/CustomerIdentity",
                        "description": "The customer."
                    },
                    "branch": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The branch the customer payment belongs to."
                    },
                    "paid_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "Date of the payment, on the workspace calendar."
                    },
                    "method": {
                        "type": "string",
                        "enum": [
                            "cash",
                            "bank_transfer",
                            "card",
                            "carrier_cod"
                        ],
                        "description": "How the money was received."
                    },
                    "purpose": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "on_account",
                            "invoice_settlement",
                            "balance_settlement",
                            "mixed",
                            null
                        ],
                        "description": "What the payment was recorded for."
                    },
                    "destination": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/PaymentDestination"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Where the money went: a bank account or a treasury location."
                    },
                    "currency": {
                        "$ref": "#/components/schemas/CurrencyRef",
                        "description": "The customer payment's currency."
                    },
                    "currency_amount": {
                        "description": "The amount entered, in the payment's currency, before any settlement discount.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "exchange_rate": {
                        "description": "Payment currency → functional currency; \"1.000000\" for the functional currency.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "base_amount": {
                        "description": "What reached the till or bank, in the functional currency, after any settlement discount.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "discount_base_amount": {
                        "description": "The settlement discount, in the functional currency.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "unapplied_amount": {
                        "description": "Held as the customer's advance. Payment currency.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "applications": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PaymentApplication"
                        },
                        "description": "Where the payment was applied."
                    },
                    "reversed_on": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Date the payment was reversed; null unless it was."
                    },
                    "reversal_reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Why the payment was reversed; null unless it was."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Notes on the customer payment."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the customer payment was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the customer payment last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the customer payment was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "CustomerPaymentList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CustomerPayment"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "CustomerPaymentInput": {
                "type": "object",
                "required": [
                    "customer_id",
                    "paid_on",
                    "method",
                    "currency_amount"
                ],
                "properties": {
                    "customer_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "The customer, by id."
                    },
                    "branch_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Defaults to the user's default branch. A payment applied to invoices takes their branch."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "draft",
                            "posted"
                        ],
                        "default": "draft",
                        "description": "`posted` posts it at once; needs `sales.customer_payments.post`."
                    },
                    "paid_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "Not after today on the workspace calendar."
                    },
                    "method": {
                        "type": "string",
                        "enum": [
                            "cash",
                            "bank_transfer",
                            "card"
                        ],
                        "description": "How the money moved."
                    },
                    "treasury_location_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Required to post a cash payment."
                    },
                    "bank_account_id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Required to post a bank transfer or card payment; same currency as the payment."
                    },
                    "currency_code": {
                        "type": "string",
                        "description": "Defaults to the functional currency."
                    },
                    "currency_amount": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "The amount received, in the payment's currency, before any settlement discount."
                    },
                    "exchange_rate": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Payment currency → functional currency. Required for a currency other than the functional one."
                    },
                    "discount_fixed": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Settlement discount in the functional currency; only when applications use the whole payment."
                    },
                    "discount_percent": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Settlement discount as a percent, 0–100; only when applications use the whole payment."
                    },
                    "applications": {
                        "type": "array",
                        "maxItems": 200,
                        "items": {
                            "$ref": "#/components/schemas/PaymentApplicationInput"
                        },
                        "description": "Invoices to settle; needs `status: posted` and `sales.customer_payments.apply`."
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 5000,
                        "description": "Notes on the customer payment."
                    }
                }
            },
            "TreasuryLocation": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "type",
                    "branch",
                    "status"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the treasury location."
                    },
                    "name": {
                        "type": "string",
                        "description": "The treasury location's name."
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "collector_wallet",
                            "drawer",
                            "vault"
                        ],
                        "description": "A cash drawer, a vault, or a collector's wallet."
                    },
                    "branch": {
                        "description": "Null for a location every branch may use.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active"
                        ],
                        "description": "Where the treasury location is in its life cycle."
                    }
                }
            },
            "TreasuryLocationList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TreasuryLocation"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "BankAccount": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "currency",
                    "status"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the bank account."
                    },
                    "name": {
                        "type": "string",
                        "description": "The bank account's name."
                    },
                    "bank_name": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The bank that holds the account."
                    },
                    "currency": {
                        "$ref": "#/components/schemas/CurrencyRef",
                        "description": "The bank account's currency."
                    },
                    "branch": {
                        "description": "Null for an account every branch may use.",
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/NamedRef"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active"
                        ],
                        "description": "Where the bank account is in its life cycle."
                    }
                }
            },
            "BankAccountList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/BankAccount"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "PurchaseLine": {
                "type": "object",
                "required": [
                    "line_number",
                    "quantity",
                    "unit_price",
                    "line_total"
                ],
                "properties": {
                    "line_number": {
                        "type": "integer",
                        "description": "Position on the document, from 1."
                    },
                    "product": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/ProductRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The product."
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The line's text as printed."
                    },
                    "quantity": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Quantity, in the line's unit."
                    },
                    "unit_price": {
                        "description": "At the scale Reevio stores it: 2 places on purchase orders, 6 on vendor invoices.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "tax_rate": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/TaxRateRef"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The tax rate applied, if any."
                    },
                    "tax_amount": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Tax on the line."
                    },
                    "line_total": {
                        "description": "Includes tax.",
                        "$ref": "#/components/schemas/Decimal"
                    }
                }
            },
            "PurchaseHeader": {
                "type": "object",
                "required": [
                    "id",
                    "number",
                    "status",
                    "vendor",
                    "branch",
                    "currency",
                    "exchange_rate",
                    "total",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the purchase document."
                    },
                    "number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Display number, assigned when the purchase document is issued."
                    },
                    "status": {
                        "type": "string",
                        "description": "Where the purchase document is in its life cycle."
                    },
                    "vendor": {
                        "$ref": "#/components/schemas/VendorRef",
                        "description": "The vendor."
                    },
                    "branch": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The branch the purchase document belongs to."
                    },
                    "issued_on": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Date"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The purchase document's date, on the workspace calendar."
                    },
                    "currency": {
                        "$ref": "#/components/schemas/CurrencyRef",
                        "description": "The purchase document's currency."
                    },
                    "exchange_rate": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Rate from the purchase document's currency to the functional currency."
                    },
                    "total": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Total including tax, in the purchase document's currency."
                    },
                    "base_total": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Decimal"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "The total in the functional currency, fixed when the purchase document is issued."
                    },
                    "approval_status": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "not_required",
                            "pending",
                            "approved",
                            "rejected",
                            null
                        ],
                        "description": "Approval progress, when the workspace requires approval for the purchase document."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the purchase document was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the purchase document last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the purchase document was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "PurchaseOrder": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/PurchaseHeader"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "string",
                                "enum": [
                                    "draft",
                                    "issued",
                                    "converted",
                                    "canceled"
                                ],
                                "description": "Where the purchase order is in its life cycle."
                            },
                            "receiving_status": {
                                "type": "string",
                                "enum": [
                                    "not_received",
                                    "partial",
                                    "received",
                                    "closed"
                                ],
                                "description": "How much of the order has been received."
                            },
                            "invoice_status": {
                                "type": "string",
                                "enum": [
                                    "not_invoiced",
                                    "partially_invoiced",
                                    "invoiced",
                                    "over_invoiced"
                                ],
                                "description": "How much of the order has been invoiced."
                            },
                            "expected_on": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Date"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Expected delivery date."
                            },
                            "closed_at": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Instant"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "When the order was closed; null while open."
                            },
                            "lines": {
                                "type": "array",
                                "description": "Detail call only.",
                                "items": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/PurchaseLine"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "received_quantity": {
                                                    "$ref": "#/components/schemas/Decimal",
                                                    "description": "Quantity received so far."
                                                },
                                                "invoiced_quantity": {
                                                    "$ref": "#/components/schemas/Decimal",
                                                    "description": "Quantity invoiced so far."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "partial",
                                                        "received",
                                                        "closed"
                                                    ],
                                                    "description": "Receiving progress of the line."
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            },
            "PurchaseOrderList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PurchaseOrder"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "VendorInvoice": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/PurchaseHeader"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "invoice",
                                    "debit_note",
                                    "credit_note"
                                ],
                                "description": "An invoice, or a debit or credit note from the vendor."
                            },
                            "kind": {
                                "type": "string",
                                "enum": [
                                    "supplier_invoice",
                                    "carrier_bill"
                                ],
                                "description": "A supplier's own invoice, or a shipping company's bill."
                            },
                            "status": {
                                "type": "string",
                                "enum": [
                                    "draft",
                                    "issued",
                                    "canceled"
                                ],
                                "description": "Where the vendor invoice is in its life cycle."
                            },
                            "vendor_reference": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "The supplier's own number."
                            },
                            "payment_status": {
                                "type": "string",
                                "enum": [
                                    "unpaid",
                                    "partial",
                                    "paid"
                                ],
                                "description": "How much of the invoice has been paid."
                            },
                            "match_status": {
                                "type": "string",
                                "enum": [
                                    "pending",
                                    "matched",
                                    "exception",
                                    "overridden",
                                    "not_applicable"
                                ],
                                "description": "How the invoice matched the purchase order and receipts (three-way match)."
                            },
                            "purchase_order": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/DocumentRef"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "The purchase order invoiced, if any."
                            },
                            "source_invoice": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/DocumentRef"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "For debit and credit notes."
                            },
                            "due_on": {
                                "oneOf": [
                                    {
                                        "$ref": "#/components/schemas/Date"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "When payment is due; null when no due date is set."
                            },
                            "paid": {
                                "$ref": "#/components/schemas/Decimal",
                                "description": "Paid to the vendor so far."
                            },
                            "balance": {
                                "$ref": "#/components/schemas/Decimal",
                                "description": "What is still to pay the vendor."
                            },
                            "lines": {
                                "type": "array",
                                "description": "Detail call only.",
                                "items": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/PurchaseLine"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "line_type": {
                                                    "type": "string",
                                                    "description": "What the line is for: goods, a landed cost or an expense."
                                                },
                                                "unit_of_measure": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "The unit the vendor invoiced in."
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            },
            "VendorInvoiceList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/VendorInvoice"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "VendorPayment": {
                "type": "object",
                "required": [
                    "id",
                    "number",
                    "status",
                    "vendor",
                    "branch",
                    "paid_on",
                    "method",
                    "currency",
                    "currency_amount",
                    "exchange_rate",
                    "base_amount",
                    "applications",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "Unique identifier of the vendor payment."
                    },
                    "number": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The payment's reference, e.g. `VP-2026-00005`."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "draft",
                            "issued",
                            "canceled"
                        ],
                        "description": "`draft` until issued; `canceled` once canceled."
                    },
                    "vendor": {
                        "$ref": "#/components/schemas/VendorRef",
                        "description": "The vendor."
                    },
                    "branch": {
                        "$ref": "#/components/schemas/NamedRef",
                        "description": "The branch the vendor payment belongs to."
                    },
                    "paid_on": {
                        "$ref": "#/components/schemas/Date",
                        "description": "Date of the payment, on the workspace calendar."
                    },
                    "method": {
                        "type": "string",
                        "enum": [
                            "cash",
                            "bank_transfer"
                        ],
                        "description": "How the money was paid."
                    },
                    "destination": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/PaymentDestination"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "Where the money came from."
                    },
                    "currency": {
                        "$ref": "#/components/schemas/CurrencyRef",
                        "description": "The vendor payment's currency."
                    },
                    "currency_amount": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "The payment in its own currency."
                    },
                    "exchange_rate": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "Rate from the payment's currency to the functional currency."
                    },
                    "base_amount": {
                        "$ref": "#/components/schemas/Decimal",
                        "description": "The payment in the functional currency."
                    },
                    "unapplied_amount": {
                        "description": "What an advance (a payment issued against no invoice) still has to apply; 0 for a payment that settled invoices when issued.",
                        "$ref": "#/components/schemas/Decimal"
                    },
                    "approval_status": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "not_required",
                            "pending",
                            "approved",
                            "rejected",
                            null
                        ],
                        "description": "Approval progress, when the workspace requires approval for the vendor payment."
                    },
                    "applications": {
                        "type": "array",
                        "description": "Invoices settled when the payment was issued, then later applications of an advance.",
                        "items": {
                            "type": "object",
                            "required": [
                                "vendor_invoice",
                                "applied_amount"
                            ],
                            "properties": {
                                "vendor_invoice": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/DocumentRef"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ],
                                    "description": "The vendor invoice paid."
                                },
                                "applied_amount": {
                                    "description": "In the payment's currency.",
                                    "$ref": "#/components/schemas/Decimal"
                                },
                                "applied_on": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/Date"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ],
                                    "description": "Date the amount was applied."
                                },
                                "status": {
                                    "type": "string",
                                    "enum": [
                                        "posted",
                                        "reversed"
                                    ],
                                    "description": "`posted`, or `reversed` once unapplied."
                                }
                            }
                        }
                    },
                    "notes": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Notes on the vendor payment."
                    },
                    "created_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the vendor payment was created."
                    },
                    "updated_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the vendor payment last changed. `updated_since` syncs compare against this."
                    },
                    "trashed_at": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Instant"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "description": "When the vendor payment was moved to Trash; null when it is not in Trash. Only `updated_since` syncs return trashed records."
                    }
                }
            },
            "VendorPaymentList": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/VendorPayment"
                        },
                        "description": "The records on this page."
                    },
                    "meta": {
                        "$ref": "#/components/schemas/ListMeta",
                        "description": "Paging information."
                    }
                }
            },
            "WebhookEvent": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "occurred_at",
                    "data"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/Id",
                        "description": "The event's id, also sent as `Reevio-Delivery`."
                    },
                    "type": {
                        "type": "string",
                        "examples": [
                            "invoice.issued"
                        ],
                        "description": "customer.created|updated|trashed, product.created|updated|trashed,\nsales_order.created|issued|canceled|reverted, invoice.issued|paid|credited,\ncredit_note.issued, customer_payment.posted|reversed, delivery_note.issued,\npurchase_order.issued. New types may be added.\n"
                    },
                    "occurred_at": {
                        "$ref": "#/components/schemas/Instant",
                        "description": "When the change was made."
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "object",
                            "id"
                        ],
                        "description": "The record the event is about.",
                        "properties": {
                            "object": {
                                "type": "string",
                                "examples": [
                                    "invoice"
                                ],
                                "description": "The record type: customer, product, sales_order, invoice, credit_note, customer_payment, delivery_note or purchase_order."
                            },
                            "id": {
                                "$ref": "#/components/schemas/Id",
                                "description": "The record's id; retrieve it from its endpoint."
                            },
                            "number": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "The document number; null for a draft or for master data."
                            },
                            "status": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "The record's status when the event was raised."
                            }
                        }
                    }
                }
            }
        },
        "responses": {
            "Error": {
                "description": "Any error. `code` is stable; `message` is localised by `Accept-Language`.\nSee `Error.code` for the full list.\n",
                "headers": {
                    "X-RateLimit-Limit": {
                        "$ref": "#/components/headers/RateLimitLimit"
                    },
                    "X-RateLimit-Remaining": {
                        "$ref": "#/components/headers/RateLimitRemaining"
                    },
                    "Retry-After": {
                        "$ref": "#/components/headers/RetryAfter"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "oneOf": [
                                {
                                    "$ref": "#/components/schemas/Error"
                                },
                                {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            ]
                        }
                    }
                }
            },
            "Unauthenticated": {
                "description": "Missing, malformed, expired or revoked token.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "code": "unauthenticated",
                            "message": "This endpoint requires an API token."
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "Token or account refused.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "code": "missing_scope",
                            "message": "This API token does not have the required scope.",
                            "required_scope": "sales.orders.create"
                        }
                    }
                }
            },
            "Conflict": {
                "description": "A business rule refused the action. Nothing changed.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        },
                        "example": {
                            "code": "credit_warning",
                            "message": "Acme Trading would exceed their credit limit of 10,000,000 IQD.",
                            "details": {
                                "violations": [
                                    "Acme Trading would exceed their credit limit of 10,000,000 IQD."
                                ],
                                "resend_with": "confirm_credit_warning"
                            }
                        }
                    }
                }
            },
            "BranchList": {
                "description": "Branches.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/BranchList"
                        }
                    }
                }
            },
            "WarehouseList": {
                "description": "Warehouses.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/WarehouseList"
                        }
                    }
                }
            },
            "TaxRateList": {
                "description": "Tax rates.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/TaxRateList"
                        }
                    }
                }
            },
            "PriceTierList": {
                "description": "Price tiers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/PriceTierList"
                        }
                    }
                }
            },
            "PriceListList": {
                "description": "Price lists.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/PriceListList"
                        }
                    }
                }
            },
            "CustomerCategoryList": {
                "description": "Customer categories.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/CustomerCategoryList"
                        }
                    }
                }
            },
            "ProductList": {
                "description": "Products.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ProductList"
                        }
                    }
                }
            },
            "ProductOne": {
                "description": "The product.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Product"
                                }
                            }
                        }
                    }
                }
            },
            "ProductCreated": {
                "description": "Created.",
                "headers": {
                    "Location": {
                        "$ref": "#/components/headers/Location"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Product"
                                }
                            }
                        }
                    }
                }
            },
            "ProductReplayed": {
                "description": "Idempotent replay of an earlier create.",
                "headers": {
                    "Idempotency-Replayed": {
                        "$ref": "#/components/headers/IdempotencyReplayed"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Product"
                                }
                            }
                        }
                    }
                }
            },
            "ProductCategoryList": {
                "description": "Product categories.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ProductCategoryList"
                        }
                    }
                }
            },
            "ProductCategoryOne": {
                "description": "The category.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/ProductCategory"
                                }
                            }
                        }
                    }
                }
            },
            "CustomerList": {
                "description": "Customers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/CustomerList"
                        }
                    }
                }
            },
            "CustomerOne": {
                "description": "The customer.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    }
                }
            },
            "CustomerCreated": {
                "description": "Created.",
                "headers": {
                    "Location": {
                        "$ref": "#/components/headers/Location"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    }
                }
            },
            "CustomerReplayed": {
                "description": "Idempotent replay of an earlier create.",
                "headers": {
                    "Idempotency-Replayed": {
                        "$ref": "#/components/headers/IdempotencyReplayed"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    }
                }
            },
            "VendorList": {
                "description": "Vendors.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/VendorList"
                        }
                    }
                }
            },
            "VendorOne": {
                "description": "The vendor.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Vendor"
                                }
                            }
                        }
                    }
                }
            },
            "QuotationList": {
                "description": "Quotation headers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/QuotationList"
                        }
                    }
                }
            },
            "QuotationOne": {
                "description": "The quotation.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Quotation"
                                }
                            }
                        }
                    }
                }
            },
            "SalesOrderList": {
                "description": "Sales order headers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/SalesOrderList"
                        }
                    }
                }
            },
            "SalesOrderOne": {
                "description": "The sales order.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/SalesOrder"
                                }
                            }
                        }
                    }
                }
            },
            "SalesOrderCreated": {
                "description": "Created as a draft.",
                "headers": {
                    "Location": {
                        "$ref": "#/components/headers/Location"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/SalesOrder"
                                }
                            }
                        }
                    }
                }
            },
            "SalesOrderReplayed": {
                "description": "Idempotent replay of an earlier create.",
                "headers": {
                    "Idempotency-Replayed": {
                        "$ref": "#/components/headers/IdempotencyReplayed"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/SalesOrder"
                                }
                            }
                        }
                    }
                }
            },
            "DeliveryNoteList": {
                "description": "Delivery note headers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/DeliveryNoteList"
                        }
                    }
                }
            },
            "DeliveryNoteOne": {
                "description": "The delivery note.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/DeliveryNote"
                                }
                            }
                        }
                    }
                }
            },
            "DeliveryNoteCreated": {
                "description": "Created as a draft.",
                "headers": {
                    "Location": {
                        "$ref": "#/components/headers/Location"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/DeliveryNote"
                                }
                            }
                        }
                    }
                }
            },
            "DeliveryNoteReplayed": {
                "description": "Idempotent replay of an earlier create.",
                "headers": {
                    "Idempotency-Replayed": {
                        "$ref": "#/components/headers/IdempotencyReplayed"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/DeliveryNote"
                                }
                            }
                        }
                    }
                }
            },
            "InvoiceList": {
                "description": "Invoice headers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/InvoiceList"
                        }
                    }
                }
            },
            "InvoiceOne": {
                "description": "The invoice.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Invoice"
                                }
                            }
                        }
                    }
                }
            },
            "InvoiceCreated": {
                "description": "Created as a draft.",
                "headers": {
                    "Location": {
                        "$ref": "#/components/headers/Location"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Invoice"
                                }
                            }
                        }
                    }
                }
            },
            "InvoiceReplayed": {
                "description": "Idempotent replay of an earlier create.",
                "headers": {
                    "Idempotency-Replayed": {
                        "$ref": "#/components/headers/IdempotencyReplayed"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/Invoice"
                                }
                            }
                        }
                    }
                }
            },
            "CreditNoteList": {
                "description": "Credit note headers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/CreditNoteList"
                        }
                    }
                }
            },
            "CustomerPaymentList": {
                "description": "Customer payments.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/CustomerPaymentList"
                        }
                    }
                }
            },
            "CustomerPaymentOne": {
                "description": "The payment.",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/CustomerPayment"
                                }
                            }
                        }
                    }
                }
            },
            "CustomerPaymentCreated": {
                "description": "Recorded.",
                "headers": {
                    "Location": {
                        "$ref": "#/components/headers/Location"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/CustomerPayment"
                                }
                            }
                        }
                    }
                }
            },
            "CustomerPaymentReplayed": {
                "description": "Idempotent replay of an earlier create.",
                "headers": {
                    "Idempotency-Replayed": {
                        "$ref": "#/components/headers/IdempotencyReplayed"
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "required": [
                                "data"
                            ],
                            "properties": {
                                "data": {
                                    "$ref": "#/components/schemas/CustomerPayment"
                                }
                            }
                        }
                    }
                }
            },
            "TreasuryLocationList": {
                "description": "Cash locations.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/TreasuryLocationList"
                        }
                    }
                }
            },
            "BankAccountList": {
                "description": "Bank accounts.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/BankAccountList"
                        }
                    }
                }
            },
            "PurchaseOrderList": {
                "description": "Purchase order headers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/PurchaseOrderList"
                        }
                    }
                }
            },
            "VendorInvoiceList": {
                "description": "Vendor invoice headers.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/VendorInvoiceList"
                        }
                    }
                }
            },
            "VendorPaymentList": {
                "description": "Vendor payments.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/VendorPaymentList"
                        }
                    }
                }
            }
        },
        "headers": {
            "Location": {
                "description": "URL of the created record.",
                "schema": {
                    "type": "string",
                    "format": "uri"
                }
            },
            "IdempotencyReplayed": {
                "description": "Present and `true` when this is a replayed response.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "true"
                    ]
                }
            },
            "RateLimitLimit": {
                "schema": {
                    "type": "integer"
                }
            },
            "RateLimitRemaining": {
                "schema": {
                    "type": "integer"
                }
            },
            "RetryAfter": {
                "description": "Seconds to wait. Sent with `429` and `503`.",
                "schema": {
                    "type": "integer"
                }
            }
        },
        "parameters": {
            "Id": {
                "name": "id",
                "in": "path",
                "required": true,
                "schema": {
                    "$ref": "#/components/schemas/Id"
                },
                "description": "The record's id."
            },
            "Limit": {
                "name": "limit",
                "in": "query",
                "description": "Rows per page. Not allowed together with `page_cursor`.",
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "default": 50
                }
            },
            "PageCursor": {
                "name": "page_cursor",
                "in": "query",
                "description": "`meta.next_page_cursor` from the previous page. Send it alone; it carries the filters and page size.",
                "schema": {
                    "type": "string"
                }
            },
            "UpdatedSince": {
                "name": "updated_since",
                "in": "query",
                "description": "Sync mode. Records whose own row changed at or after this instant, oldest first, trashed ones included with `trashed_at` set. May repeat a record; never skips one.",
                "schema": {
                    "$ref": "#/components/schemas/Instant"
                }
            },
            "IssuedFrom": {
                "name": "issued_from",
                "in": "query",
                "description": "First issue date, inclusive.",
                "schema": {
                    "$ref": "#/components/schemas/Date"
                }
            },
            "IssuedTo": {
                "name": "issued_to",
                "in": "query",
                "description": "Last issue date, inclusive.",
                "schema": {
                    "$ref": "#/components/schemas/Date"
                }
            },
            "StatusFilter": {
                "name": "status",
                "in": "query",
                "description": "Comma-separated statuses of the resource.",
                "schema": {
                    "type": "string"
                }
            },
            "CustomerIdFilter": {
                "name": "customer_id",
                "in": "query",
                "schema": {
                    "$ref": "#/components/schemas/Id"
                },
                "description": "Only this customer's records, by id."
            },
            "VendorIdFilter": {
                "name": "vendor_id",
                "in": "query",
                "schema": {
                    "$ref": "#/components/schemas/Id"
                },
                "description": "Only this vendor's records, by id."
            },
            "BranchIdFilter": {
                "name": "branch_id",
                "in": "query",
                "schema": {
                    "$ref": "#/components/schemas/Id"
                },
                "description": "Only this branch's records, by id."
            },
            "IdempotencyKey": {
                "name": "Idempotency-Key",
                "in": "header",
                "description": "Unique per logical operation. A repeat within 24 hours returns the first response with `Idempotency-Replayed`; the same key with a different body is `422 idempotency_key_reused`.",
                "schema": {
                    "type": "string",
                    "maxLength": 255
                }
            }
        }
    }
}