{
  "openapi": "3.1.0",
  "info": {
    "title": "InventoryMod API",
    "version": "1.0",
    "description": "HTTP API of InventoryMod: products, warehouses, stock, orders, purchasing and reports. Every request needs campaign_id (the workspace of the key). Reads are GET, writes are POST with a write-scoped key in a header. Responses are { \"data\": … }; errors are { \"error\": \"…\" }. Human-readable reference: https://inventorymod.com/api-docs/"
  },
  "externalDocs": {
    "url": "https://inventorymod.com/api-docs/"
  },
  "servers": [
    {
      "url": "https://app.inventorymod.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    },
    {
      "apiKeyQuery": []
    }
  ],
  "tags": [
    {
      "name": "Products",
      "description": "Catalog items: create, update, search and delete products, look them up by SKU or barcode."
    },
    {
      "name": "Bill of materials",
      "description": "Components of assembled products and kits."
    },
    {
      "name": "Variant options",
      "description": "Option axes of a model, such as Size or Color."
    },
    {
      "name": "Variant option values",
      "description": "Values of an option axis, such as S, M, L."
    },
    {
      "name": "Variants",
      "description": "Generate and manage the variants of a model."
    },
    {
      "name": "Product images",
      "description": "Image gallery of a product: links or uploaded files."
    },
    {
      "name": "Barcodes",
      "description": "Multiple barcodes per product, one of them primary."
    },
    {
      "name": "Warehouses",
      "description": "Warehouses and stock locations."
    },
    {
      "name": "Categories",
      "description": "Product categories."
    },
    {
      "name": "Manufacturers",
      "description": "Product manufacturers and brands."
    },
    {
      "name": "Currencies",
      "description": "Currencies and exchange rates to the base currency."
    },
    {
      "name": "Suppliers",
      "description": "Suppliers for purchase orders."
    },
    {
      "name": "Customers",
      "description": "Customers for sales orders."
    },
    {
      "name": "Custom fields",
      "description": "Your own product fields."
    },
    {
      "name": "Stock operations",
      "description": "Receive, issue, adjust, transfer and reserve stock; stock counts and integrity checks."
    },
    {
      "name": "Assembly",
      "description": "Assemble and disassemble products from components."
    },
    {
      "name": "Stock balances",
      "description": "Quantity, reserved and available stock per warehouse."
    },
    {
      "name": "Stock movements",
      "description": "History of all stock movements."
    },
    {
      "name": "Reservations",
      "description": "Stock reserved for customers and orders."
    },
    {
      "name": "Sales orders",
      "description": "Customer orders: create, reserve, ship and cancel."
    },
    {
      "name": "Purchase orders",
      "description": "Orders to suppliers: create, receive and cancel."
    },
    {
      "name": "Reports",
      "description": "Inventory, sales and purchasing reports and the dashboard."
    },
    {
      "name": "Settings",
      "description": "Workspace settings."
    },
    {
      "name": "Import",
      "description": "Bulk import of products, stock, documents and reference data."
    },
    {
      "name": "Maintenance",
      "description": "Data cleanup operations."
    },
    {
      "name": "Activity log",
      "description": "Who did what and when."
    }
  ],
  "paths": {
    "/api/rpc/products/list": {
      "get": {
        "operationId": "listProducts",
        "summary": "List products",
        "description": "List products, optionally filtered by category, manufacturer, currency or kind. Variant parents (models) are excluded by default; pass includeParents: true to include them.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "manufacturerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "currencyId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "isArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "kinds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeParents",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/products"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/search": {
      "get": {
        "operationId": "getProducts",
        "summary": "Search products",
        "description": "Paginated product list with filters, search, stock status and sorting, plus the total count.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "manufacturerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "currencyId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "isArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "stockStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "in",
                "out",
                "low"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "sku",
                "price",
                "isArchived",
                "updatedAtUtc"
              ]
            }
          },
          {
            "name": "sortCustomFieldId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "lite",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "kinds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "variantMode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "grouped",
                "flat",
                "all"
              ]
            }
          },
          {
            "name": "parentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "parentIsNull",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/products"
                          }
                        },
                        "totalCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/setKind": {
      "post": {
        "operationId": "setProductKind",
        "summary": "Change product kind",
        "description": "Change the product kind. This is the only way to change the kind of an existing product.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "opts": {}
                }
              },
              "example": {
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/kindFacts": {
      "get": {
        "operationId": "kindChangeFacts",
        "summary": "Get kind change facts",
        "description": "Facts about a product that determine which kind changes are allowed.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/components/list": {
      "get": {
        "operationId": "listComponents",
        "summary": "List components",
        "description": "Components of a product. warehouseId selects the warehouse(s) for the “available” column; without it, stock is summed across all warehouses.",
        "tags": [
          "Bill of materials"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/components/set": {
      "post": {
        "operationId": "setComponent",
        "summary": "Add or update a component",
        "description": "Add a component or update its quantity. The quantity must be positive, the component must be a stocked product, cycles are rejected, and the parent must be an assembled product or a kit.",
        "tags": [
          "Bill of materials"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "componentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/components/delete": {
      "post": {
        "operationId": "deleteComponent",
        "summary": "Remove a component",
        "description": "Remove a component from a product.",
        "tags": [
          "Bill of materials"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "componentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/components/reorder": {
      "post": {
        "operationId": "reorderComponents",
        "summary": "Reorder components",
        "description": "Reorder components. componentIds must contain exactly the current set of component ids.",
        "tags": [
          "Bill of materials"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "componentIds": {}
                }
              },
              "example": {
                "componentIds": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/components/whereUsed": {
      "get": {
        "operationId": "whereUsed",
        "summary": "Where a product is used",
        "description": "Products and kits that use this product as a component.",
        "tags": [
          "Bill of materials"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/components/forbidden": {
      "get": {
        "operationId": "forbiddenComponentIds",
        "summary": "Products not allowed as components",
        "description": "Ids of products that cannot be added as components of productId (the product itself and its ancestors).",
        "tags": [
          "Bill of materials"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/components/cost": {
      "get": {
        "operationId": "calcAssemblyCost",
        "summary": "Calculate assembly cost",
        "description": "Unit cost of an assembled product from current component purchase prices, plus labour cost.",
        "tags": [
          "Bill of materials"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantOptions/list": {
      "get": {
        "operationId": "listOptions",
        "summary": "List option axes",
        "description": "Option axes of a model (e.g. Size, Color) with their values and the number of variants per value.",
        "tags": [
          "Variant options"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantOptions/create": {
      "post": {
        "operationId": "createOption",
        "summary": "Create an option axis",
        "description": "Add an option axis to a model. If the model already has variants, defaultValue is required.",
        "tags": [
          "Variant options"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {},
                  "input": {}
                }
              },
              "example": {
                "name": {},
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantOptions/update": {
      "post": {
        "operationId": "updateOption",
        "summary": "Rename an option axis",
        "description": "Rename an option axis. Variant names are updated accordingly.",
        "tags": [
          "Variant options"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "optionId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "patch": {}
                }
              },
              "example": {
                "patch": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantOptions/delete": {
      "post": {
        "operationId": "deleteOption",
        "summary": "Delete an option axis",
        "description": "Delete an option axis. Allowed when the model has no variants, or when variant combinations remain unique without it.",
        "tags": [
          "Variant options"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "optionId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantOptions/reorder": {
      "post": {
        "operationId": "reorderOptions",
        "summary": "Reorder option axes",
        "description": "Reorder option axes. This defines the order of values in variant names.",
        "tags": [
          "Variant options"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "optionIds": {}
                }
              },
              "example": {
                "optionIds": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantValues/create": {
      "post": {
        "operationId": "createOptionValue",
        "summary": "Add an option value",
        "description": "Add a value to an option axis. code is used in variant SKUs (transliterated from the value by default).",
        "tags": [
          "Variant option values"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "optionId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {},
                  "code": {}
                }
              },
              "example": {
                "value": {},
                "code": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantValues/update": {
      "post": {
        "operationId": "updateOptionValue",
        "summary": "Update an option value",
        "description": "Change an option value or its code. Affected variant names are updated.",
        "tags": [
          "Variant option values"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "valueId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "patch": {}
                }
              },
              "example": {
                "patch": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantValues/delete": {
      "post": {
        "operationId": "deleteOptionValue",
        "summary": "Delete an option value",
        "description": "Delete an option value. Allowed only if no variant uses it.",
        "tags": [
          "Variant option values"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "valueId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/variantValues/reorder": {
      "post": {
        "operationId": "reorderOptionValues",
        "summary": "Reorder option values",
        "description": "Reorder the values of an option axis.",
        "tags": [
          "Variant option values"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "optionId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "valueIds": {}
                }
              },
              "example": {
                "valueIds": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variants/list": {
      "get": {
        "operationId": "listVariants",
        "summary": "List variants",
        "description": "Variants of one or more models, with their option values and stock.",
        "tags": [
          "Variants"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "parentIds",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/variants/generate": {
      "post": {
        "operationId": "generateVariants",
        "summary": "Generate variants",
        "description": "Generate variants for all combinations of option values. Fields are copied from the model, names and SKUs are built automatically (-2, -3 suffixes on collision). Existing combinations are skipped and reported.",
        "tags": [
          "Variants"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "parentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variants/setValues": {
      "post": {
        "operationId": "setVariantValues",
        "summary": "Change variant option values",
        "description": "Change the option values of an existing variant. The new combination must be unique.",
        "tags": [
          "Variants"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "variantId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "values": {}
                }
              },
              "example": {
                "values": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variants/attach": {
      "post": {
        "operationId": "attachVariant",
        "summary": "Attach a product as a variant",
        "description": "Attach an existing product to a model as a variant. Its name is kept.",
        "tags": [
          "Variants"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "parentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "values": {}
                }
              },
              "example": {
                "values": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/variants/detach": {
      "post": {
        "operationId": "detachVariant",
        "summary": "Detach a variant",
        "description": "Detach a variant, turning it into a regular product. Its option values are removed, its name is kept.",
        "tags": [
          "Variants"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "variantId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/variants/matrix": {
      "get": {
        "operationId": "getVariantMatrix",
        "summary": "Get the variant matrix",
        "description": "Data for an option × option matrix, with stock for every warehouse in each cell.",
        "tags": [
          "Variants"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "parentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/exportPage": {
      "get": {
        "operationId": "listProductsForExport",
        "summary": "Export products",
        "description": "Export products in batches using keyset pagination (id > afterId). Includes archived products, ordered by id.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "afterId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/products"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/orderInfo": {
      "get": {
        "operationId": "getProductOrderInfo",
        "summary": "Get product info for an order line",
        "description": "Price, currency and available stock per warehouse for an order line. For a kit, also returns its computed stock and components.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/get": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get a product",
        "description": "Get a product by id.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/products"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/getBySku": {
      "get": {
        "operationId": "findBySku",
        "summary": "Find a product by SKU",
        "description": "Find a product by SKU.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sku",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/products"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/getByCode": {
      "get": {
        "operationId": "findBySkuOrBarcode",
        "summary": "Find a product by SKU or barcode",
        "description": "Find a product by SKU or barcode.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "value",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/products"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/priceHistory": {
      "get": {
        "operationId": "getPriceHistory",
        "summary": "Get price history",
        "description": "Price history of a product.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/priceHistory"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/create": {
      "post": {
        "operationId": "createProduct",
        "summary": "Create a product",
        "description": "Create a product. Returns its id.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product": {
                    "$ref": "#/components/schemas/productsInput"
                  }
                }
              },
              "example": {
                "product": {
                  "sku": "ABC-1",
                  "barcode": "CODE",
                  "name": "Sample",
                  "manufacturerId": 1,
                  "categoryId": 1,
                  "price": 9.99,
                  "priceOld": 9.99,
                  "rrp": 9.99,
                  "currencyId": 1,
                  "purchaseCost": 9.99,
                  "purchaseCostCurrencyId": 1,
                  "url": "string",
                  "imageUrl": "string",
                  "minQty": 9.99,
                  "customFieldValues": {},
                  "isArchived": false,
                  "kind": "simple",
                  "laborCost": 9.99,
                  "laborCostCurrencyId": 1
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/update": {
      "post": {
        "operationId": "updateProduct",
        "summary": "Update a product",
        "description": "Update product fields. The kind field is ignored — use setProductKind.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "patch": {
                    "$ref": "#/components/schemas/productsInput"
                  }
                }
              },
              "example": {
                "patch": {
                  "sku": "ABC-1",
                  "barcode": "CODE",
                  "name": "Sample",
                  "manufacturerId": 1,
                  "categoryId": 1,
                  "price": 9.99,
                  "priceOld": 9.99,
                  "rrp": 9.99,
                  "currencyId": 1,
                  "purchaseCost": 9.99,
                  "purchaseCostCurrencyId": 1,
                  "url": "string",
                  "imageUrl": "string",
                  "minQty": 9.99,
                  "customFieldValues": {},
                  "isArchived": false,
                  "kind": "simple",
                  "laborCost": 9.99,
                  "laborCostCurrencyId": 1
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/bulkUpdate": {
      "post": {
        "operationId": "bulkUpdateProducts",
        "summary": "Bulk update products",
        "description": "Apply the same changes to several products by id.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {},
                  "patch": {}
                }
              },
              "example": {
                "ids": {},
                "patch": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/upsert": {
      "post": {
        "operationId": "upsertBySku",
        "summary": "Create or update a product by SKU",
        "description": "Create a product, or update the existing one with the same SKU.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product": {
                    "$ref": "#/components/schemas/productsInput"
                  }
                }
              },
              "example": {
                "product": {
                  "sku": "ABC-1",
                  "barcode": "CODE",
                  "name": "Sample",
                  "manufacturerId": 1,
                  "categoryId": 1,
                  "price": 9.99,
                  "priceOld": 9.99,
                  "rrp": 9.99,
                  "currencyId": 1,
                  "purchaseCost": 9.99,
                  "purchaseCostCurrencyId": 1,
                  "url": "string",
                  "imageUrl": "string",
                  "minQty": 9.99,
                  "customFieldValues": {},
                  "isArchived": false,
                  "kind": "simple",
                  "laborCost": 9.99,
                  "laborCostCurrencyId": 1
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/relations": {
      "get": {
        "operationId": "getProductRelations",
        "summary": "Get product references",
        "description": "Count everything that references a product (movements, orders, reservations, stock) — useful before deleting it.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/products/delete": {
      "post": {
        "operationId": "deleteProduct",
        "summary": "Delete a product",
        "description": "Delete a product. By default it fails if the product has movements, orders, reservations or stock — archive it instead. With cascade=true, all related records are deleted as well.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "opts": {}
                }
              },
              "example": {
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/images/list": {
      "get": {
        "operationId": "listProductImages",
        "summary": "List product images",
        "description": "Images of a product (metadata only, no bytes). The cover image comes first.",
        "tags": [
          "Product images"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/images/getData": {
      "get": {
        "operationId": "getProductImageData",
        "summary": "Get image content",
        "description": "Image content: for a URL image returns the link, for an uploaded image returns base64 data.",
        "tags": [
          "Product images"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "imageId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/images/firstImages": {
      "post": {
        "operationId": "listFirstImages",
        "summary": "Get cover images",
        "description": "The cover image of each product in the list — for thumbnails.",
        "tags": [
          "Product images"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "productIds": {}
                }
              },
              "example": {
                "productIds": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/images/add": {
      "post": {
        "operationId": "addProductImage",
        "summary": "Add an image",
        "description": "Add an image to the end of the gallery: either kind=\"url\" with url, or kind=\"blob\" with dataBase64 (and mimeType). The first image becomes the cover.",
        "tags": [
          "Product images"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/images/delete": {
      "post": {
        "operationId": "deleteProductImage",
        "summary": "Delete an image",
        "description": "Delete an image.",
        "tags": [
          "Product images"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "imageId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/images/reorder": {
      "post": {
        "operationId": "reorderProductImages",
        "summary": "Reorder images",
        "description": "Reorder product images; the first id becomes the cover. Ids not listed are left unchanged.",
        "tags": [
          "Product images"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderedIds": {}
                }
              },
              "example": {
                "orderedIds": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/barcodes/list": {
      "get": {
        "operationId": "listProductBarcodes",
        "summary": "List barcodes",
        "description": "All barcodes of a product, primary first.",
        "tags": [
          "Barcodes"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/barcodes/add": {
      "post": {
        "operationId": "addProductBarcode",
        "summary": "Add a barcode",
        "description": "Add a barcode. It is normalized and its type is detected automatically. The first barcode, or one added with isPrimary, becomes primary.",
        "tags": [
          "Barcodes"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/barcodes/setPrimary": {
      "post": {
        "operationId": "setPrimaryBarcode",
        "summary": "Set the primary barcode",
        "description": "Make a barcode the primary one.",
        "tags": [
          "Barcodes"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "barcodeId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/barcodes/delete": {
      "post": {
        "operationId": "deleteProductBarcode",
        "summary": "Delete a barcode",
        "description": "Delete a barcode. If it was primary, the next remaining one becomes primary.",
        "tags": [
          "Barcodes"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "barcodeId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/warehouses/list": {
      "get": {
        "operationId": "listWarehouses",
        "summary": "List warehouses",
        "description": "List warehouses. Archived ones are included only with includeArchived.",
        "tags": [
          "Warehouses"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/warehouses"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/warehouses/create": {
      "post": {
        "operationId": "createWarehouse",
        "summary": "Create a warehouse",
        "description": "Create a warehouse.",
        "tags": [
          "Warehouses"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "warehouse": {
                    "$ref": "#/components/schemas/warehousesInput"
                  }
                }
              },
              "example": {
                "warehouse": {
                  "name": "Sample",
                  "code": "CODE",
                  "type": "string",
                  "address": "string",
                  "contact": "string",
                  "comment": "string",
                  "capacity": 9.99,
                  "isDefault": false,
                  "isArchived": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/warehouses/update": {
      "post": {
        "operationId": "updateWarehouse",
        "summary": "Update a warehouse",
        "description": "Update a warehouse. Its type can be changed, or it can be archived, only when it holds no stock, reservations or open orders.",
        "tags": [
          "Warehouses"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/warehousesInput"
                  }
                }
              },
              "example": {
                "data": {
                  "name": "Sample",
                  "code": "CODE",
                  "type": "string",
                  "address": "string",
                  "contact": "string",
                  "comment": "string",
                  "capacity": 9.99,
                  "isDefault": false,
                  "isArchived": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/warehouses/delete": {
      "post": {
        "operationId": "deleteWarehouse",
        "summary": "Delete a warehouse",
        "description": "Delete a warehouse. Not allowed if it holds stock, active reservations or open orders; a warehouse with history can only be archived.",
        "tags": [
          "Warehouses"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/warehouses/setDefault": {
      "post": {
        "operationId": "setDefaultWarehouse",
        "summary": "Set the default warehouse",
        "description": "Set the default warehouse. It must be active and not a supplier warehouse.",
        "tags": [
          "Warehouses"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/categories/list": {
      "get": {
        "operationId": "listCategories",
        "summary": "List categories",
        "description": "List categories.",
        "tags": [
          "Categories"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/categories"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/categories/create": {
      "post": {
        "operationId": "createCategory",
        "summary": "Create a category",
        "description": "Create a category.",
        "tags": [
          "Categories"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "category": {
                    "$ref": "#/components/schemas/categoriesInput"
                  }
                }
              },
              "example": {
                "category": {
                  "name": "Sample",
                  "parentId": 1
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/categories/update": {
      "post": {
        "operationId": "updateCategory",
        "summary": "Update a category",
        "description": "Update a category.",
        "tags": [
          "Categories"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/categoriesInput"
                  }
                }
              },
              "example": {
                "data": {
                  "name": "Sample",
                  "parentId": 1
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/categories/delete": {
      "post": {
        "operationId": "deleteCategory",
        "summary": "Delete a category",
        "description": "Delete a category.",
        "tags": [
          "Categories"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/manufacturers/list": {
      "get": {
        "operationId": "listManufacturers",
        "summary": "List manufacturers",
        "description": "List manufacturers.",
        "tags": [
          "Manufacturers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/manufacturers"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/manufacturers/create": {
      "post": {
        "operationId": "createManufacturer",
        "summary": "Create a manufacturer",
        "description": "Create a manufacturer.",
        "tags": [
          "Manufacturers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "manufacturer": {
                    "$ref": "#/components/schemas/manufacturersInput"
                  }
                }
              },
              "example": {
                "manufacturer": {
                  "name": "Sample"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/manufacturers/update": {
      "post": {
        "operationId": "updateManufacturer",
        "summary": "Update a manufacturer",
        "description": "Update a manufacturer.",
        "tags": [
          "Manufacturers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/manufacturersInput"
                  }
                }
              },
              "example": {
                "data": {
                  "name": "Sample"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/manufacturers/delete": {
      "post": {
        "operationId": "deleteManufacturer",
        "summary": "Delete a manufacturer",
        "description": "Delete a manufacturer.",
        "tags": [
          "Manufacturers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/currencies/list": {
      "get": {
        "operationId": "listCurrencies",
        "summary": "List currencies",
        "description": "List currencies.",
        "tags": [
          "Currencies"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/currencies"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/currencies/create": {
      "post": {
        "operationId": "createCurrency",
        "summary": "Create a currency",
        "description": "Create a currency.",
        "tags": [
          "Currencies"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "currency": {
                    "$ref": "#/components/schemas/currenciesInput"
                  }
                }
              },
              "example": {
                "currency": {
                  "name": "Sample",
                  "rate": 9.99,
                  "isDefault": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/currencies/update": {
      "post": {
        "operationId": "updateCurrency",
        "summary": "Update a currency",
        "description": "Update a currency.",
        "tags": [
          "Currencies"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/currenciesInput"
                  }
                }
              },
              "example": {
                "data": {
                  "name": "Sample",
                  "rate": 9.99,
                  "isDefault": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/currencies/delete": {
      "post": {
        "operationId": "deleteCurrency",
        "summary": "Delete a currency",
        "description": "Delete a currency.",
        "tags": [
          "Currencies"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/currencies/setDefault": {
      "post": {
        "operationId": "setDefaultCurrency",
        "summary": "Set the base currency",
        "description": "Set the base currency. All rates are relative to it, so they are recalculated: rate := rate / rate of the new base currency.",
        "tags": [
          "Currencies"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/suppliers/list": {
      "get": {
        "operationId": "listSuppliers",
        "summary": "List suppliers",
        "description": "List suppliers.",
        "tags": [
          "Suppliers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/suppliers"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/suppliers/create": {
      "post": {
        "operationId": "createSupplier",
        "summary": "Create a supplier",
        "description": "Create a supplier.",
        "tags": [
          "Suppliers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "supplier": {
                    "$ref": "#/components/schemas/suppliersInput"
                  }
                }
              },
              "example": {
                "supplier": {
                  "name": "Sample",
                  "code": "CODE",
                  "contact": "string",
                  "email": "user@example.com",
                  "phone": "string",
                  "address": "string",
                  "comment": "string",
                  "isArchived": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/suppliers/update": {
      "post": {
        "operationId": "updateSupplier",
        "summary": "Update a supplier",
        "description": "Update a supplier.",
        "tags": [
          "Suppliers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/suppliersInput"
                  }
                }
              },
              "example": {
                "data": {
                  "name": "Sample",
                  "code": "CODE",
                  "contact": "string",
                  "email": "user@example.com",
                  "phone": "string",
                  "address": "string",
                  "comment": "string",
                  "isArchived": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/suppliers/delete": {
      "post": {
        "operationId": "deleteSupplier",
        "summary": "Delete a supplier",
        "description": "Delete a supplier. Suppliers with purchase orders can only be archived.",
        "tags": [
          "Suppliers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/customers/list": {
      "get": {
        "operationId": "listCustomers",
        "summary": "List customers",
        "description": "List customers.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/customers"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/customers/create": {
      "post": {
        "operationId": "createCustomer",
        "summary": "Create a customer",
        "description": "Create a customer.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customer": {
                    "$ref": "#/components/schemas/customersInput"
                  }
                }
              },
              "example": {
                "customer": {
                  "name": "Sample",
                  "code": "CODE",
                  "contact": "string",
                  "email": "user@example.com",
                  "phone": "string",
                  "address": "string",
                  "comment": "string",
                  "isArchived": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/customers/update": {
      "post": {
        "operationId": "updateCustomer",
        "summary": "Update a customer",
        "description": "Update a customer.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "$ref": "#/components/schemas/customersInput"
                  }
                }
              },
              "example": {
                "data": {
                  "name": "Sample",
                  "code": "CODE",
                  "contact": "string",
                  "email": "user@example.com",
                  "phone": "string",
                  "address": "string",
                  "comment": "string",
                  "isArchived": false
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/customers/delete": {
      "post": {
        "operationId": "deleteCustomer",
        "summary": "Delete a customer",
        "description": "Delete a customer. Customers with orders can only be archived.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/customFields/list": {
      "get": {
        "operationId": "listCustomFields",
        "summary": "List custom fields",
        "description": "List custom product fields.",
        "tags": [
          "Custom fields"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/customFields"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/customFields/create": {
      "post": {
        "operationId": "createCustomField",
        "summary": "Create a custom field",
        "description": "Create a custom product field. Returns its id.",
        "tags": [
          "Custom fields"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {}
                }
              },
              "example": {
                "data": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/customFields/update": {
      "post": {
        "operationId": "updateCustomField",
        "summary": "Update a custom field",
        "description": "Rename a custom field or change its type.",
        "tags": [
          "Custom fields"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {}
                }
              },
              "example": {
                "data": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/customFields/delete": {
      "post": {
        "operationId": "deleteCustomField",
        "summary": "Delete a custom field",
        "description": "Delete a custom field.",
        "tags": [
          "Custom fields"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/in": {
      "post": {
        "operationId": "stockIn",
        "summary": "Receive stock",
        "description": "Receive stock into a warehouse. Returns the operation id.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/out": {
      "post": {
        "operationId": "stockOut",
        "summary": "Issue stock",
        "description": "Issue stock from a warehouse.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/adjust": {
      "post": {
        "operationId": "adjust",
        "summary": "Adjust stock",
        "description": "Set stock to the given quantity.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/transfer": {
      "post": {
        "operationId": "transfer",
        "summary": "Transfer stock",
        "description": "Move stock between warehouses.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/reserve": {
      "post": {
        "operationId": "reserve",
        "summary": "Reserve stock",
        "description": "Reserve stock.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/reserveBulk": {
      "post": {
        "operationId": "reserveBulk",
        "summary": "Reserve stock in bulk",
        "description": "Reserve stock in several warehouses in a single transaction: if any reservation fails, nothing is saved.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "inputs": {}
                }
              },
              "example": {
                "inputs": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/unreserve": {
      "post": {
        "operationId": "unreserve",
        "summary": "Release a reservation",
        "description": "Release a reservation.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/consumeReservation": {
      "post": {
        "operationId": "consumeReservation",
        "summary": "Ship reserved stock",
        "description": "Ship reserved stock.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/return": {
      "post": {
        "operationId": "returnIn",
        "summary": "Receive a return",
        "description": "Receive a customer return.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/writeOff": {
      "post": {
        "operationId": "writeOff",
        "summary": "Write off stock",
        "description": "Write off stock.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/bulk": {
      "post": {
        "operationId": "bulkProcess",
        "summary": "Run stock operations in bulk",
        "description": "Run a batch of stock operations.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/undoMovement": {
      "post": {
        "operationId": "undoMovement",
        "summary": "Undo a movement",
        "description": "Undo a single stock movement within the undo window. Assembly movements can only be undone as a whole operation; a movement can be undone once.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "movementId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/assembly/assemble": {
      "post": {
        "operationId": "assemble",
        "summary": "Assemble products",
        "description": "Assemble N units: consumes components and adds the finished product at its computed cost.",
        "tags": [
          "Assembly"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/assembly/disassemble": {
      "post": {
        "operationId": "disassemble",
        "summary": "Disassemble products",
        "description": "Disassemble N units according to the current bill of materials, returning components to stock.",
        "tags": [
          "Assembly"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/assembly/undo": {
      "post": {
        "operationId": "undoOperation",
        "summary": "Undo an assembly",
        "description": "Undo an entire assembly or disassembly operation within the undo window. A purchase price changed by the assembly is restored if it has not changed since.",
        "tags": [
          "Assembly"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "operationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/assembly/buildable": {
      "get": {
        "operationId": "calcBuildable",
        "summary": "How many can be assembled",
        "description": "How many units can be assembled in a warehouse from the stock of direct components.",
        "tags": [
          "Assembly"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/balances/get": {
      "get": {
        "operationId": "getBalance",
        "summary": "Get product stock",
        "description": "Stock of a product in a warehouse: quantity, reserved and available.",
        "tags": [
          "Stock balances"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/stockBalances"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/balances/list": {
      "get": {
        "operationId": "listBalances",
        "summary": "List stock balances",
        "description": "Stock balances, optionally for one warehouse.",
        "tags": [
          "Stock balances"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/stockBalances"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/balances/page": {
      "get": {
        "operationId": "getStockBalances",
        "summary": "Search stock balances",
        "description": "Paginated stock balances with warehouse and status filters, search by name or SKU, and sorting.",
        "tags": [
          "Stock balances"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stockStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "in",
                "out",
                "low"
              ]
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "product",
                "warehouse",
                "qty",
                "reservedQty",
                "availableQty",
                "lastMovementAtUtc"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "parentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/stockBalances"
                          }
                        },
                        "totalCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/balances/warehouseTotals": {
      "get": {
        "operationId": "getWarehouseStockTotals",
        "summary": "Stock totals per warehouse",
        "description": "Total physical stock per warehouse.",
        "tags": [
          "Stock balances"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/balances/kits": {
      "get": {
        "operationId": "getVirtualKitBalances",
        "summary": "Kit availability",
        "description": "Paginated kits with their computed stock.",
        "tags": [
          "Stock balances"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {}
                        },
                        "totalCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/integrityCheck": {
      "get": {
        "operationId": "checkStockIntegrity",
        "summary": "Check stock integrity",
        "description": "Report stock inconsistencies. Read-only.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/integrityRepair": {
      "post": {
        "operationId": "repairStockIntegrity",
        "summary": "Repair stock integrity",
        "description": "Fix stock inconsistencies: recalculates reserved and available quantities. Physical stock is not changed; if the movement log disagrees with it, a corrective adjustment is recorded.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/reconcile": {
      "post": {
        "operationId": "reconcileStock",
        "summary": "Reconcile stock with a file",
        "description": "Compare uploaded counts ({sku, warehouse, uploadedQty}) with current stock and return the differences. Warehouses match by name (case-insensitive) or id.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {}
                }
              },
              "example": {
                "rows": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/countCheck": {
      "post": {
        "operationId": "reconcileCount",
        "summary": "Reconcile a stock count",
        "description": "Compare a stock count with current balances. Duplicate (SKU, warehouse) rows are summed; invalid quantities and archived or supplier warehouses are reported as row errors.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {},
                  "opts": {}
                }
              },
              "example": {
                "rows": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/stock/countApply": {
      "post": {
        "operationId": "applyCount",
        "summary": "Apply a stock count",
        "description": "Apply a stock count across all warehouses in one transaction. A row is applied only if stock has not changed since reconciliation; otherwise it is returned in changed.",
        "tags": [
          "Stock operations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/movements/list": {
      "get": {
        "operationId": "listMovements",
        "summary": "List movements",
        "description": "Stock movements, with optional filters.",
        "tags": [
          "Stock movements"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "movementType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "operationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/stockMovements"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/movements/page": {
      "get": {
        "operationId": "getMovements",
        "summary": "Search movements",
        "description": "Paginated stock movements.",
        "tags": [
          "Stock movements"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "movementType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "operationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAtUtc",
                "movementType",
                "product",
                "warehouse",
                "qtyDelta",
                "qtyAfter",
                "purchasePrice",
                "documentNumber"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/stockMovements"
                          }
                        },
                        "totalCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/reservations/list": {
      "get": {
        "operationId": "listReservations",
        "summary": "List reservations",
        "description": "Reservations, optionally filtered by status or date. Expired reservations are released first.",
        "tags": [
          "Reservations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/reservations"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/reservations/page": {
      "get": {
        "operationId": "getReservations",
        "summary": "Search reservations",
        "description": "Paginated reservations with filters, search and sorting. Returns {items, totalCount}.",
        "tags": [
          "Reservations"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAtUtc",
                "product",
                "warehouse",
                "qtyReserved",
                "status",
                "expiresAtUtc",
                "documentNumber"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/reservations"
                          }
                        },
                        "totalCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/list": {
      "get": {
        "operationId": "listOrders",
        "summary": "List sales orders",
        "description": "List sales orders.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/orders"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/search": {
      "get": {
        "operationId": "getOrders",
        "summary": "Search sales orders",
        "description": "Paginated sales orders.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/orders"
                          }
                        },
                        "totalCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/get": {
      "get": {
        "operationId": "getOrder",
        "summary": "Get a sales order",
        "description": "Get a sales order with its lines.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/orders"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/create": {
      "post": {
        "operationId": "createOrder",
        "summary": "Create a sales order",
        "description": "Create a sales order.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/nextNumber": {
      "get": {
        "operationId": "nextOrderNumber",
        "summary": "Next order number",
        "description": "Next free document number for a prefix (e.g. “ORD-20261006-”).",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "prefix",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/update": {
      "post": {
        "operationId": "updateOrder",
        "summary": "Update a sales order",
        "description": "Update a sales order (not shipped or cancelled). Lines are the full list: with id — existing, without id — new, omitted — deleted. Reservations are adjusted automatically.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/reserve": {
      "post": {
        "operationId": "reserveOrder",
        "summary": "Reserve stock for an order",
        "description": "Reserve stock for an order. Reserves what is available; a partial reservation sets the status to “Partially reserved”. Fails only if nothing could be reserved.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/ship": {
      "post": {
        "operationId": "shipOrder",
        "summary": "Ship an order",
        "description": "Ship an order and deduct stock.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/orders/cancel": {
      "post": {
        "operationId": "cancelOrder",
        "summary": "Cancel an order",
        "description": "Cancel an order and release its reservations atomically.",
        "tags": [
          "Sales orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/list": {
      "get": {
        "operationId": "listPurchaseOrders",
        "summary": "List purchase orders",
        "description": "List purchase orders.",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/purchaseOrders"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/search": {
      "get": {
        "operationId": "getPurchaseOrders",
        "summary": "Search purchase orders",
        "description": "Paginated purchase orders with search by number and status filter.",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/purchaseOrders"
                          }
                        },
                        "totalCount": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/get": {
      "get": {
        "operationId": "getPurchaseOrder",
        "summary": "Get a purchase order",
        "description": "Get a purchase order.",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/purchaseOrders"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/create": {
      "post": {
        "operationId": "createPurchaseOrder",
        "summary": "Create a purchase order",
        "description": "Create a purchase order.",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/nextNumber": {
      "get": {
        "operationId": "nextPurchaseOrderNumber",
        "summary": "Next purchase order number",
        "description": "Next free purchase order number for a prefix (e.g. “PO-20261006-”).",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "prefix",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/update": {
      "post": {
        "operationId": "updatePurchaseOrder",
        "summary": "Update a purchase order",
        "description": "Update a purchase order (not fully received or cancelled). Lines are the full list, as in updateOrder. Quantities cannot go below what was received; omitted prices keep their values.",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/receive": {
      "post": {
        "operationId": "receivePurchaseOrder",
        "summary": "Receive a purchase order",
        "description": "Receive goods against a purchase order.",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {}
                }
              },
              "example": {
                "input": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/purchaseOrders/cancel": {
      "post": {
        "operationId": "cancelPurchaseOrder",
        "summary": "Cancel a purchase order",
        "description": "Cancel a purchase order.",
        "tags": [
          "Purchase orders"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/reports/get": {
      "get": {
        "operationId": "getReportsData",
        "summary": "Stock and margin summary",
        "description": "Summary of stock, cost and margin.",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/reports/bundle": {
      "get": {
        "operationId": "getReportsBundle",
        "summary": "Reports for a period",
        "description": "Reports for a period: inventory, sales, purchasing, movements, ABC analysis and turnover, optionally per warehouse.",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/reports/dashboard": {
      "get": {
        "operationId": "getDashboardSummary",
        "summary": "Dashboard summary",
        "description": "Dashboard summary: product count, stock value, out-of-stock and low-stock items, charts by category and warehouse.",
        "tags": [
          "Reports"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/settings/get": {
      "get": {
        "operationId": "getSettings",
        "summary": "Get settings",
        "description": "Get workspace settings.",
        "tags": [
          "Settings"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/settings"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/settings/update": {
      "post": {
        "operationId": "updateSettings",
        "summary": "Update settings",
        "description": "Update workspace settings.",
        "tags": [
          "Settings"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "updates": {
                    "$ref": "#/components/schemas/settingsInput"
                  }
                }
              },
              "example": {
                "updates": {
                  "locale": "string",
                  "allowNegativeStock": false,
                  "allowOverReservation": false,
                  "defaultExportQuantityMode": "string",
                  "dateFormat": "2026-01-01T00:00:00.000Z",
                  "timeFormat": "string",
                  "decimalSeparator": "string",
                  "thousandsSeparator": "string",
                  "lastWarehouseId": 1,
                  "lastBackupReminderDate": "2026-01-01T00:00:00.000Z",
                  "lastBackupAtUtc": "2026-01-01T00:00:00.000Z",
                  "defaultBackupTarget": "string",
                  "featureKits": false,
                  "featureVariants": false,
                  "featuresRolloutDone": false,
                  "timeZone": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/history": {
      "get": {
        "operationId": "getImportHistory",
        "summary": "Import history",
        "description": "History of import and export jobs.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "updateMode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "IMPORT",
                "EXPORT"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/importJobs"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/createJob": {
      "post": {
        "operationId": "createImportJob",
        "summary": "Create an import job",
        "description": "Create an import job.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "job": {
                    "$ref": "#/components/schemas/importJobsInput"
                  }
                }
              },
              "example": {
                "job": {
                  "type": "string",
                  "fileName": "string",
                  "fileType": "string",
                  "format": "string",
                  "profileId": 1,
                  "updateMode": "2026-01-01T00:00:00.000Z",
                  "stockImportMode": "string",
                  "defaultWarehouseId": 1,
                  "status": "Active",
                  "rowsTotal": 1,
                  "rowsProcessed": 1,
                  "productsCreated": 1,
                  "productsUpdated": 1,
                  "categoriesCreated": 1,
                  "manufacturersCreated": 1,
                  "currenciesCreated": 1,
                  "stockBalancesUpdated": 1,
                  "rowsSkipped": 1,
                  "errorsCount": 1,
                  "warningsCount": 1,
                  "messages": {},
                  "startedAtUtc": "2026-01-01T00:00:00.000Z",
                  "finishedAtUtc": "2026-01-01T00:00:00.000Z",
                  "resultBlob": "string",
                  "undoData": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/updateJob": {
      "post": {
        "operationId": "updateImportJob",
        "summary": "Update an import job",
        "description": "Update an import job.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "updates": {
                    "$ref": "#/components/schemas/importJobsInput"
                  }
                }
              },
              "example": {
                "updates": {
                  "type": "string",
                  "fileName": "string",
                  "fileType": "string",
                  "format": "string",
                  "profileId": 1,
                  "updateMode": "2026-01-01T00:00:00.000Z",
                  "stockImportMode": "string",
                  "defaultWarehouseId": 1,
                  "status": "Active",
                  "rowsTotal": 1,
                  "rowsProcessed": 1,
                  "productsCreated": 1,
                  "productsUpdated": 1,
                  "categoriesCreated": 1,
                  "manufacturersCreated": 1,
                  "currenciesCreated": 1,
                  "stockBalancesUpdated": 1,
                  "rowsSkipped": 1,
                  "errorsCount": 1,
                  "warningsCount": 1,
                  "messages": {},
                  "startedAtUtc": "2026-01-01T00:00:00.000Z",
                  "finishedAtUtc": "2026-01-01T00:00:00.000Z",
                  "resultBlob": "string",
                  "undoData": {}
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/undo": {
      "post": {
        "operationId": "undoImport",
        "summary": "Undo an import",
        "description": "Undo an import by deleting the records it created. Returns the number of deleted records.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execProducts": {
      "post": {
        "operationId": "executeProductImport",
        "summary": "Import products",
        "description": "Import products: mapped fields, references by name (optionally created), kinds and variants.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execStock": {
      "post": {
        "operationId": "executeStockImport",
        "summary": "Import stock",
        "description": "Import stock or movements by SKU. Unknown SKUs are reported, or created with createMissingProducts.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execCustomers": {
      "post": {
        "operationId": "executeCustomerImport",
        "summary": "Import customers",
        "description": "Import customers.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execSuppliers": {
      "post": {
        "operationId": "executeSupplierImport",
        "summary": "Import suppliers",
        "description": "Import suppliers.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execCategories": {
      "post": {
        "operationId": "executeCategoryImport",
        "summary": "Import categories",
        "description": "Import categories; hierarchy is written as “Parent -> Child”.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execManufacturers": {
      "post": {
        "operationId": "executeManufacturerImport",
        "summary": "Import manufacturers",
        "description": "Import manufacturers.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execWarehouses": {
      "post": {
        "operationId": "executeWarehouseImport",
        "summary": "Import warehouses",
        "description": "Import warehouses.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execCurrencies": {
      "post": {
        "operationId": "executeCurrencyImport",
        "summary": "Import currencies",
        "description": "Import currencies.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execOrders": {
      "post": {
        "operationId": "executeOrderImport",
        "summary": "Import sales orders",
        "description": "Import sales orders; rows are grouped by order number.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execPurchaseOrders": {
      "post": {
        "operationId": "executePurchaseOrderImport",
        "summary": "Import purchase orders",
        "description": "Import purchase orders; rows are grouped by order number.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execMovements": {
      "post": {
        "operationId": "executeMovementImport",
        "summary": "Import movements",
        "description": "Import movements: qty > 0 receives, qty < 0 issues; with a target warehouse the row becomes a transfer.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execReservations": {
      "post": {
        "operationId": "executeReservationImport",
        "summary": "Import reservations",
        "description": "Import reservations: one reservation per row.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/imports/execComponents": {
      "post": {
        "operationId": "executeComponentImport",
        "summary": "Import bills of materials",
        "description": "Import bills of materials: “product SKU, component SKU, quantity”. Replaces existing components and sets the product kind to assembled.",
        "tags": [
          "Import"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {},
                  "opts": {}
                }
              },
              "example": {
                "items": {},
                "opts": {}
              }
            }
          }
        }
      }
    },
    "/api/rpc/backup/wipeAll": {
      "post": {
        "operationId": "wipeAllData",
        "summary": "Delete all data",
        "description": "Delete ALL workspace data (products, stock, documents, reference data, import history). Settings are kept. Returns the number of cleared tables.",
        "tags": [
          "Maintenance"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/backup/cleanupOrphans": {
      "post": {
        "operationId": "cleanupOrphanedStock",
        "summary": "Clean up orphaned stock records",
        "description": "Delete stock records that reference deleted products. Returns the number of deleted rows per table.",
        "tags": [
          "Maintenance"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/activity/list": {
      "get": {
        "operationId": "listActivity",
        "summary": "List activity",
        "description": "Activity log, newest first. search matches the description and method name.",
        "tags": [
          "Activity log"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "module",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/rpc/activity/summary": {
      "get": {
        "operationId": "getActivitySummary",
        "summary": "Activity summary",
        "description": "Activity summary. userId limits it to one user.",
        "tags": [
          "Activity log"
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "required": true,
            "description": "Workspace of the API key",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or a business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "No access to the workspace, or the method needs the write scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (300 requests per minute)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key: Authorization: Bearer sk_…"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "apiKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "api_key",
        "description": "Read methods only"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "details": {
            "type": "object"
          }
        }
      },
      "products": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "sku": {
            "type": "string"
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "manufacturerId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "categoryId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "price": {
            "type": [
              "number",
              "null"
            ]
          },
          "priceOld": {
            "type": [
              "number",
              "null"
            ]
          },
          "rrp": {
            "type": [
              "number",
              "null"
            ]
          },
          "currencyId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "purchaseCost": {
            "type": [
              "number",
              "null"
            ]
          },
          "purchaseCostCurrencyId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "minQty": {
            "type": [
              "number",
              "null"
            ]
          },
          "customFieldValues": {
            "type": [
              "object",
              "null"
            ]
          },
          "isArchived": {
            "type": "boolean"
          },
          "kind": {
            "type": "string",
            "enum": [
              "simple",
              "assembled",
              "virtual_kit",
              "variant_parent"
            ]
          },
          "laborCost": {
            "type": [
              "number",
              "null"
            ]
          },
          "laborCostCurrencyId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "componentsUpdatedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "parentId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "variantKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "nameLocked": {
            "type": "boolean"
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "priceHistory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "productId": {
            "type": "integer"
          },
          "price": {
            "type": [
              "number",
              "null"
            ]
          },
          "currencyId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "createdAtUtc": {
            "type": "string"
          }
        }
      },
      "productsInput": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string"
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "manufacturerId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "categoryId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "price": {
            "type": [
              "number",
              "null"
            ]
          },
          "priceOld": {
            "type": [
              "number",
              "null"
            ]
          },
          "rrp": {
            "type": [
              "number",
              "null"
            ]
          },
          "currencyId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "purchaseCost": {
            "type": [
              "number",
              "null"
            ]
          },
          "purchaseCostCurrencyId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "minQty": {
            "type": [
              "number",
              "null"
            ]
          },
          "customFieldValues": {
            "type": [
              "object",
              "null"
            ]
          },
          "isArchived": {
            "type": "boolean"
          },
          "kind": {
            "type": "string",
            "enum": [
              "simple",
              "assembled",
              "virtual_kit",
              "variant_parent"
            ]
          },
          "laborCost": {
            "type": [
              "number",
              "null"
            ]
          },
          "laborCostCurrencyId": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "warehouses": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "capacity": {
            "type": [
              "number",
              "null"
            ]
          },
          "isDefault": {
            "type": "boolean"
          },
          "isArchived": {
            "type": "boolean"
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "warehousesInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "capacity": {
            "type": [
              "number",
              "null"
            ]
          },
          "isDefault": {
            "type": "boolean"
          },
          "isArchived": {
            "type": "boolean"
          }
        }
      },
      "categories": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "parentId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "categoriesInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "parentId": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "manufacturers": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "manufacturersInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "currencies": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "rate": {
            "type": "number"
          },
          "isDefault": {
            "type": "boolean"
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "currenciesInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "rate": {
            "type": "number"
          },
          "isDefault": {
            "type": "boolean"
          }
        }
      },
      "suppliers": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "isArchived": {
            "type": "boolean"
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "suppliersInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "isArchived": {
            "type": "boolean"
          }
        }
      },
      "customers": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "isArchived": {
            "type": "boolean"
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "customersInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "isArchived": {
            "type": "boolean"
          }
        }
      },
      "customFields": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "sortOrder": {
            "type": "integer"
          },
          "createdAtUtc": {
            "type": "string"
          }
        }
      },
      "stockBalances": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "warehouseId": {
            "type": "integer"
          },
          "productId": {
            "type": "integer"
          },
          "qty": {
            "type": "number"
          },
          "reservedQty": {
            "type": "number"
          },
          "availableQty": {
            "type": "number"
          },
          "lastMovementAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "stockMovements": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "warehouseId": {
            "type": "integer"
          },
          "productId": {
            "type": "integer"
          },
          "sku": {
            "type": "string"
          },
          "movementType": {
            "type": "string"
          },
          "qtyDelta": {
            "type": "number"
          },
          "reservedDelta": {
            "type": "number"
          },
          "qtyBefore": {
            "type": "number"
          },
          "qtyAfter": {
            "type": "number"
          },
          "reservedBefore": {
            "type": "number"
          },
          "reservedAfter": {
            "type": "number"
          },
          "purchasePrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "purchaseCurrencyId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "documentType": {
            "type": [
              "string",
              "null"
            ]
          },
          "documentNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "operationId": {
            "type": "integer"
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAtUtc": {
            "type": "string"
          },
          "createdBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBySource": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversesMovementId": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "reservations": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "warehouseId": {
            "type": "integer"
          },
          "productId": {
            "type": "integer"
          },
          "qtyReserved": {
            "type": "number"
          },
          "status": {
            "type": "string"
          },
          "reasonType": {
            "type": [
              "string",
              "null"
            ]
          },
          "documentType": {
            "type": [
              "string",
              "null"
            ]
          },
          "documentNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          },
          "releasedAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "orderItemId": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "orders": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "orderNumber": {
            "type": "string"
          },
          "customerId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          },
          "cancelledAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "shippedAtUtc": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "purchaseOrders": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "orderNumber": {
            "type": "string"
          },
          "supplierId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "expectedAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "comment": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAtUtc": {
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          },
          "cancelledAtUtc": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "settings": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "locale": {
            "type": "string"
          },
          "allowNegativeStock": {
            "type": "boolean"
          },
          "allowOverReservation": {
            "type": "boolean"
          },
          "defaultExportQuantityMode": {
            "type": "string"
          },
          "dateFormat": {
            "type": "string"
          },
          "timeFormat": {
            "type": [
              "string",
              "null"
            ]
          },
          "decimalSeparator": {
            "type": "string"
          },
          "thousandsSeparator": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastWarehouseId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "lastBackupReminderDate": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastBackupAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultBackupTarget": {
            "type": [
              "string",
              "null"
            ]
          },
          "featureKits": {
            "type": "boolean"
          },
          "featureVariants": {
            "type": "boolean"
          },
          "featuresRolloutDone": {
            "type": "boolean"
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "settingsInput": {
        "type": "object",
        "properties": {
          "locale": {
            "type": "string"
          },
          "allowNegativeStock": {
            "type": "boolean"
          },
          "allowOverReservation": {
            "type": "boolean"
          },
          "defaultExportQuantityMode": {
            "type": "string"
          },
          "dateFormat": {
            "type": "string"
          },
          "timeFormat": {
            "type": [
              "string",
              "null"
            ]
          },
          "decimalSeparator": {
            "type": "string"
          },
          "thousandsSeparator": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastWarehouseId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "lastBackupReminderDate": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastBackupAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultBackupTarget": {
            "type": [
              "string",
              "null"
            ]
          },
          "featureKits": {
            "type": "boolean"
          },
          "featureVariants": {
            "type": "boolean"
          },
          "featuresRolloutDone": {
            "type": "boolean"
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "importJobs": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "campaignId": {
            "type": "integer"
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          },
          "fileName": {
            "type": "string"
          },
          "fileType": {
            "type": "string"
          },
          "format": {
            "type": [
              "string",
              "null"
            ]
          },
          "profileId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "updateMode": {
            "type": "string"
          },
          "stockImportMode": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultWarehouseId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "rowsTotal": {
            "type": "integer"
          },
          "rowsProcessed": {
            "type": "integer"
          },
          "productsCreated": {
            "type": "integer"
          },
          "productsUpdated": {
            "type": "integer"
          },
          "categoriesCreated": {
            "type": "integer"
          },
          "manufacturersCreated": {
            "type": "integer"
          },
          "currenciesCreated": {
            "type": "integer"
          },
          "stockBalancesUpdated": {
            "type": "integer"
          },
          "rowsSkipped": {
            "type": "integer"
          },
          "errorsCount": {
            "type": "integer"
          },
          "warningsCount": {
            "type": "integer"
          },
          "messages": {
            "type": "object"
          },
          "startedAtUtc": {
            "type": "string"
          },
          "finishedAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "resultBlob": {
            "type": [
              "string",
              "null"
            ]
          },
          "undoData": {
            "type": [
              "object",
              "null"
            ]
          }
        }
      },
      "importJobsInput": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "string",
              "null"
            ]
          },
          "fileName": {
            "type": "string"
          },
          "fileType": {
            "type": "string"
          },
          "format": {
            "type": [
              "string",
              "null"
            ]
          },
          "profileId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "updateMode": {
            "type": "string"
          },
          "stockImportMode": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultWarehouseId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "rowsTotal": {
            "type": "integer"
          },
          "rowsProcessed": {
            "type": "integer"
          },
          "productsCreated": {
            "type": "integer"
          },
          "productsUpdated": {
            "type": "integer"
          },
          "categoriesCreated": {
            "type": "integer"
          },
          "manufacturersCreated": {
            "type": "integer"
          },
          "currenciesCreated": {
            "type": "integer"
          },
          "stockBalancesUpdated": {
            "type": "integer"
          },
          "rowsSkipped": {
            "type": "integer"
          },
          "errorsCount": {
            "type": "integer"
          },
          "warningsCount": {
            "type": "integer"
          },
          "messages": {
            "type": "object"
          },
          "startedAtUtc": {
            "type": "string"
          },
          "finishedAtUtc": {
            "type": [
              "string",
              "null"
            ]
          },
          "resultBlob": {
            "type": [
              "string",
              "null"
            ]
          },
          "undoData": {
            "type": [
              "object",
              "null"
            ]
          }
        }
      }
    }
  }
}
