{
  "openapi": "3.0.3",
  "info": {
    "title": "Acenda API",
    "version": "1.0.0",
    "description": "The curated developer API for catalog, orders, inventory, and fulfillment. Authenticate with a client-credentials access token and send X-Astur-Organization. Available operations depend on your API key profile. Example IDs and records are fictional; replace them with your own organization data. This specification documents a deliberate subset of fields and operations."
  },
  "servers": [
    {
      "url": "https://api.acenda.io/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Catalog",
      "description": "Products, variants, and kits in one resource."
    },
    {
      "name": "Inventory",
      "description": "Stock quantities by SKU and warehouse."
    },
    {
      "name": "Pricing",
      "description": "Base prices and pricing records."
    },
    {
      "name": "Warehouses",
      "description": "Warehouse lookup for inventory and routing."
    },
    {
      "name": "Fulfillment providers",
      "description": "Provider lookup for warehouse and shipment workflows."
    },
    {
      "name": "Sales channels",
      "description": "Channel lookup for order ingestion."
    },
    {
      "name": "Ship advice",
      "description": "Warehouse work snapshots, custom-field values, and explicit routing operations."
    },
    {
      "name": "Orders",
      "description": "Immutable order snapshots, ingestion, and lifecycle reads."
    },
    {
      "name": "Acknowledgments",
      "description": "Mark orders and ship advice as received by your integration."
    },
    {
      "name": "Fulfillments",
      "description": "Shipment confirmations and tracking."
    },
    {
      "name": "Returns",
      "description": "Read return records and their original-order context."
    },
    {
      "name": "Cancellations",
      "description": "Cancel unfulfilled ship advice items."
    }
  ],
  "paths": {
    "/catalog": {
      "get": {
        "operationId": "listCatalog",
        "summary": "List catalog items",
        "description": "Read products, variants, and kits through one catalog endpoint. The group field identifies the item kind.",
        "tags": [
          "Catalog"
        ],
        "x-acenda-required-scope": "product:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"sku\":\"TRAIL-MUG\"}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CatalogItem"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 101,
                      "sku": "TRAIL-MUG",
                      "name": "Trail mug",
                      "group": "product",
                      "fields": {},
                      "updated_at": "2026-10-01T12:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCatalogItem",
        "summary": "Create a catalog item",
        "description": "Create a standalone product with a unique SKU. Use an existing catalog record for variants and kits; advanced composition is outside this guide.",
        "tags": [
          "Catalog"
        ],
        "x-acenda-required-scope": "product:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/CatalogItem"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 201,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 101,
                    "sku": "TRAIL-MUG",
                    "name": "Trail mug",
                    "group": "product",
                    "fields": {},
                    "updated_at": "2026-10-01T12:00:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogCreate"
              },
              "example": {
                "sku": "TRAIL-MUG",
                "name": "Trail mug",
                "group": "product"
              }
            }
          }
        }
      }
    },
    "/catalog/{product}": {
      "get": {
        "operationId": "getCatalogItem",
        "summary": "Get a catalog item",
        "description": "Retrieve a catalog record using its Acenda ID. Filter the list by sku if you only know the SKU. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Catalog"
        ],
        "x-acenda-required-scope": "product:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "product",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 101
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/CatalogItem"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 101,
                    "sku": "TRAIL-MUG",
                    "name": "Trail mug",
                    "group": "product",
                    "fields": {},
                    "updated_at": "2026-10-01T12:00:00Z"
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateCatalogItem",
        "summary": "Update a catalog item",
        "description": "Change the documented fields of an existing item. Fields not sent remain on the loaded record.",
        "tags": [
          "Catalog"
        ],
        "x-acenda-required-scope": "product:update",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "product",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 101
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/CatalogItem"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 101,
                    "sku": "TRAIL-MUG",
                    "name": "Trail mug — 12 oz",
                    "group": "product",
                    "fields": {},
                    "updated_at": "2026-10-01T12:00:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogPatch"
              },
              "example": {
                "name": "Trail mug — 12 oz"
              }
            }
          }
        }
      }
    },
    "/catalog/count": {
      "get": {
        "operationId": "countCatalog",
        "summary": "Count catalog items",
        "description": "Count catalog records matching an optional query filter.",
        "tags": [
          "Catalog"
        ],
        "x-acenda-required-scope": "product:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"sku\":\"TRAIL-MUG\"}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "count": 1240
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/order": {
      "get": {
        "operationId": "listOrders",
        "summary": "List orders",
        "description": "Read orders and their order_item arrays. Use this resource for line items instead of making separate order-item requests.",
        "tags": [
          "Orders"
        ],
        "x-acenda-required-scope": "order:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"status\":\"pending\"}"
          },
          {
            "name": "unacked",
            "in": "query",
            "description": "Return only records not acknowledged by this API identity. Use page=1 while draining this changing queue. Fetching does not reserve records.",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "example": true
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Order"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "purchase_order": "PO-10042",
                      "external_order_id": "WEB-10042",
                      "sales_channel_id": 7,
                      "create_routings": false,
                      "shipping_information": {
                        "first_name": "Alex",
                        "last_name": "Morgan",
                        "address_1": "123 Example Street",
                        "city": "San Diego",
                        "state": "CA",
                        "postal_code": "92101",
                        "country": "US"
                      },
                      "billing_information": {
                        "first_name": "Alex",
                        "last_name": "Morgan",
                        "address_1": "123 Example Street",
                        "city": "San Diego",
                        "state": "CA",
                        "postal_code": "92101",
                        "country": "US"
                      },
                      "order_item": [
                        {
                          "external_sku": "TRAIL-MUG",
                          "sku": "TRAIL-MUG",
                          "product_id": 101,
                          "line_id": "1",
                          "quantity": 2,
                          "unit_price": "29.00",
                          "id": 20081,
                          "status": "pending",
                          "quantity_fulfilled": 0,
                          "quantity_canceled": 0
                        }
                      ],
                      "item_tax": "0.00",
                      "ship_tax": "0.00",
                      "shipping": "0.00",
                      "total_item_discount": "0.00",
                      "total_shipping_discount": "0.00",
                      "subtotal": "58.00",
                      "total": "58.00",
                      "id": 10042,
                      "order_number": 10042,
                      "status": "pending"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrder",
        "summary": "Create an order",
        "description": "Create an order snapshot using an existing sales channel and catalog items. Order details cannot be updated after creation through the supported API. This example disables automatic routing; an order without ship advice has no cancellation path in this reference. The pair external_order_id + sales_channel_id remains unique after cancellation. Contact Acenda for corrections that require deletion or preserving the original source ID.",
        "tags": [
          "Orders"
        ],
        "x-acenda-required-scope": "order:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Order"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 201,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "purchase_order": "PO-10042",
                    "external_order_id": "WEB-10042",
                    "sales_channel_id": 7,
                    "create_routings": false,
                    "shipping_information": {
                      "first_name": "Alex",
                      "last_name": "Morgan",
                      "address_1": "123 Example Street",
                      "city": "San Diego",
                      "state": "CA",
                      "postal_code": "92101",
                      "country": "US"
                    },
                    "billing_information": {
                      "first_name": "Alex",
                      "last_name": "Morgan",
                      "address_1": "123 Example Street",
                      "city": "San Diego",
                      "state": "CA",
                      "postal_code": "92101",
                      "country": "US"
                    },
                    "order_item": [
                      {
                        "external_sku": "TRAIL-MUG",
                        "sku": "TRAIL-MUG",
                        "product_id": 101,
                        "line_id": "1",
                        "quantity": 2,
                        "unit_price": "29.00",
                        "id": 20081,
                        "status": "pending",
                        "quantity_fulfilled": 0,
                        "quantity_canceled": 0
                      }
                    ],
                    "item_tax": "0.00",
                    "ship_tax": "0.00",
                    "shipping": "0.00",
                    "total_item_discount": "0.00",
                    "total_shipping_discount": "0.00",
                    "subtotal": "58.00",
                    "total": "58.00",
                    "id": 10042,
                    "order_number": 10042,
                    "status": "pending"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderCreate"
              },
              "example": {
                "purchase_order": "PO-10042",
                "external_order_id": "WEB-10042",
                "sales_channel_id": 7,
                "create_routings": false,
                "shipping_information": {
                  "first_name": "Alex",
                  "last_name": "Morgan",
                  "address_1": "123 Example Street",
                  "city": "San Diego",
                  "state": "CA",
                  "postal_code": "92101",
                  "country": "US"
                },
                "billing_information": {
                  "first_name": "Alex",
                  "last_name": "Morgan",
                  "address_1": "123 Example Street",
                  "city": "San Diego",
                  "state": "CA",
                  "postal_code": "92101",
                  "country": "US"
                },
                "order_item": [
                  {
                    "external_sku": "TRAIL-MUG",
                    "sku": "TRAIL-MUG",
                    "product_id": 101,
                    "line_id": "1",
                    "quantity": 2,
                    "unit_price": "29.00"
                  }
                ],
                "item_tax": "0.00",
                "ship_tax": "0.00",
                "shipping": "0.00",
                "total_item_discount": "0.00",
                "total_shipping_discount": "0.00",
                "subtotal": "58.00",
                "total": "58.00"
              }
            }
          }
        }
      }
    },
    "/order/{order}": {
      "get": {
        "operationId": "getOrder",
        "summary": "Get an order",
        "description": "Retrieve an order snapshot, including its order_item records. Order details are immutable through the supported API; fulfillment and cancellation still update lifecycle state. Use ship advice for warehouse work generated by routing. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Orders"
        ],
        "x-acenda-required-scope": "order:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "order",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 10042
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Order"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "purchase_order": "PO-10042",
                    "external_order_id": "WEB-10042",
                    "sales_channel_id": 7,
                    "create_routings": false,
                    "shipping_information": {
                      "first_name": "Alex",
                      "last_name": "Morgan",
                      "address_1": "123 Example Street",
                      "city": "San Diego",
                      "state": "CA",
                      "postal_code": "92101",
                      "country": "US"
                    },
                    "billing_information": {
                      "first_name": "Alex",
                      "last_name": "Morgan",
                      "address_1": "123 Example Street",
                      "city": "San Diego",
                      "state": "CA",
                      "postal_code": "92101",
                      "country": "US"
                    },
                    "order_item": [
                      {
                        "external_sku": "TRAIL-MUG",
                        "sku": "TRAIL-MUG",
                        "product_id": 101,
                        "line_id": "1",
                        "quantity": 2,
                        "unit_price": "29.00",
                        "id": 20081,
                        "status": "pending",
                        "quantity_fulfilled": 0,
                        "quantity_canceled": 0
                      }
                    ],
                    "item_tax": "0.00",
                    "ship_tax": "0.00",
                    "shipping": "0.00",
                    "total_item_discount": "0.00",
                    "total_shipping_discount": "0.00",
                    "subtotal": "58.00",
                    "total": "58.00",
                    "id": 10042,
                    "order_number": 10042,
                    "status": "pending"
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/order/{order}/ship_advice": {
      "post": {
        "operationId": "createShipAdvice",
        "summary": "Create a routing assignment",
        "description": "Use this reassignment workflow only for non-kit order items. Contact Acenda before releasing or reassigning kit items. Assign unrouted units from an existing order to a warehouse. Use order_item_id from that order. The new ship advice inherits order prices, addresses, shipping method, and requested dates; this request does not change those details. After releasing an old assignment, re-read quantities before creating its replacement. Creation is not generally idempotent: reconcile existing assignments after an ambiguous response before retrying.",
        "tags": [
          "Ship advice"
        ],
        "x-acenda-required-scope": "ship_advice:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "order",
            "in": "path",
            "required": true,
            "description": "Existing Acenda order ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 10042
          }
        ],
        "responses": {
          "200": {
            "description": "Created ship advice",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "nullable": true,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/ShipAdvice"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 5002,
                    "order_id": 10042,
                    "warehouse_id": 8,
                    "fulfillment_provider_id": 6,
                    "status": "pending",
                    "ship_advice_item": [
                      {
                        "id": 6002,
                        "order_item_id": 20081,
                        "sku": "TRAIL-MUG",
                        "quantity": 1,
                        "quantity_fulfilled": 0,
                        "quantity_canceled": 0,
                        "quantity_rerouted": null,
                        "status": "pending"
                      }
                    ],
                    "delivery_information": {
                      "first_name": "Alex",
                      "last_name": "Morgan",
                      "address_1": "123 Example Street",
                      "city": "San Diego",
                      "state": "CA",
                      "postal_code": "92101",
                      "country": "US"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShipAdviceCreate"
              },
              "example": {
                "warehouse_id": 8,
                "ship_advice_item": [
                  {
                    "order_item_id": 20081,
                    "quantity": 1
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/order/count": {
      "get": {
        "operationId": "countOrders",
        "summary": "Count orders",
        "description": "Count orders matching an optional query filter.",
        "tags": [
          "Orders"
        ],
        "x-acenda-required-scope": "order:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"status\":\"pending\"}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "count": 42
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/inventory_detail": {
      "get": {
        "operationId": "listInventory",
        "summary": "List inventory",
        "description": "Read stock by product and warehouse. Filter by sku or warehouse_id. on_hand is calculated by the read view. A missing inventory record can return HTTP 200 with result: null and num_results: 0.",
        "tags": [
          "Inventory"
        ],
        "x-acenda-required-scope": "inventory:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"sku\":\"TRAIL-MUG\"}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Inventory"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 301,
                      "product_id": 101,
                      "warehouse_id": 20,
                      "sku": "TRAIL-MUG",
                      "quantity": 50,
                      "allocated": 2,
                      "not_available": 0,
                      "on_hand": 48,
                      "tracking": "basic"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createInventory",
        "summary": "Set inventory for a SKU",
        "description": "Create inventory for an existing SKU and warehouse. The stored product/warehouse pair is unique; saving can update an existing pair. Send an absolute quantity, not a stock adjustment. Kit inventory is calculated and cannot be manually set.",
        "tags": [
          "Inventory"
        ],
        "x-acenda-required-scope": "inventory:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Inventory"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 201,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 301,
                    "product_id": 101,
                    "warehouse_id": 20,
                    "sku": "TRAIL-MUG",
                    "quantity": 50,
                    "allocated": 2,
                    "not_available": 0,
                    "tracking": "basic"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InventoryCreate"
              },
              "example": {
                "sku": "TRAIL-MUG",
                "warehouse_id": 20,
                "quantity": 50,
                "tracking": "basic"
              }
            }
          }
        }
      }
    },
    "/inventory_detail/{inventorydetail}": {
      "get": {
        "operationId": "getInventory",
        "summary": "Get an inventory record",
        "description": "Look up one inventory record by its Acenda ID. A missing inventory record can return HTTP 200 with result: null and num_results: 0. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Inventory"
        ],
        "x-acenda-required-scope": "inventory:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "inventorydetail",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 301
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Inventory"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 301,
                    "product_id": 101,
                    "warehouse_id": 20,
                    "sku": "TRAIL-MUG",
                    "quantity": 50,
                    "allocated": 2,
                    "not_available": 0,
                    "on_hand": 48,
                    "tracking": "basic"
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateInventory",
        "summary": "Update inventory quantity",
        "description": "Set the absolute stock quantity on an existing inventory record. Only send the fields you intend to change. Kit inventory is calculated and cannot be manually set.",
        "tags": [
          "Inventory"
        ],
        "x-acenda-required-scope": "inventory:update",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "inventorydetail",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 301
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Inventory"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 301,
                    "product_id": 101,
                    "warehouse_id": 20,
                    "sku": "TRAIL-MUG",
                    "quantity": 60,
                    "allocated": 2,
                    "not_available": 0,
                    "tracking": "basic"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InventoryPatch"
              },
              "example": {
                "quantity": 60
              }
            }
          }
        }
      }
    },
    "/inventory_detail/count": {
      "get": {
        "operationId": "countInventory",
        "summary": "Count inventory records",
        "description": "Count stored inventory records matching an optional query filter. A missing inventory record can return HTTP 200 with result: null and num_results: 0.",
        "tags": [
          "Inventory"
        ],
        "x-acenda-required-scope": "inventory:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"product_id\":101}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "count": 240
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/warehouse": {
      "get": {
        "operationId": "listWarehouses",
        "summary": "List warehouses",
        "description": "Find existing warehouse IDs before reading or setting inventory.",
        "tags": [
          "Warehouses"
        ],
        "x-acenda-required-scope": "warehouse:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"active\":true}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Warehouse"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 20,
                      "name": "West coast warehouse",
                      "active": true,
                      "fulfillment_provider_id": 6,
                      "type": "standard"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/warehouse/{warehouse}": {
      "get": {
        "operationId": "getWarehouse",
        "summary": "Get a warehouse",
        "description": "Read a warehouse and its fulfillment-provider ID. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Warehouses"
        ],
        "x-acenda-required-scope": "warehouse:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "warehouse",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 20
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Warehouse"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 20,
                    "name": "West coast warehouse",
                    "active": true,
                    "fulfillment_provider_id": 6,
                    "type": "standard"
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sales_channel": {
      "get": {
        "operationId": "listSalesChannels",
        "summary": "List sales channels",
        "description": "Find the existing sales channel ID used when creating orders.",
        "tags": [
          "Sales channels"
        ],
        "x-acenda-required-scope": "sales_channel:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"country\":\"US\"}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/SalesChannel"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 7,
                      "name": "Online store",
                      "type": "web",
                      "country": "US"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sales_channel/{saleschannel}": {
      "get": {
        "operationId": "getSalesChannel",
        "summary": "Get a sales channel",
        "description": "Read the channel used by an order source. Sales-channel configuration is managed by your organization. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Sales channels"
        ],
        "x-acenda-required-scope": "sales_channel:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "saleschannel",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 7
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/SalesChannel"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 7,
                    "name": "Online store",
                    "type": "web",
                    "country": "US"
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ship_advice": {
      "get": {
        "operationId": "listShipAdvice",
        "summary": "List ship advice",
        "description": "Read warehouse work snapshots created by order routing. Filter by order_id or warehouse_id. Core ship-advice details are immutable; per-record custom-field values can be updated separately. Use explicit routing, rerouting, fulfillment, and cancellation operations for lifecycle changes.",
        "tags": [
          "Ship advice"
        ],
        "x-acenda-required-scope": "ship_advice:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"order_id\":10042}"
          },
          {
            "name": "unacked",
            "in": "query",
            "description": "Return only records not acknowledged by this API identity. Use page=1 while draining this changing queue. Fetching does not reserve records.",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "example": true
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ShipAdvice"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 5001,
                      "order_id": 10042,
                      "warehouse_id": 20,
                      "fulfillment_provider_id": 6,
                      "status": "routed",
                      "ship_advice_item": [
                        {
                          "id": 6001,
                          "order_item_id": 20081,
                          "sku": "TRAIL-MUG",
                          "quantity": 2,
                          "quantity_fulfilled": 0,
                          "quantity_canceled": 0,
                          "status": "pending"
                        }
                      ],
                      "delivery_information": {
                        "first_name": "Alex",
                        "last_name": "Morgan",
                        "address_1": "123 Example Street",
                        "city": "San Diego",
                        "state": "CA",
                        "postal_code": "92101",
                        "country": "US"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ship_advice/{shipadvice}": {
      "get": {
        "operationId": "getShipAdvice",
        "summary": "Get ship advice",
        "description": "Retrieve a warehouse work snapshot and its item quantities before fulfillment, cancellation, or rerouting. Use the routed item ID for those operations. Core ship-advice details are immutable; only per-record custom-field values can be edited through the supported PATCH operation. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Ship advice"
        ],
        "x-acenda-required-scope": "ship_advice:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "shipadvice",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 5001
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/ShipAdvice"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 5001,
                    "order_id": 10042,
                    "warehouse_id": 20,
                    "fulfillment_provider_id": 6,
                    "status": "routed",
                    "ship_advice_item": [
                      {
                        "id": 6001,
                        "order_item_id": 20081,
                        "sku": "TRAIL-MUG",
                        "quantity": 2,
                        "quantity_fulfilled": 0,
                        "quantity_canceled": 0,
                        "status": "pending"
                      }
                    ],
                    "delivery_information": {
                      "first_name": "Alex",
                      "last_name": "Morgan",
                      "address_1": "123 Example Street",
                      "city": "San Diego",
                      "state": "CA",
                      "postal_code": "92101",
                      "country": "US"
                    }
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateShipAdviceCustomFields",
        "summary": "Update ship advice custom fields",
        "description": "Update only per-record custom-field values on an existing ship advice. Send a fields object with values compatible with the custom-field types configured by your organization. Other top-level properties are ignored and do not change the ship advice. Omitted custom fields retain their existing values; null or an empty string removes a stored value. This operation does not create or edit custom-field definitions. Use explicit routing, fulfillment, and cancellation operations for lifecycle changes.",
        "tags": [
          "Ship advice"
        ],
        "x-acenda-required-scope": "ship_advice:update",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "shipadvice",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 5001
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShipAdviceCustomFieldsPatch"
              },
              "example": {
                "fields": {
                  "exported_to_erp": true
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ship advice with updated custom-field values",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/ShipAdvice"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 5001,
                    "order_id": 10042,
                    "warehouse_id": 20,
                    "fulfillment_provider_id": 6,
                    "status": "routed",
                    "fields": {
                      "exported_to_erp": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ship_advice_item_reroute": {
      "post": {
        "operationId": "createShipAdviceItemReroute",
        "summary": "Release a routing assignment",
        "description": "Use this reassignment workflow only for non-kit order items. Contact Acenda before releasing or reassigning kit items. Release remaining units from an existing ship advice item. This creates a reroute record and updates routing quantities; it does not select another warehouse or create replacement ship advice. Choose only unfulfilled, uncanceled, not-already-rerouted units. Re-read the order and ship advice after this step, then create the replacement assignment. After an ambiguous response, reconcile quantities before retrying.",
        "tags": [
          "Ship advice"
        ],
        "x-acenda-required-scope": "ship_advice:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "201": {
            "description": "Created reroute record",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "nullable": true,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/ShipAdviceItemReroute"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 201,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 7001,
                    "ship_advice_item_id": 6001,
                    "quantity_rerouted": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShipAdviceItemRerouteCreate"
              },
              "example": {
                "ship_advice_item_id": 6001,
                "quantity_rerouted": 1
              }
            }
          }
        }
      }
    },
    "/fulfillment": {
      "get": {
        "operationId": "listFulfillments",
        "summary": "List fulfillments",
        "description": "Read shipment confirmations. Filter by ship_advice_id or external_id to reconcile your shipment source.",
        "tags": [
          "Fulfillments"
        ],
        "x-acenda-required-scope": "fulfillment:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"ship_advice_id\":5001}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Fulfillment"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "carrier": "UPS",
                      "date_shipped": "2026-10-02T14:30:00Z",
                      "tracking_info": [
                        {
                          "number": "EXAMPLE-TRACKING-001"
                        }
                      ],
                      "fulfillment_items": [
                        {
                          "ship_advice_item_id": 6001,
                          "quantity": 2
                        }
                      ],
                      "external_id": "SHIP-10042-1",
                      "id": 7001,
                      "ship_advice_id": 5001,
                      "status": "shipped",
                      "type": "shipment"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/fulfillment/{fulfillment}": {
      "get": {
        "operationId": "getFulfillment",
        "summary": "Get a fulfillment",
        "description": "Retrieve a recorded shipment and tracking information. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Fulfillments"
        ],
        "x-acenda-required-scope": "fulfillment:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "fulfillment",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 7001
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Fulfillment"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "carrier": "UPS",
                    "date_shipped": "2026-10-02T14:30:00Z",
                    "tracking_info": [
                      {
                        "number": "EXAMPLE-TRACKING-001"
                      }
                    ],
                    "fulfillment_items": [
                      {
                        "ship_advice_item_id": 6001,
                        "quantity": 2
                      }
                    ],
                    "external_id": "SHIP-10042-1",
                    "id": 7001,
                    "ship_advice_id": 5001,
                    "status": "shipped",
                    "type": "shipment"
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ship_advice/{shipadvice}/fulfillment": {
      "post": {
        "operationId": "createFulfillment",
        "summary": "Create fulfillment",
        "description": "Confirm shipment against an existing ship advice. Use ship_advice_item_id, not order_item_id or sku, in fulfillment_items. Each quantity must fit the remaining fulfillable amount. Confirmation updates fulfillment state; external_id does not guarantee idempotency.",
        "tags": [
          "Fulfillments"
        ],
        "x-acenda-required-scope": "fulfillment:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "shipadvice",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 5001
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Fulfillment"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 201,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "carrier": "UPS",
                    "date_shipped": "2026-10-02T14:30:00Z",
                    "tracking_info": [
                      {
                        "number": "EXAMPLE-TRACKING-001"
                      }
                    ],
                    "fulfillment_items": [
                      {
                        "ship_advice_item_id": 6001,
                        "quantity": 2
                      }
                    ],
                    "external_id": "SHIP-10042-1",
                    "id": 7001,
                    "ship_advice_id": 5001,
                    "status": "shipped",
                    "type": "shipment"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FulfillmentCreate"
              },
              "example": {
                "carrier": "UPS",
                "date_shipped": "2026-10-02T14:30:00Z",
                "tracking_info": [
                  {
                    "number": "EXAMPLE-TRACKING-001"
                  }
                ],
                "fulfillment_items": [
                  {
                    "ship_advice_item_id": 6001,
                    "quantity": 2
                  }
                ],
                "external_id": "SHIP-10042-1"
              }
            }
          }
        }
      }
    },
    "/acknowledge/{resource}": {
      "get": {
        "operationId": "listAcknowledgments",
        "summary": "Find acknowledgments",
        "description": "List acknowledgment records for the current API identity. Filter query by ref_id to check whether your order or ship advice has already been acknowledged. An empty result can be null. Use this lookup after an ambiguous POST result, before deciding whether to retry.",
        "tags": [
          "Acknowledgments"
        ],
        "x-acenda-required-scope": "order:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "resource",
            "in": "path",
            "required": true,
            "description": "The resource being consumed.",
            "schema": {
              "type": "string",
              "enum": [
                "order",
                "ship_advice"
              ]
            },
            "example": "ship_advice"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "name": "query",
            "in": "query",
            "description": "Filter by resource reference; ref_id is the order or ship advice ID.",
            "schema": {
              "type": "string"
            },
            "example": "{\"ref_id\":5001}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "nullable": true,
                          "items": {
                            "$ref": "#/components/schemas/Acknowledgment"
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.01,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 801,
                      "resource": "ship_advice",
                      "ref_id": 5001,
                      "external_id": "WMS-5001",
                      "created_at": "2026-10-02T14:30:00Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/acknowledge/{resource}/{ref_id}": {
      "post": {
        "operationId": "createAcknowledgment",
        "summary": "Acknowledge a record",
        "description": "Mark an order or ship advice as received by your API identity after you have durably processed it. This is a create operation, not an idempotent upsert: sending it twice can fail with a duplicate-record error. It does not mark an order shipped. The permission for either resource is order:create.",
        "tags": [
          "Acknowledgments"
        ],
        "x-acenda-required-scope": "order:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "resource",
            "in": "path",
            "required": true,
            "description": "The resource being consumed.",
            "schema": {
              "type": "string",
              "enum": [
                "order",
                "ship_advice"
              ]
            },
            "example": "ship_advice"
          },
          {
            "name": "ref_id",
            "in": "path",
            "required": true,
            "description": "Acenda order or ship advice ID, not an acknowledgment ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 5001
          }
        ],
        "responses": {
          "200": {
            "description": "Acknowledgment recorded. The handler returns HTTP 200 and num_results is 0 even with a result object.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Acknowledgment"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.01,
                  "num_results": 0,
                  "errors": null,
                  "result": {
                    "id": 801,
                    "resource": "ship_advice",
                    "ref_id": 5001,
                    "external_id": "WMS-5001",
                    "created_at": "2026-10-02T14:30:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid resource, missing order/ship advice, or duplicate acknowledgment. Check current acknowledgment state; do not blindly retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcknowledgmentCreate"
              },
              "example": {
                "external_id": "WMS-5001"
              }
            }
          }
        }
      }
    },
    "/inventory": {
      "get": {
        "operationId": "listInventorySummary",
        "summary": "Read inventory summaries",
        "description": "Read product summaries assembled from inventory-detail rows in active warehouses. Filtering, sorting, limit, and page apply to warehouse rows BEFORE grouping by product_id; returned product summaries are then ordered by product_id. A product spanning pages can have partial totals on each page. Use inventory_detail for a complete warehouse-level sync and aggregate only after reading every page. Do not use the number of product summaries as a page-size signal.",
        "tags": [
          "Inventory"
        ],
        "x-acenda-required-scope": "inventory:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limit underlying inventory-detail rows before grouping, not returned products.",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            },
            "example": 20
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page underlying warehouse rows before grouping. Never stop simply because fewer product summaries than limit are returned.",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            },
            "example": 1
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"sku\":\"TRAIL-MUG\"}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/InventorySummary"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "product_id": 101,
                      "sku": "TRAIL-MUG",
                      "quantity": 50,
                      "allocated": 2,
                      "not_available": 0,
                      "on_hand": 48,
                      "inventory_detail": [
                        {
                          "id": 301,
                          "product_id": 101,
                          "warehouse_id": 20,
                          "sku": "TRAIL-MUG",
                          "quantity": 50,
                          "allocated": 2,
                          "not_available": 0,
                          "on_hand": 48,
                          "tracking": "basic"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/pricing_item": {
      "get": {
        "operationId": "listPricingItems",
        "summary": "List pricing items",
        "description": "Read the stored base price, MSRP, and minimum advertised price for a catalog record. These amounts are not a promise of the final order price after channel pricing or promotions. Filter list requests by product_id to find the pricing record for a catalog item.",
        "tags": [
          "Pricing"
        ],
        "x-acenda-required-scope": "pricing:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"product_id\":101}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "nullable": true,
                          "items": {
                            "$ref": "#/components/schemas/PricingItem"
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 401,
                      "product_id": 101,
                      "price": {
                        "amount": "29.00",
                        "currency": "USD"
                      },
                      "msrp": {
                        "amount": "35.00",
                        "currency": "USD"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/pricing_item/{pricingitem}": {
      "get": {
        "operationId": "getPricingItem",
        "summary": "Get a pricing item",
        "description": "Read the stored base price, MSRP, and minimum advertised price for a catalog record. These amounts are not a promise of the final order price after channel pricing or promotions. Filter list requests by product_id to find the pricing record for a catalog item. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Pricing"
        ],
        "x-acenda-required-scope": "pricing:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "pricingitem",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 401
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "nullable": true,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/PricingItem"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 401,
                    "product_id": 101,
                    "price": {
                      "amount": "29.00",
                      "currency": "USD"
                    },
                    "msrp": {
                      "amount": "35.00",
                      "currency": "USD"
                    }
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/inventory_detail/bulk": {
      "put": {
        "operationId": "bulkUpdateInventory",
        "summary": "Bulk update inventory",
        "description": "Set absolute stock for existing products and warehouses; missing stock rows are created. Send a JSON array with one row per product and warehouse, identified by product_id or sku plus warehouse_id, not by inventory-record id. Each row must include a positive product_id or a non-empty sku. Either identifier is sufficient; if both are supplied, product_id takes precedence. Do not submit derived kit stock. This bulk write overwrites quantity, allocated, cost, date_received, and expiration_date: omitted allocated becomes zero, omitted cost becomes zero, and omitted dates are cleared. Include the intended current metadata and coordinate concurrent writers. HTTP 201 can contain partial results. Inspect errors and re-read affected stock; summary counters are not individual row receipts.",
        "tags": [
          "Inventory"
        ],
        "x-acenda-required-scope": "inventory:update",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "201": {
            "description": "Bulk result. Inspect errors and reconcile affected records.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/BulkWriteSummary"
                        },
                        "errors": {
                          "$ref": "#/components/schemas/InventoryBulkErrors"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 201,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": {
                    "values_not_found": {
                      "product_id": null,
                      "warehouse_id": null,
                      "sku_not_found": null,
                      "upc": null
                    }
                  },
                  "result": {
                    "submitted": 1,
                    "success": 1,
                    "errors": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InventoryBulkItem"
                },
                "minItems": 1
              },
              "example": [
                {
                  "sku": "TRAIL-MUG",
                  "warehouse_id": 20,
                  "quantity": 50,
                  "allocated": 2,
                  "cost": "12.50",
                  "date_received": "2026-11-01T00:00:00Z",
                  "expiration_date": null
                }
              ]
            }
          }
        }
      }
    },
    "/fulfillment_provider": {
      "get": {
        "operationId": "listFulfillmentProviders",
        "summary": "List fulfillment providers",
        "description": "Look up providers and their IDs. Match a provider ID to warehouse.fulfillment_provider_id when working with warehouse inventory or routing.",
        "tags": [
          "Fulfillment providers"
        ],
        "x-acenda-required-scope": "fulfillment_provider:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"active\":true}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/FulfillmentProvider"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 6,
                      "name": "Warehouse partner",
                      "service": "External WMS",
                      "type": "3pl",
                      "active": true,
                      "integration_subscription_id": 12
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/fulfillment_provider/{fulfillmentprovider}": {
      "get": {
        "operationId": "getFulfillmentProvider",
        "summary": "Get a fulfillment provider",
        "description": "Read one provider by its Acenda ID. Warehouse records are read separately from /warehouse. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Fulfillment providers"
        ],
        "x-acenda-required-scope": "fulfillment_provider:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "fulfillmentprovider",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 6
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/FulfillmentProvider"
                            }
                          ],
                          "type": "object"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 6,
                    "name": "Warehouse partner",
                    "service": "External WMS",
                    "type": "3pl",
                    "active": true,
                    "integration_subscription_id": 12
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/return": {
      "get": {
        "operationId": "listReturns",
        "summary": "List returns",
        "description": "Read return records and return-shipment tracking. Filter by order_id or status. These reads report return state; they do not create a return or issue a refund.",
        "tags": [
          "Returns"
        ],
        "x-acenda-required-scope": "return:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"order_id\":10042}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Return"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 801,
                      "order_id": 10042,
                      "order_item_id": 20081,
                      "quantity": 1,
                      "rma": "RMA-10042",
                      "external_return_id": "RETURN-10042",
                      "reason": "Customer return",
                      "status": "returned",
                      "external_status": "received",
                      "restock_inventory": true,
                      "return_required": true,
                      "advance_refund": false,
                      "method": "mail",
                      "carrier": "USPS",
                      "date_shipped": "2026-10-25T00:00:00Z",
                      "return_tracking": [
                        {
                          "number": "9400100000000000000000",
                          "url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=9400100000000000000000"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/return/{return}": {
      "get": {
        "operationId": "getReturn",
        "summary": "Get a return",
        "description": "Read one return record, including return-shipment tracking, by its Acenda return ID. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Returns"
        ],
        "x-acenda-required-scope": "return:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "return",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 801
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": true,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Return"
                            }
                          ],
                          "type": "object"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 801,
                    "order_id": 10042,
                    "order_item_id": 20081,
                    "quantity": 1,
                    "rma": "RMA-10042",
                    "external_return_id": "RETURN-10042",
                    "reason": "Customer return",
                    "status": "returned",
                    "external_status": "received",
                    "restock_inventory": true,
                    "return_required": true,
                    "advance_refund": false,
                    "method": "mail",
                    "carrier": "USPS",
                    "date_shipped": "2026-10-25T00:00:00Z",
                    "return_tracking": [
                      {
                        "number": "9400100000000000000000",
                        "url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=9400100000000000000000"
                      }
                    ]
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/return_extended": {
      "get": {
        "operationId": "listExtendedReturns",
        "summary": "List extended returns",
        "description": "Read returns with product, SKU, and original-order context. Each id is the same return-record ID used by /return. Filter by top-level fields such as sku, order_id, or status. num_results is the number of records on the current page, not a total count.",
        "tags": [
          "Returns"
        ],
        "x-acenda-required-scope": "return:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "name": "query",
            "in": "query",
            "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
            "schema": {
              "type": "string"
            },
            "example": "{\"sku\":\"TRAIL-MUG\"}"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ReturnExtended"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 801,
                      "order_id": 10042,
                      "order_item_id": 20081,
                      "quantity": 1,
                      "rma": "RMA-10042",
                      "external_return_id": "RETURN-10042",
                      "reason": "Customer return",
                      "status": "returned",
                      "external_status": "received",
                      "restock_inventory": true,
                      "return_required": true,
                      "advance_refund": false,
                      "method": "mail",
                      "carrier": "USPS",
                      "date_shipped": "2026-10-25T00:00:00Z",
                      "return_tracking": [
                        {
                          "number": "9400100000000000000000",
                          "url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=9400100000000000000000"
                        }
                      ],
                      "product_id": 101,
                      "sku": "TRAIL-MUG",
                      "external_sku": "TRAIL-MUG",
                      "order_sales_channel_id": 7,
                      "order_sales_channel_name": "Online store",
                      "order_sales_channel_type": "web",
                      "order_sales_channel_subtype": null,
                      "order_sales_channel_country": "US",
                      "order_purchase_order": "PO-10042",
                      "order_external_order_id": "WEB-10042"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/return_extended/{id}": {
      "get": {
        "operationId": "getExtendedReturn",
        "summary": "Get an extended return",
        "description": "Read one return with product and original-order context. The ID is the Acenda return-record ID, not a product, order, or order-item ID. If no record matches, this endpoint currently returns HTTP 200 with a default-valued record; verify that result.id matches the requested ID before using it. This single-record GET supports If-None-Match with a previously saved ETag. A 304 response has no body; reuse the cached result. A 200 response supplies the current result and ETag.",
        "tags": [
          "Returns"
        ],
        "x-acenda-required-scope": "return:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 801
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "nullable": false,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/ReturnExtended"
                            }
                          ],
                          "type": "object"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 801,
                    "order_id": 10042,
                    "order_item_id": 20081,
                    "quantity": 1,
                    "rma": "RMA-10042",
                    "external_return_id": "RETURN-10042",
                    "reason": "Customer return",
                    "status": "returned",
                    "external_status": "received",
                    "restock_inventory": true,
                    "return_required": true,
                    "advance_refund": false,
                    "method": "mail",
                    "carrier": "USPS",
                    "date_shipped": "2026-10-25T00:00:00Z",
                    "return_tracking": [
                      {
                        "number": "9400100000000000000000",
                        "url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=9400100000000000000000"
                      }
                    ],
                    "product_id": 101,
                    "sku": "TRAIL-MUG",
                    "external_sku": "TRAIL-MUG",
                    "order_sales_channel_id": 7,
                    "order_sales_channel_name": "Online store",
                    "order_sales_channel_type": "web",
                    "order_sales_channel_subtype": null,
                    "order_sales_channel_country": "US",
                    "order_purchase_order": "PO-10042",
                    "order_external_order_id": "WEB-10042"
                  }
                }
              }
            },
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "304": {
            "description": "Not Modified. No response body; reuse the cached result.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/pricing_item/bulk": {
      "put": {
        "operationId": "bulkUpdatePricing",
        "summary": "Bulk update base prices",
        "description": "Update stored base prices, MSRP, and minimum advertised prices for existing products; missing pricing rows are created. Send a JSON array with one row per product, identified by product_id or sku, not by pricing-record id. Each row must include a positive product_id or a non-empty sku. Either identifier is sufficient; if both are supplied, product_id takes precedence. Omitted or null price columns retain their values; this is not a way to clear them. Supply currencies explicitly for new amounts. This route does not update promotions or custom prices. HTTP 200 can contain partial results: inspect errors and re-read affected prices before retrying. Summary counters are not individual row receipts.",
        "tags": [
          "Pricing"
        ],
        "x-acenda-required-scope": "pricing:update",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          }
        ],
        "responses": {
          "200": {
            "description": "Bulk result. Inspect errors and reconcile affected records.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/BulkWriteSummary"
                        },
                        "errors": {
                          "$ref": "#/components/schemas/PricingBulkErrors"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": {
                    "values_not_found": {
                      "product_id": null,
                      "sku_not_found": null
                    }
                  },
                  "result": {
                    "submitted": 1,
                    "success": 1,
                    "errors": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PricingBulkItem"
                },
                "minItems": 1
              },
              "example": [
                {
                  "sku": "TRAIL-MUG",
                  "price": {
                    "amount": "29.00",
                    "currency": "USD"
                  },
                  "msrp": {
                    "amount": "35.00",
                    "currency": "USD"
                  }
                }
              ]
            }
          }
        }
      }
    },
    "/ship_advice/{shipadvice}/cancellation": {
      "get": {
        "operationId": "listCancellations",
        "summary": "List ship advice cancellations",
        "description": "Read cancellation records for this ship advice. Use these records and current ship advice item quantities to reconcile an ambiguous cancellation response.",
        "tags": [
          "Cancellations"
        ],
        "x-acenda-required-scope": "cancellation:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "shipadvice",
            "in": "path",
            "required": true,
            "description": "Acenda ship advice ID.",
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "example": 5001
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Sort"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Cancellation"
                          },
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": [
                    {
                      "id": 9001,
                      "ship_advice_id": 5001,
                      "reason": "Unable to fulfill",
                      "cancellation_items": [
                        {
                          "ship_advice_item_id": 6001,
                          "quantity": 1
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCancellation",
        "summary": "Cancel unfulfilled items",
        "description": "Cancel remaining units on an existing ship advice using ship_advice_item_id and quantity. Cancellation records are immutable. New cancellation records return 201. A canonical retry for an already fully canceled item returns 200 with a null result; this narrow behavior is not a general idempotency guarantee for partial cancellations. Re-read state after an ambiguous response. Cancellation retains the original order and its external_order_id. It does not make that ID reusable within the same sales_channel_id. It cannot cancel quantities already fulfilled.",
        "tags": [
          "Cancellations"
        ],
        "x-acenda-required-scope": "cancellation:create",
        "parameters": [
          {
            "$ref": "#/components/parameters/Organization"
          },
          {
            "name": "shipadvice",
            "in": "path",
            "required": true,
            "description": "Existing Acenda record ID.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "example": 5001
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Cancellation"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 201,
                  "execution_time": 0.018,
                  "num_results": 1,
                  "errors": null,
                  "result": {
                    "id": 9001,
                    "ship_advice_id": 5001,
                    "reason": "Unable to fulfill",
                    "cancellation_items": [
                      {
                        "ship_advice_item_id": 6001,
                        "quantity": 1
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or validation failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Organization access or required permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Already fully canceled canonical retry; no new cancellation record.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "object",
                          "nullable": true
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": 200,
                  "execution_time": 0.01,
                  "num_results": 0,
                  "errors": null,
                  "result": null
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancellationCreate"
              },
              "example": {
                "reason": "Unable to fulfill",
                "cancellation_items": [
                  {
                    "ship_advice_item_id": 6001,
                    "quantity": 1
                  }
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Obtain a client-credentials access token from the documented token endpoint. See the authentication guide. Business permissions are assigned by the organization, not requested using an OAuth scope parameter."
      }
    },
    "parameters": {
      "Organization": {
        "name": "X-Astur-Organization",
        "in": "header",
        "required": true,
        "description": "Your organization slug, for example example-store. Do not prefix it with org_.",
        "schema": {
          "type": "string"
        },
        "example": "example-store"
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Maximum records returned per page: 1 to 1000, with a default of 100. A page can contain fewer records.",
        "schema": {
          "type": "integer",
          "default": 100,
          "minimum": 1,
          "maximum": 1000
        },
        "example": 20
      },
      "Page": {
        "name": "page",
        "in": "query",
        "description": "Page number, starting at 1. Keep the same query, sort, and limit when requesting later pages. Stop when result is empty or null.",
        "schema": {
          "type": "integer",
          "default": 1,
          "minimum": 1
        },
        "example": 1
      },
      "Sort": {
        "name": "sort",
        "in": "query",
        "description": "Comma-separated field:direction entries, applied from left to right. Use field:1 for ascending order and field:-1 for descending order. For example, updated_at:-1,id:1 returns the newest updates first, then the lowest ID for equal timestamps. Add a unique ID as the final tie-breaker when paging.",
        "schema": {
          "type": "string"
        },
        "example": "updated_at:-1,id:1"
      },
      "Query": {
        "name": "query",
        "in": "query",
        "description": "A URL-encoded JSON object filtering supported top-level fields on this resource. Multiple fields in one object are combined with AND. Use JSON strings for text and JSON numbers for numeric IDs, and let your HTTP library encode the complete value.",
        "schema": {
          "type": "string"
        },
        "example": "{\"sku\":\"TRAIL-MUG\"}"
      },
      "IfNoneMatch": {
        "name": "If-None-Match",
        "in": "header",
        "required": false,
        "description": "For a conditional single-record GET, send the exact single ETag copied from a previous 200 response, including its quotes. Reuse it only for the same URL, query, organization, and API identity.",
        "schema": {
          "type": "string"
        },
        "example": "\"<saved-etag>\""
      }
    },
    "schemas": {
      "Money": {
        "type": "string",
        "description": "Decimal amount represented as a string. Use the currency configured for the sales channel.",
        "pattern": "^-?\\d+(\\.\\d+)?$",
        "example": "29.00"
      },
      "Address": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "description": "Recipient given name."
          },
          "last_name": {
            "type": "string"
          },
          "address_1": {
            "type": "string",
            "description": "Street address."
          },
          "address_2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "description": "Required for US addresses."
          },
          "postal_code": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 code.",
            "example": "US"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone_number": {
            "type": "string"
          }
        },
        "required": [
          "first_name",
          "address_1",
          "city",
          "postal_code",
          "country"
        ]
      },
      "CatalogItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Acenda catalog record ID.",
            "format": "int64"
          },
          "sku": {
            "type": "string",
            "description": "Unique, case-sensitive SKU."
          },
          "name": {
            "type": "string"
          },
          "group": {
            "type": "string",
            "description": "Catalog kind: a product, variant, or kit.",
            "enum": [
              "product",
              "variant",
              "kit"
            ]
          },
          "upc": {
            "type": "string",
            "nullable": true
          },
          "group_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "nullable": true
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogItem"
            },
            "nullable": true
          },
          "fields": {
            "type": "object",
            "description": "Custom fields configured for this organization.",
            "additionalProperties": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CatalogCreate": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string",
            "description": "Unique SKU for this new catalog item."
          },
          "name": {
            "type": "string"
          },
          "group": {
            "type": "string",
            "description": "This example creates a standalone product.",
            "enum": [
              "product"
            ],
            "default": "product"
          },
          "upc": {
            "type": "string"
          },
          "fields": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "sku"
        ]
      },
      "CatalogPatch": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Replace the display name."
          },
          "upc": {
            "type": "string"
          },
          "fields": {
            "type": "object",
            "description": "Custom fields. Merge behavior must be tested for your configured fields.",
            "additionalProperties": true
          }
        },
        "minProperties": 1
      },
      "OrderItemCreate": {
        "type": "object",
        "properties": {
          "external_sku": {
            "type": "string",
            "description": "SKU from the order source."
          },
          "product_id": {
            "type": "integer",
            "description": "Existing Acenda catalog ID.",
            "format": "int64"
          },
          "sku": {
            "type": "string",
            "description": "Acenda catalog SKU."
          },
          "line_id": {
            "type": "string",
            "description": "Your stable line reference."
          },
          "quantity": {
            "type": "integer",
            "description": "Units ordered.",
            "minimum": 1
          },
          "unit_price": {
            "$ref": "#/components/schemas/Money"
          }
        },
        "required": [
          "external_sku",
          "quantity",
          "unit_price"
        ]
      },
      "OrderItem": {
        "type": "object",
        "properties": {
          "external_sku": {
            "type": "string",
            "description": "SKU from the order source."
          },
          "product_id": {
            "type": "integer",
            "description": "Existing Acenda catalog ID.",
            "format": "int64"
          },
          "sku": {
            "type": "string",
            "description": "Acenda catalog SKU."
          },
          "line_id": {
            "type": "string",
            "description": "Your stable line reference."
          },
          "quantity": {
            "type": "integer",
            "description": "Units ordered.",
            "minimum": 1
          },
          "unit_price": {
            "$ref": "#/components/schemas/Money"
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string"
          },
          "quantity_fulfilled": {
            "type": "integer"
          },
          "quantity_canceled": {
            "type": "integer"
          }
        }
      },
      "OrderCreate": {
        "type": "object",
        "properties": {
          "purchase_order": {
            "type": "string",
            "description": "Your purchase order reference."
          },
          "external_order_id": {
            "type": "string",
            "description": "Your stable source order ID, unique together with sales_channel_id. Cancellation retains this pair. An intentional replacement needs a new ID; retries of that same replacement must keep its ID. Confirm compatibility with the source channel before using a different ID."
          },
          "sales_channel_id": {
            "type": "integer",
            "description": "Existing Acenda sales channel ID.",
            "format": "int64"
          },
          "shipping_information": {
            "$ref": "#/components/schemas/Address"
          },
          "billing_information": {
            "$ref": "#/components/schemas/Address"
          },
          "order_item": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItemCreate"
            },
            "minItems": 1
          },
          "item_tax": {
            "$ref": "#/components/schemas/Money"
          },
          "ship_tax": {
            "$ref": "#/components/schemas/Money"
          },
          "shipping": {
            "$ref": "#/components/schemas/Money"
          },
          "total_item_discount": {
            "$ref": "#/components/schemas/Money"
          },
          "total_shipping_discount": {
            "$ref": "#/components/schemas/Money"
          },
          "subtotal": {
            "$ref": "#/components/schemas/Money"
          },
          "total": {
            "$ref": "#/components/schemas/Money"
          },
          "create_routings": {
            "type": "boolean",
            "default": true,
            "description": "Automatically route the order. With false, no ship advice is created; contact Acenda if that order needs correction or removal."
          },
          "shipping_method": {
            "type": "string"
          },
          "requested_ship_date": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "purchase_order",
          "external_order_id",
          "sales_channel_id",
          "shipping_information",
          "billing_information",
          "item_tax",
          "ship_tax",
          "shipping",
          "total_item_discount",
          "total_shipping_discount",
          "subtotal",
          "total"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "purchase_order": {
            "type": "string",
            "description": "Your purchase order reference."
          },
          "external_order_id": {
            "type": "string",
            "description": "Your stable source order ID, unique together with sales_channel_id. Cancellation retains this pair. An intentional replacement needs a new ID; retries of that same replacement must keep its ID. Confirm compatibility with the source channel before using a different ID."
          },
          "sales_channel_id": {
            "type": "integer",
            "description": "Existing Acenda sales channel ID.",
            "format": "int64"
          },
          "shipping_information": {
            "$ref": "#/components/schemas/Address"
          },
          "billing_information": {
            "$ref": "#/components/schemas/Address"
          },
          "order_item": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            }
          },
          "item_tax": {
            "$ref": "#/components/schemas/Money"
          },
          "ship_tax": {
            "$ref": "#/components/schemas/Money"
          },
          "shipping": {
            "$ref": "#/components/schemas/Money"
          },
          "total_item_discount": {
            "$ref": "#/components/schemas/Money"
          },
          "total_shipping_discount": {
            "$ref": "#/components/schemas/Money"
          },
          "subtotal": {
            "$ref": "#/components/schemas/Money"
          },
          "total": {
            "$ref": "#/components/schemas/Money"
          },
          "create_routings": {
            "type": "boolean",
            "default": true,
            "description": "Automatically route the order. With false, no ship advice is created; contact Acenda if that order needs correction or removal."
          },
          "shipping_method": {
            "type": "string"
          },
          "requested_ship_date": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "order_number": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "description": "Calculated from order and fulfillment state.",
            "enum": [
              "pending",
              "routed",
              "partially_routed",
              "shipped",
              "partially_shipped",
              "canceled"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Inventory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "product_id": {
            "type": "integer",
            "description": "Catalog record ID.",
            "format": "int64"
          },
          "warehouse_id": {
            "type": "integer",
            "format": "int64"
          },
          "sku": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "description": "Stored stock quantity."
          },
          "allocated": {
            "type": "integer",
            "description": "Quantity allocated."
          },
          "not_available": {
            "type": "integer"
          },
          "on_hand": {
            "type": "integer",
            "description": "Calculated availability returned by the read view; do not write this field."
          },
          "tracking": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InventoryCreate": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string",
            "description": "Existing standalone product or variant SKU. Kit inventory is calculated."
          },
          "warehouse_id": {
            "type": "integer",
            "description": "Existing warehouse ID.",
            "format": "int64"
          },
          "quantity": {
            "type": "integer",
            "description": "Absolute quantity; not an increment.",
            "minimum": 0
          },
          "tracking": {
            "type": "string",
            "default": "basic"
          }
        },
        "required": [
          "sku",
          "warehouse_id",
          "quantity"
        ]
      },
      "InventoryPatch": {
        "type": "object",
        "properties": {
          "quantity": {
            "type": "integer",
            "description": "Absolute quantity; not an increment.",
            "minimum": 0
          }
        },
        "required": [
          "quantity"
        ]
      },
      "Warehouse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "active": {
            "type": "boolean"
          },
          "fulfillment_provider_id": {
            "type": "integer",
            "format": "int64"
          },
          "type": {
            "type": "string"
          }
        }
      },
      "SalesChannel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "subtype": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string"
          },
          "integration_subscription_id": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ShipAdviceItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Use this ID as fulfillment_items[].ship_advice_item_id.",
            "format": "int64"
          },
          "order_item_id": {
            "type": "integer",
            "format": "int64"
          },
          "sku": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          },
          "quantity_fulfilled": {
            "type": "integer"
          },
          "quantity_canceled": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "quantity_rerouted": {
            "type": "integer",
            "nullable": true,
            "description": "Units released from this ship advice by reroute records; exclude these from its remaining fulfillable quantity. A separate routing request creates the replacement assignment."
          }
        }
      },
      "ShipAdvice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "order_id": {
            "type": "integer",
            "format": "int64"
          },
          "warehouse_id": {
            "type": "integer",
            "format": "int64"
          },
          "fulfillment_provider_id": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string"
          },
          "ship_advice_item": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipAdviceItem"
            }
          },
          "delivery_information": {
            "$ref": "#/components/schemas/Address"
          },
          "shipping_method": {
            "type": "string"
          },
          "fields": {
            "type": "object",
            "nullable": true,
            "description": "Per-record custom-field values keyed by name. Value shapes depend on the configured field type.",
            "additionalProperties": true
          }
        }
      },
      "TrackingInfo": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string",
            "description": "Carrier tracking number."
          },
          "url": {
            "type": "string",
            "description": "Optional public tracking URL.",
            "format": "uri"
          }
        },
        "required": [
          "number"
        ]
      },
      "FulfillmentItem": {
        "type": "object",
        "properties": {
          "ship_advice_item_id": {
            "type": "integer",
            "description": "ID from the ship advice, not the order item or catalog.",
            "format": "int64"
          },
          "quantity": {
            "type": "integer",
            "description": "Positive units to confirm. Must not exceed quantity minus quantity_fulfilled, quantity_canceled, and quantity_rerouted on the current ship advice item.",
            "minimum": 1
          },
          "external_id": {
            "type": "string",
            "description": "Optional source line reference."
          }
        },
        "required": [
          "ship_advice_item_id",
          "quantity"
        ]
      },
      "FulfillmentCreate": {
        "type": "object",
        "properties": {
          "carrier": {
            "type": "string",
            "description": "Carrier name."
          },
          "date_shipped": {
            "type": "string",
            "format": "date-time"
          },
          "shipping_method": {
            "type": "string"
          },
          "tracking_info": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrackingInfo"
            }
          },
          "fulfillment_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FulfillmentItem"
            },
            "minItems": 1
          },
          "external_id": {
            "type": "string",
            "description": "Your source shipment reference. Not an idempotency key."
          }
        },
        "required": [
          "fulfillment_items"
        ]
      },
      "Fulfillment": {
        "type": "object",
        "properties": {
          "carrier": {
            "type": "string",
            "description": "Carrier name."
          },
          "date_shipped": {
            "type": "string",
            "format": "date-time"
          },
          "shipping_method": {
            "type": "string"
          },
          "tracking_info": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrackingInfo"
            }
          },
          "fulfillment_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FulfillmentItem"
            },
            "minItems": 1
          },
          "external_id": {
            "type": "string",
            "description": "Your source shipment reference. Not an idempotency key."
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "ship_advice_id": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "shipped",
              "canceled"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "shipment",
              "replacement"
            ]
          }
        }
      },
      "Envelope": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status."
          },
          "execution_time": {
            "type": "number",
            "description": "Server execution time in seconds."
          },
          "num_results": {
            "type": "integer",
            "description": "Result metadata; for pagination inspect the actual result array length."
          },
          "errors": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "result": {
            "nullable": true
          }
        },
        "required": [
          "status",
          "num_results",
          "errors",
          "result"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer"
          },
          "execution_time": {
            "type": "number"
          },
          "num_results": {
            "type": "integer"
          },
          "errors": {
            "type": "object",
            "additionalProperties": true,
            "description": "Error keys and values depend on the failure; do not parse human-readable messages."
          },
          "result": {
            "nullable": true
          }
        },
        "required": [
          "status",
          "errors"
        ]
      },
      "Acknowledgment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Acknowledgment record ID; distinct from the order or ship advice ID."
          },
          "resource": {
            "type": "string",
            "enum": [
              "order",
              "ship_advice"
            ]
          },
          "ref_id": {
            "type": "integer",
            "format": "int64",
            "description": "Order or ship advice ID."
          },
          "external_id": {
            "type": "string",
            "description": "Optional reference in your receiving system."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AcknowledgmentCreate": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Optional reference in your receiving system."
          }
        }
      },
      "InventorySummary": {
        "type": "object",
        "properties": {
          "product_id": {
            "type": "integer",
            "format": "int64"
          },
          "sku": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          },
          "on_hand": {
            "type": "integer"
          },
          "allocated": {
            "type": "integer"
          },
          "not_available": {
            "type": "integer"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "inventory_detail": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Inventory"
            },
            "description": "Underlying warehouse records included in this page."
          }
        }
      },
      "Price": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal amount represented as a string.",
            "pattern": "^-?\\d+(\\.\\d+)?$",
            "example": "29.00"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code.",
            "example": "USD"
          }
        }
      },
      "PricingItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "product_id": {
            "type": "integer",
            "format": "int64"
          },
          "sku": {
            "type": "string",
            "nullable": true
          },
          "price": {
            "$ref": "#/components/schemas/PriceWithPresentation"
          },
          "msrp": {
            "$ref": "#/components/schemas/PriceWithPresentation"
          },
          "mapp": {
            "$ref": "#/components/schemas/PriceWithPresentation"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CancellationItem": {
        "type": "object",
        "properties": {
          "ship_advice_item_id": {
            "type": "integer",
            "format": "int64",
            "description": "ID from ship_advice_item, not order_item."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "description": "Units to cancel; must fit the remaining uncanceled, unfulfilled amount."
          }
        },
        "required": [
          "ship_advice_item_id",
          "quantity"
        ]
      },
      "CancellationCreate": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string"
          },
          "cancellation_items": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/CancellationItem"
            }
          }
        },
        "required": [
          "cancellation_items"
        ]
      },
      "Cancellation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "ship_advice_id": {
            "type": "integer",
            "format": "int64"
          },
          "reason": {
            "type": "string"
          },
          "cancellation_items": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/CancellationItem"
            }
          }
        }
      },
      "ShipAdviceItemRerouteCreate": {
        "type": "object",
        "properties": {
          "ship_advice_item_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Existing routed item ID from ship_advice_item, not the order item ID."
          },
          "quantity_rerouted": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Units to release. Choose only units not already fulfilled, canceled, or rerouted."
          }
        },
        "required": [
          "ship_advice_item_id",
          "quantity_rerouted"
        ],
        "description": "Use this reassignment workflow only for non-kit order items. Contact Acenda before releasing or reassigning kit items."
      },
      "ShipAdviceItemReroute": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ShipAdviceItemRerouteCreate"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "format": "int64"
              }
            }
          }
        ]
      },
      "ShipAdviceCreate": {
        "type": "object",
        "properties": {
          "warehouse_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Existing destination warehouse. Its fulfillment provider is used for the new assignment."
          },
          "ship_advice_item": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "properties": {
                "order_item_id": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1,
                  "description": "Existing line ID from this order, not a ship advice item ID."
                },
                "quantity": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1,
                  "description": "Unrouted units to assign from this order item."
                }
              },
              "required": [
                "order_item_id",
                "quantity"
              ]
            }
          }
        },
        "required": [
          "warehouse_id",
          "ship_advice_item"
        ],
        "description": "Use this reassignment workflow only for non-kit order items. Contact Acenda before releasing or reassigning kit items."
      },
      "ShipAdviceCustomFieldsPatch": {
        "type": "object",
        "additionalProperties": false,
        "description": "The supported PATCH body contains only per-record custom-field values.",
        "properties": {
          "fields": {
            "type": "object",
            "description": "Custom-field values keyed by name. This example assumes an existing boolean field named exported_to_erp. Omitted fields are preserved; null or an empty string removes a stored value.",
            "additionalProperties": true
          }
        },
        "required": [
          "fields"
        ]
      },
      "BulkWriteSummary": {
        "type": "object",
        "properties": {
          "submitted": {
            "type": "integer",
            "description": "Number of submitted rows."
          },
          "success": {
            "type": "integer",
            "description": "Database rows affected, as reported by the bulk handler; not a per-row receipt."
          },
          "errors": {
            "type": "integer",
            "description": "Submitted rows minus reported affected rows. Reconcile individual records after a partial result."
          }
        }
      },
      "BulkMissingSku": {
        "type": "object",
        "properties": {
          "sku": {
            "type": "string",
            "description": "SKU that could not be resolved."
          },
          "subscription_id": {
            "type": "integer",
            "description": "Subscription context, when supplied."
          }
        }
      },
      "InventoryBulkItem": {
        "type": "object",
        "properties": {
          "product_id": {
            "type": "integer",
            "description": "Existing standalone product or variant ID. Required unless sku is provided. If both are supplied, product_id takes precedence.",
            "format": "int64",
            "minimum": 1
          },
          "sku": {
            "type": "string",
            "description": "Existing standalone product or variant SKU. Required unless product_id is provided; used when product_id is absent.",
            "minLength": 1
          },
          "warehouse_id": {
            "type": "integer",
            "description": "Existing warehouse ID. The product and warehouse identify the stock row.",
            "format": "int64",
            "minimum": 1
          },
          "quantity": {
            "type": "integer",
            "description": "Absolute stock quantity, not an increment.",
            "minimum": 0
          },
          "allocated": {
            "type": "integer",
            "description": "Allocation total to retain. Omitting this value resets it to zero.",
            "minimum": 0
          },
          "cost": {
            "type": "string",
            "description": "Replacement unit cost as a decimal string. Omitting this value writes zero.",
            "pattern": "^-?\\d+(\\.\\d+)?$",
            "example": "29.00"
          },
          "date_received": {
            "type": "string",
            "description": "Replacement received date. Omitting this value clears the date.",
            "format": "date-time",
            "nullable": true
          },
          "expiration_date": {
            "type": "string",
            "description": "Replacement expiration date. Omitting this value clears the date.",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "warehouse_id",
          "quantity"
        ],
        "anyOf": [
          {
            "required": [
              "product_id"
            ]
          },
          {
            "required": [
              "sku"
            ]
          }
        ],
        "additionalProperties": false,
        "description": "Each row must include a positive product_id or a non-empty sku. Either identifier is sufficient; if both are supplied, product_id takes precedence."
      },
      "InventoryBulkErrors": {
        "type": "object",
        "properties": {
          "values_not_found": {
            "type": "object",
            "properties": {
              "product_id": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "description": "Unresolved product ID."
                },
                "nullable": true
              },
              "warehouse_id": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "description": "Unresolved warehouse ID."
                },
                "nullable": true
              },
              "sku_not_found": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BulkMissingSku"
                },
                "nullable": true
              },
              "upc": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Unresolved UPC."
                },
                "nullable": true
              }
            }
          },
          "invalid_group_kits": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "product_id": {
                  "type": "integer",
                  "description": "Kit product ID."
                },
                "sku": {
                  "type": "string",
                  "description": "Kit SKU."
                },
                "upc": {
                  "type": "string",
                  "description": "Kit UPC."
                }
              }
            },
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "PriceWithPresentation": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Price"
          },
          {
            "type": "object",
            "properties": {
              "presentation": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Price"
                  }
                ],
                "nullable": true,
                "description": "Optional presentation amount and currency."
              }
            }
          }
        ]
      },
      "PricingBulkItem": {
        "type": "object",
        "properties": {
          "product_id": {
            "type": "integer",
            "description": "Existing product ID. Required unless sku is provided. If both are supplied, product_id takes precedence.",
            "format": "int64",
            "minimum": 1
          },
          "sku": {
            "type": "string",
            "description": "Existing product SKU. Required unless product_id is provided; used when product_id is absent.",
            "minLength": 1
          },
          "price": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PriceWithPresentation"
              }
            ],
            "nullable": true,
            "description": "Stored base price. Omitted or null columns retain existing values."
          },
          "msrp": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PriceWithPresentation"
              }
            ],
            "nullable": true,
            "description": "Manufacturer suggested retail price. Omitted or null columns retain existing values."
          },
          "mapp": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PriceWithPresentation"
              }
            ],
            "nullable": true,
            "description": "Minimum advertised price. Omitted or null columns retain existing values."
          }
        },
        "anyOf": [
          {
            "required": [
              "product_id"
            ]
          },
          {
            "required": [
              "sku"
            ]
          }
        ],
        "additionalProperties": false,
        "description": "Each row must include a positive product_id or a non-empty sku. Either identifier is sufficient; if both are supplied, product_id takes precedence."
      },
      "PricingBulkErrors": {
        "type": "object",
        "properties": {
          "values_not_found": {
            "type": "object",
            "properties": {
              "product_id": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "description": "Unresolved product ID."
                },
                "nullable": true
              },
              "sku_not_found": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BulkMissingSku"
                },
                "nullable": true
              }
            }
          }
        },
        "additionalProperties": true
      },
      "FulfillmentProvider": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Acenda fulfillment-provider ID.",
            "format": "int64"
          },
          "name": {
            "type": "string",
            "description": "Friendly provider name."
          },
          "service": {
            "type": "string",
            "description": "Fulfillment service name."
          },
          "type": {
            "type": "string",
            "description": "Provider type.",
            "enum": [
              "self",
              "3pl"
            ]
          },
          "active": {
            "type": "boolean",
            "nullable": true
          },
          "integration_subscription_id": {
            "type": "integer",
            "description": "Associated integration subscription ID.",
            "format": "int64"
          },
          "updated_at": {
            "type": "string",
            "description": "Last update timestamp.",
            "format": "date-time"
          }
        }
      },
      "Return": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Acenda return-record ID.",
            "format": "int64"
          },
          "order_id": {
            "type": "integer",
            "description": "Original Acenda order ID.",
            "format": "int64"
          },
          "order_item_id": {
            "type": "integer",
            "description": "Original Acenda order-item ID.",
            "format": "int64"
          },
          "quantity": {
            "type": "integer",
            "description": "Returned quantity."
          },
          "rma": {
            "type": "string",
            "description": "Return merchandise authorization reference."
          },
          "license_plate_number": {
            "type": "string",
            "description": "Recorded license-plate reference."
          },
          "external_return_id": {
            "type": "string",
            "description": "Return ID in the source system.",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "description": "Recorded return reason."
          },
          "status": {
            "type": "string",
            "description": "Recorded return state, normally pending, returned, or canceled. A missing extended-return lookup contains an empty status."
          },
          "external_status": {
            "type": "string",
            "description": "Unnormalized return status from the source system.",
            "nullable": true
          },
          "restock_inventory": {
            "type": "boolean"
          },
          "return_required": {
            "type": "boolean",
            "nullable": true
          },
          "advance_refund": {
            "type": "boolean"
          },
          "method": {
            "type": "string",
            "description": "Return method."
          },
          "carrier": {
            "type": "string",
            "description": "Return carrier."
          },
          "date_shipped": {
            "type": "string",
            "description": "Return shipment date.",
            "format": "date-time",
            "nullable": true
          },
          "return_tracking": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrackingInfo"
            },
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "description": "Creation timestamp.",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "description": "Last update timestamp.",
            "format": "date-time"
          }
        }
      },
      "ReturnExtended": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Return"
          },
          {
            "type": "object",
            "properties": {
              "product_id": {
                "type": "integer",
                "description": "Product on the original order item.",
                "format": "int64"
              },
              "sku": {
                "type": "string",
                "description": "Catalog SKU.",
                "nullable": true
              },
              "external_sku": {
                "type": "string",
                "description": "SKU from the source order item.",
                "nullable": true
              },
              "order_sales_channel_id": {
                "type": "integer",
                "description": "Sales channel of the original order.",
                "format": "int64"
              },
              "order_sales_channel_name": {
                "type": "string",
                "description": "Sales-channel name."
              },
              "order_sales_channel_type": {
                "type": "string",
                "description": "Sales-channel type.",
                "nullable": true
              },
              "order_sales_channel_subtype": {
                "type": "string",
                "description": "Sales-channel subtype.",
                "nullable": true
              },
              "order_sales_channel_country": {
                "type": "string",
                "description": "Sales-channel country.",
                "nullable": true
              },
              "order_purchase_order": {
                "type": "string",
                "description": "Original purchase-order reference.",
                "nullable": true
              },
              "order_external_order_id": {
                "type": "string",
                "description": "Original external order ID.",
                "nullable": true
              }
            }
          }
        ]
      }
    },
    "headers": {
      "ETag": {
        "description": "Opaque quoted validator for result. Save this exact value with the result for a later conditional GET; do not derive it from the response body.",
        "schema": {
          "type": "string"
        },
        "example": "\"<opaque-etag>\""
      }
    }
  }
}
