{
  "openapi": "3.1.0",
  "info": {
    "title": "Ordexs API",
    "version": "v1",
    "description": "The Ordexs API lets your software read and change an Ordexs store: products,\nstock, orders, customers and delivery prices, plus webhooks for everything\nthat happens in it.\n",
    "contact": {
      "name": "Ordexs developer support",
      "url": "https://ordexs.com/docs"
    }
  },
  "servers": [
    {
      "url": "https://api.ordexs.com/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Store",
      "description": "The store the API key belongs to."
    },
    {
      "name": "Products",
      "description": "Products, their variants and stock."
    },
    {
      "name": "Orders",
      "description": "Orders, their notes and history."
    },
    {
      "name": "Customers",
      "description": "The people who ordered from the store."
    },
    {
      "name": "Webhooks",
      "description": "Endpoints that receive events, and the event log."
    },
    {
      "name": "Geography",
      "description": "Countries, regions, cities and the store's delivery prices."
    },
    {
      "name": "Inventory",
      "description": "Stock levels, adjustments with a reason, the stock history, deliveries and stock counts."
    },
    {
      "name": "Abandoned checkouts",
      "description": "Shoppers who left their details at checkout without ordering."
    },
    {
      "name": "Collections",
      "description": "Collections (hand-picked or automated) and the categories products use."
    },
    {
      "name": "Reviews",
      "description": "Product reviews and their moderation."
    },
    {
      "name": "Offers",
      "description": "Offers (bundles, quantity packs, cross-sells) and discounts (codes and automatic)."
    },
    {
      "name": "Returns",
      "description": "Parcels coming back, and checking them in to stock."
    },
    {
      "name": "Money",
      "description": "Cash on delivery owed by couriers, and their payouts."
    },
    {
      "name": "Delivery setup",
      "description": "Delivery prices and settings, courier accounts, the default courier and routing rules."
    },
    {
      "name": "Analytics",
      "description": "Read-only reports, computed by the same code as the dashboard."
    },
    {
      "name": "Content",
      "description": "The store's pages, policies and order form."
    },
    {
      "name": "Marketing",
      "description": "Marketing pixels."
    },
    {
      "name": "Bulk",
      "description": "Background jobs for thousands of lines, and exports."
    },
    {
      "name": "Shipping",
      "description": "Sending orders to the courier, tracking and labels."
    }
  ],
  "paths": {
    "/products": {
      "get": {
        "operationId": "listProducts",
        "tags": [
          "Products"
        ],
        "summary": "List products",
        "description": "Newest first. Pass `updated_since` to get every product changed since a\nmoment, oldest change first — a variant's stock or price change counts as\na change to its product.\n",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "unknown_field",
          "validation_failed",
          "invalid_request"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/updated_since"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "published",
                "archived"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Text the product title contains.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          },
          {
            "name": "sku",
            "in": "query",
            "description": "Exact SKU of one of the product's variants (case-insensitive).",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "handle",
            "in": "query",
            "description": "The product's handle, the last part of its storefront address (`/products/oversized-hoodie`). Case-insensitive.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductList"
                },
                "examples": {
                  "page": {
                    "$ref": "#/components/examples/ProductList"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createProduct",
        "tags": [
          "Products"
        ],
        "summary": "Create a product",
        "description": "Creates a product with its options and variants. Every variant names\none value for each option. Prices are decimal strings in the store's\ncurrency. Images can't be uploaded through the API yet.\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "request_rejected"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCreate"
              },
              "examples": {
                "hoodie": {
                  "value": {
                    "title": "Oversized hoodie",
                    "status": "published",
                    "options": [
                      {
                        "name": "Color",
                        "type": "color",
                        "values": [
                          "Black",
                          "Sand"
                        ]
                      },
                      {
                        "name": "Size",
                        "type": "size",
                        "values": [
                          "M",
                          "L"
                        ]
                      }
                    ],
                    "variants": [
                      {
                        "options": {
                          "Color": "Black",
                          "Size": "M"
                        },
                        "price": "3500.00",
                        "sku": "HOOD-BLK-M",
                        "inventory_quantity": 10
                      },
                      {
                        "options": {
                          "Color": "Sand",
                          "Size": "L"
                        },
                        "price": "3500.00",
                        "sku": "HOOD-SND-L",
                        "inventory_quantity": 4
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                },
                "examples": {
                  "product": {
                    "$ref": "#/components/examples/Product"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/products/{product_id}": {
      "get": {
        "operationId": "getProduct",
        "tags": [
          "Products"
        ],
        "summary": "Retrieve a product",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product with its variants and images.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                },
                "examples": {
                  "product": {
                    "$ref": "#/components/examples/Product"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateProduct",
        "tags": [
          "Products"
        ],
        "summary": "Update a product",
        "description": "Changes the product's own fields. Send only what changes. Variants,\nprices and stock are changed on the variant (PATCH /v1/variants/{variant_id}).\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/product_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductUpdate"
              },
              "examples": {
                "rename": {
                  "value": {
                    "title": "Oversized hoodie — winter edition",
                    "tags": [
                      "winter",
                      "bestseller"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                },
                "examples": {
                  "product": {
                    "$ref": "#/components/examples/Product"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "archiveProduct",
        "tags": [
          "Products"
        ],
        "summary": "Archive a product",
        "description": "Archives the product, as the dashboard does: it disappears from the\nstorefront and can't be ordered, and orders that already contain it are\nuntouched. Set `status` back to `draft` or `published` to restore it.\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/product_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The archived product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                },
                "examples": {
                  "product": {
                    "$ref": "#/components/examples/Product"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/variants/{variant_id}": {
      "get": {
        "operationId": "getVariant",
        "tags": [
          "Products"
        ],
        "summary": "Retrieve a variant",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request"
        ],
        "parameters": [
          {
            "name": "variant_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^var_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The variant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Variant"
                },
                "examples": {
                  "variant": {
                    "$ref": "#/components/examples/Variant"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateVariant",
        "tags": [
          "Products"
        ],
        "summary": "Update a variant",
        "description": "Prices, identifiers and stock. Setting `inventory_quantity` records a\nstock adjustment in the store's inventory history, exactly like a\nchange made in the dashboard.\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "request_rejected"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/variant_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VariantUpdate"
              },
              "examples": {
                "restock": {
                  "value": {
                    "inventory_quantity": 25,
                    "price": "3200.00"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated variant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Variant"
                },
                "examples": {
                  "variant": {
                    "$ref": "#/components/examples/Variant"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteVariant",
        "tags": [
          "Products"
        ],
        "summary": "Delete a variant",
        "description": "A product's only variant can't be deleted — archive the product instead.",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/variant_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The variant was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "var_2f0e1d3c4b5a49688776655443322110",
                      "object": "variant",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "listOrders",
        "tags": [
          "Orders"
        ],
        "summary": "List orders",
        "description": "Newest first. Pass `updated_since` to get every order changed since a\nmoment, oldest change first.\n",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "unknown_field",
          "validation_failed",
          "invalid_request"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/updated_since"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "status",
            "in": "query",
            "description": "One status, or several separated by commas.",
            "schema": {
              "type": "array",
              "maxItems": 15,
              "items": {
                "$ref": "#/components/schemas/OrderStatus"
              }
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "The order number as the merchant sees it (`ORD-00042`), or just its digits (`42`).",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9-]{0,12}[0-9]{1,9}$"
            }
          },
          {
            "name": "phone",
            "in": "query",
            "description": "The customer's phone, in E.164 (`+213551234567`) or national form.",
            "schema": {
              "type": "string",
              "minLength": 6,
              "maxLength": 20
            }
          },
          {
            "name": "archived",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Your own id, as sent when the order was created.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "name": "source",
            "in": "query",
            "description": "Where the order came from.",
            "schema": {
              "type": "string",
              "enum": [
                "storefront",
                "dashboard",
                "api",
                "import"
              ]
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Only this customer's orders (matched by phone, as on the Customers page).",
            "schema": {
              "type": "string",
              "pattern": "^cus_[0-9a-f]{32}$"
            }
          },
          {
            "name": "needs_review",
            "in": "query",
            "description": "Only orders that wait for the merchant to confirm the address (true), or only those that don't (false).",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderList"
                },
                "examples": {
                  "page": {
                    "$ref": "#/components/examples/OrderList"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Create an order",
        "description": "Creates an order exactly as the store's own checkout would: the store\nprices every line, applies its offers and the discount code, prices\ndelivery, checks stock and assigns the order number. You never send a\nprice. The order arrives in the merchant's dashboard like any other.\n\nRetrying is safe: send an `Idempotency-Key` header, or an\n`external_id` — a second order with the same `external_id` (and\n`source_name`) is refused with `duplicate_external_id` and the existing\norder's id.\n\nIf the city doesn't match one of the region's cities, the order is still\ncreated, with `needs_review: \"city_unmatched\"`: the merchant confirms\nthe city before it can go to a courier.\n\n`shipping_address.region` takes the region code, its ISO code or its\nname, so an agent can pass on what the customer said.\n\nWhen a line is short, `out_of_stock` carries `details.lines`: for each\nshort line, `line_item_index`, `variant_id`, `requested`,\n`available_quantity` and `preorder_possible` (send `\"preorder\": true` to\ntake it from the incoming delivery).\n",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "duplicate_external_id",
          "out_of_stock",
          "region_unknown",
          "country_not_served",
          "delivery_unavailable",
          "store_paused",
          "store_restricted",
          "request_rejected"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderCreate"
              },
              "examples": {
                "cod_order": {
                  "$ref": "#/components/examples/OrderCreate"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderCreated"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}": {
      "get": {
        "operationId": "getOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Retrieve an order",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Update an order",
        "description": "Changes the customer, the shipping address, the note, the lines, the\namounts or the metadata. Send only what changes; change `region` and\n`city` together.\n\n**Order already with a courier.** The change is sent to the courier first,\nexactly as saving the order in the dashboard does, and saved only if the\ncourier accepts it: a refusal is `courier_rejected` and nothing changes.\nEach courier accepts only some details on a parcel it has (DHD and the\nEcotrack family: all of them; Yalidine: all but the note; ZR Express: not\nthe second phone), and only until the parcel is validated or picked up;\noutside that, `invalid_state_transition` says why. Email and metadata never\nreach the courier and can always change; `scheduled_for` and `courier` need\nthe shipment cancelled first.\n",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition",
          "region_unknown",
          "country_not_served",
          "out_of_stock",
          "courier_rejected",
          "upstream_unavailable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderUpdate"
              },
              "examples": {
                "new_address": {
                  "value": {
                    "shipping_address": {
                      "region": "16",
                      "city": "Hydra",
                      "address1": "5 rue des Pins"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/notes": {
      "get": {
        "operationId": "listOrderNotes",
        "tags": [
          "Orders"
        ],
        "summary": "List an order's notes",
        "description": "Newest first, up to the 200 most recent.",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderNoteList"
                },
                "examples": {
                  "notes": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "id": "note_0f8b2a9c4d5e4f60a1b2c3d4e5f60718",
                          "object": "order_note",
                          "order_id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
                          "body": "Customer asked for delivery after 5 pm.",
                          "author": {
                            "type": "staff",
                            "name": "Amina"
                          },
                          "livemode": true,
                          "created_at": "2026-10-08T14:02:11Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createOrderNote",
        "tags": [
          "Orders"
        ],
        "summary": "Add a note to an order",
        "description": "The note appears on the order in the dashboard, signed with the API key's name.",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "body"
                ],
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                }
              },
              "examples": {
                "note": {
                  "value": {
                    "body": "Customer confirmed by chat — deliver after 5 pm."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderNote"
                },
                "examples": {
                  "note": {
                    "value": {
                      "id": "note_0f8b2a9c4d5e4f60a1b2c3d4e5f60718",
                      "object": "order_note",
                      "order_id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
                      "body": "Customer confirmed by chat — deliver after 5 pm.",
                      "author": {
                        "type": "api_key",
                        "name": "API key \"Chatbot\""
                      },
                      "livemode": true,
                      "created_at": "2026-10-11T10:02:11Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/history": {
      "get": {
        "operationId": "listOrderHistory",
        "tags": [
          "Orders"
        ],
        "summary": "List an order's history",
        "description": "Everything that happened to the order — status changes, assignments,\ncourier updates and notes — newest first, up to the 200 most recent.\n",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The history entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderHistoryList"
                },
                "examples": {
                  "history": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "order_history_entry",
                          "type": "status_change",
                          "description": null,
                          "from_status": "pending",
                          "to_status": "confirmed",
                          "actor": {
                            "type": "staff",
                            "name": "Amina"
                          },
                          "livemode": true,
                          "created_at": "2026-10-08T14:05:40Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/customers": {
      "get": {
        "operationId": "listCustomers",
        "tags": [
          "Customers"
        ],
        "summary": "List customers",
        "x-ordexs-scope": "customers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "unknown_field",
          "validation_failed",
          "invalid_request"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/updated_since"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "phone",
            "in": "query",
            "description": "Exact phone, in E.164 or national form.",
            "schema": {
              "type": "string",
              "minLength": 6,
              "maxLength": 20
            }
          },
          {
            "name": "email",
            "in": "query",
            "description": "Exact email (case-insensitive).",
            "schema": {
              "type": "string",
              "format": "email",
              "maxLength": 254
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of customers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createCustomer",
        "tags": [
          "Customers"
        ],
        "summary": "Create a customer",
        "description": "One customer per phone (or email) per store. If one already exists you\nget `duplicate_customer` with its id. Customers are also created\nautomatically when an order arrives.\n",
        "x-ordexs-scope": "customers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "duplicate_customer"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCreate"
              },
              "examples": {
                "customer": {
                  "value": {
                    "name": "Yacine Benali",
                    "phone": "+213551234567",
                    "tags": [
                      "wholesale"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                },
                "examples": {
                  "customer": {
                    "$ref": "#/components/examples/Customer"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/customers/{customer_id}": {
      "get": {
        "operationId": "getCustomer",
        "tags": [
          "Customers"
        ],
        "summary": "Retrieve a customer",
        "x-ordexs-scope": "customers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request"
        ],
        "parameters": [
          {
            "name": "customer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^cus_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                },
                "examples": {
                  "customer": {
                    "$ref": "#/components/examples/Customer"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateCustomer",
        "tags": [
          "Customers"
        ],
        "summary": "Update a customer",
        "description": "Name, status, tags and note. A customer's phone and email identify them and can't be changed.",
        "x-ordexs-scope": "customers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "request_rejected"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/customer_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerUpdate"
              },
              "examples": {
                "follow_up": {
                  "value": {
                    "status": "needs_followup",
                    "note": "Asked about wholesale prices."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                },
                "examples": {
                  "customer": {
                    "$ref": "#/components/examples/Customer"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/countries": {
      "get": {
        "operationId": "listCountries",
        "tags": [
          "Geography"
        ],
        "summary": "List supported countries",
        "description": "The countries Ordexs stores can sell in, with their currency and phone rules.",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The countries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountryList"
                },
                "examples": {
                  "countries": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "country",
                          "code": "DZ",
                          "name": "Algeria",
                          "currency": {
                            "code": "DZD",
                            "exponent": 2
                          },
                          "phone": {
                            "calling_code": "+213",
                            "national_digits": 9,
                            "trunk_prefix": "0"
                          },
                          "region_label": "Wilaya",
                          "city_label": "Commune"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/regions": {
      "get": {
        "operationId": "listRegions",
        "tags": [
          "Geography"
        ],
        "summary": "List a country's regions",
        "description": "The first-level areas of a country (wilayas in Algeria). Use `code` in\nshipping addresses.\n",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "rate_limited",
          "validation_failed",
          "country_not_served"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/country"
          }
        ],
        "responses": {
          "200": {
            "description": "The regions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionList"
                },
                "examples": {
                  "regions": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "region",
                          "country": "DZ",
                          "code": "16",
                          "iso_code": "DZ-16",
                          "name": "Algiers",
                          "name_local": "الجزائر"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/cities": {
      "get": {
        "operationId": "listCities",
        "tags": [
          "Geography"
        ],
        "summary": "List a region's cities",
        "description": "The second-level areas of a region (communes in Algeria).",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "rate_limited",
          "validation_failed",
          "country_not_served",
          "region_unknown"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/country"
          },
          {
            "name": "region",
            "in": "query",
            "required": true,
            "description": "A region `code` from `GET /v1/regions`.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The cities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CityList"
                },
                "examples": {
                  "cities": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "city",
                          "country": "DZ",
                          "region": "16",
                          "code": null,
                          "name": "Bab El Oued",
                          "name_local": "باب الوادي"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/delivery/rates": {
      "get": {
        "operationId": "listDeliveryRates",
        "tags": [
          "Geography"
        ],
        "summary": "List delivery rates for a destination",
        "description": "What this store charges to deliver to a region, by mode (home or pickup\npoint) and courier — computed exactly as the store's own checkout does.\nPass the `mode` and `courier.id` of the rate you want when you create an\norder. When `delivery_required` is false the store doesn't charge for\ndelivery and orders need no delivery choice.\n",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "rate_limited",
          "validation_failed",
          "region_unknown"
        ],
        "parameters": [
          {
            "name": "region",
            "in": "query",
            "required": true,
            "description": "A region in the store's country, from `GET /v1/regions`. Its `code` (`16`), its ISO code (`DZ-16`) or its name (`Alger`, `الجزائر`; one typo is tolerated).",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryRates"
                },
                "examples": {
                  "rates": {
                    "value": {
                      "object": "delivery_rates",
                      "country": "DZ",
                      "region": "16",
                      "delivery_required": true,
                      "data": [
                        {
                          "object": "delivery_rate",
                          "mode": "home",
                          "label": "Door delivery",
                          "price": {
                            "amount": "600.00",
                            "currency": "DZD"
                          },
                          "courier": {
                            "id": "cour_6c1d0e4b9a8f4c3e8b7a6d5c4b3a2f10",
                            "name": "Yalidine"
                          }
                        },
                        {
                          "object": "delivery_rate",
                          "mode": "pickup_point",
                          "label": "Stop desk",
                          "price": {
                            "amount": "400.00",
                            "currency": "DZD"
                          },
                          "courier": {
                            "id": "cour_6c1d0e4b9a8f4c3e8b7a6d5c4b3a2f10",
                            "name": "Yalidine"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/preview": {
      "post": {
        "operationId": "previewOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Preview an order",
        "description": "Runs everything POST /v1/orders does — pricing, offers, discount code,\ndelivery and stock checks — and returns the order it WOULD create, with\n`object: \"order_preview\"` and no id. Nothing is saved, no stock moves\nand no number is used. Show this to a customer before they confirm.\n",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "out_of_stock",
          "region_unknown",
          "country_not_served",
          "delivery_unavailable",
          "store_paused",
          "store_restricted",
          "request_rejected"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderCreate"
              },
              "examples": {
                "cod_order": {
                  "$ref": "#/components/examples/OrderCreate"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The order as it would be created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/status": {
      "post": {
        "operationId": "setOrderStatus",
        "tags": [
          "Orders"
        ],
        "summary": "Change an order's status",
        "description": "Sets one of the statuses a merchant's team sets by hand. Courier\nstatuses (`shipped`, `delivered`, `returned`…) come from the courier\nand can't be set. Refused once the order is with a courier.\n",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "confirmed",
                      "scheduled",
                      "attempt_1",
                      "attempt_2",
                      "attempt_3",
                      "double",
                      "waiting",
                      "cancelled"
                    ]
                  },
                  "reason": {
                    "$ref": "#/components/schemas/StatusReason"
                  }
                }
              },
              "examples": {
                "confirm": {
                  "value": {
                    "status": "confirmed"
                  }
                },
                "no_answer": {
                  "value": {
                    "status": "attempt_1",
                    "reason": {
                      "code": "no_answer"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/cancel": {
      "post": {
        "operationId": "cancelOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Cancel an order",
        "description": "Sets the status to `cancelled`. Refused once the order is with a courier.",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "$ref": "#/components/schemas/StatusReason"
                  }
                }
              },
              "examples": {
                "changed_mind": {
                  "value": {
                    "reason": {
                      "code": "changed_mind"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The cancelled order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/products/{product_id}/variants": {
      "post": {
        "operationId": "createVariant",
        "tags": [
          "Products"
        ],
        "summary": "Add a variant",
        "description": "Adds a variant for a new combination of the product's options. A value\nan option doesn't have yet is added to it.\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/product_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VariantCreate"
              },
              "examples": {
                "xl": {
                  "value": {
                    "options": {
                      "Color": "Black",
                      "Size": "XL"
                    },
                    "price": "3700.00",
                    "sku": "HOOD-BLK-XL",
                    "inventory_quantity": 6
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new variant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Variant"
                },
                "examples": {
                  "variant": {
                    "$ref": "#/components/examples/Variant"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/webhook_endpoints": {
      "get": {
        "operationId": "listWebhookEndpoints",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "The endpoints of this mode — a test key sees test endpoints, a live key live ones.\nAn app connected with OAuth sees only the endpoints it created itself; they are\ndeleted when the merchant disconnects the app.\n",
        "x-ordexs-scope": "webhooks:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The endpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointList"
                },
                "examples": {
                  "endpoints": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "$ref": "#/components/examples/WebhookEndpoint/value"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook endpoint",
        "description": "The URL must be https, on port 443 or 8443, and resolve to a public\naddress. The response carries the signing `secret` — the only time it\nis shown. Store it; rotate it if it leaks.\n\nCreated with an OAuth access token, the endpoint belongs to that\nconnection: only the app sees it, and it is deleted when the merchant\ndisconnects the app or approves it again. Register your endpoints right\nafter each approval.\n",
        "x-ordexs-scope": "webhooks:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "quota_exceeded",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointCreate"
              },
              "examples": {
                "orders": {
                  "value": {
                    "url": "https://example.com/ordexs/webhooks",
                    "events": [
                      "order.created",
                      "order.status_changed"
                    ],
                    "description": "Fulfilment system"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The endpoint, with its signing secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                },
                "examples": {
                  "created": {
                    "value": {
                      "id": "we_8c2f0a1b3d4e4f5a9b8c7d6e5f4a3b2c",
                      "object": "webhook_endpoint",
                      "url": "https://example.com/ordexs/webhooks",
                      "description": "Fulfilment system",
                      "events": [
                        "order.created",
                        "order.status_changed"
                      ],
                      "status": "enabled",
                      "disabled_reason": null,
                      "failing_since": null,
                      "livemode": true,
                      "secret": "whsec_3f9Kq2Lm8Pz1Xc7Vb4Nn6Rt0Yw5Ua2Sd",
                      "created_at": "2026-10-11T10:00:00Z",
                      "updated_at": "2026-10-11T10:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/webhook_endpoints/{webhook_endpoint_id}": {
      "get": {
        "operationId": "getWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Retrieve a webhook endpoint",
        "x-ordexs-scope": "webhooks:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/webhook_endpoint_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint (never with its secret).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                },
                "examples": {
                  "endpoint": {
                    "$ref": "#/components/examples/WebhookEndpoint"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook endpoint",
        "description": "Change the URL, the events or the description, or set `status` to\n`disabled` / `enabled`. Enabling an endpoint that was turned off\nafter failing for 3 days starts it fresh.\n",
        "x-ordexs-scope": "webhooks:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/webhook_endpoint_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointUpdate"
              },
              "examples": {
                "pause": {
                  "value": {
                    "status": "disabled"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                },
                "examples": {
                  "endpoint": {
                    "$ref": "#/components/examples/WebhookEndpoint"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "description": "Deliveries still waiting for it are dropped.",
        "x-ordexs-scope": "webhooks:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/webhook_endpoint_id"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "we_8c2f0a1b3d4e4f5a9b8c7d6e5f4a3b2c",
                      "object": "webhook_endpoint",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/webhook_endpoints/{webhook_endpoint_id}/rotate_secret": {
      "post": {
        "operationId": "rotateWebhookSecret",
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate the signing secret",
        "description": "Issues a new secret (returned once). For `expire_previous_in_hours`\n(default 24, up to 72) every delivery is signed with BOTH secrets, so\nyou can switch without missing an event. 0 retires the old one at once.\n",
        "x-ordexs-scope": "webhooks:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/webhook_endpoint_id"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "expire_previous_in_hours": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 72
                  }
                }
              },
              "examples": {
                "overlap": {
                  "value": {
                    "expire_previous_in_hours": 24
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The endpoint with its new secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                },
                "examples": {
                  "endpoint": {
                    "$ref": "#/components/examples/WebhookEndpoint"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/webhook_endpoints/{webhook_endpoint_id}/test": {
      "post": {
        "operationId": "testWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test event",
        "description": "Queues a `ping` event to this endpoint only. It arrives within seconds, signed like any other.",
        "x-ordexs-scope": "webhooks:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_state_transition",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/webhook_endpoint_id"
          }
        ],
        "responses": {
          "202": {
            "description": "Queued.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "webhook_test"
                    },
                    "event_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "queued"
                    }
                  }
                },
                "examples": {
                  "queued": {
                    "value": {
                      "object": "webhook_test",
                      "event_id": "evt_1a2b3c4d5e6f40718293a4b5c6d7e8f9",
                      "status": "queued"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/events": {
      "get": {
        "operationId": "listEvents",
        "tags": [
          "Webhooks"
        ],
        "summary": "List events",
        "description": "The events of the last 30 days for this mode, newest first — the same\nbodies that were POSTed. Use it to catch up on anything your endpoint\nmissed. Only events some endpoint was subscribed to are recorded.\n",
        "x-ordexs-scope": "events:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "unknown_field",
          "validation_failed",
          "invalid_request"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "type",
            "in": "query",
            "description": "Only events of this type, for example `order.created`.",
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/events/{event_id}": {
      "get": {
        "operationId": "getEvent",
        "tags": [
          "Webhooks"
        ],
        "summary": "Retrieve an event",
        "x-ordexs-scope": "events:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^evt_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The event.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                },
                "examples": {
                  "event": {
                    "$ref": "#/components/examples/Event"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/ship": {
      "post": {
        "operationId": "shipOrder",
        "tags": [
          "Shipping"
        ],
        "summary": "Send an order to the courier",
        "description": "Registers the order with a courier, exactly as the dashboard's **Send to\ncourier** does: the same parcel details, the same reference (the order\nnumber), the same checks. The answer is the new shipment, with its\n`tracking_code`, and the order moves to `shipped`.\n\n**This creates a real parcel at the courier** with a live key. The\ncourier is the one you pass in `courier_id`, else the one chosen at\ncheckout, else the store's routing rules, else its default courier.\n\nOnly one send per order can run at a time, and an order already with a\ncourier is refused: cancel its shipment first. An order whose address\nneeds review (`needs_review`) is refused until the merchant confirms it.\n\nIf the courier refuses the parcel you get `courier_rejected` with the\ncourier's own reason, and a failed shipment is recorded so the merchant\nsees the attempt. With a test key nothing leaves Ordexs: the shipment is\nsimulated, with a `TEST-…` tracking code.\n",
        "x-ordexs-scope": "shipping:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition",
          "courier_not_configured",
          "courier_rejected",
          "upstream_unavailable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "courier_id": {
                    "type": "string",
                    "pattern": "^cour_[0-9a-f]{32}$",
                    "description": "A courier account from GET /v1/delivery/rates. Leave it out to use the order's courier, the routing rules or the default."
                  }
                }
              },
              "examples": {
                "default_courier": {
                  "value": {}
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new shipment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shipment"
                },
                "examples": {
                  "shipment": {
                    "$ref": "#/components/examples/Shipment"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/shipments": {
      "get": {
        "operationId": "listShipments",
        "tags": [
          "Shipping"
        ],
        "summary": "List shipments",
        "description": "Every parcel the store sent to a courier, newest first, including failed\nattempts. With `updated_since`, oldest change first: the way to follow\ncourier progress without webhooks. A shipment's status and stage come\nfrom the courier's tracking, read on a schedule by Ordexs.\n",
        "x-ordexs-scope": "shipping:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/updated_since"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "order_id",
            "in": "query",
            "description": "Only this order's shipments.",
            "schema": {
              "type": "string",
              "pattern": "^ord_[0-9a-f]{32}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/ShipmentStatus"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of shipments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentList"
                },
                "examples": {
                  "page": {
                    "$ref": "#/components/examples/ShipmentList"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/shipments/{shipment_id}": {
      "get": {
        "operationId": "getShipment",
        "tags": [
          "Shipping"
        ],
        "summary": "Retrieve a shipment",
        "x-ordexs-scope": "shipping:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/shipment_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The shipment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shipment"
                },
                "examples": {
                  "shipment": {
                    "$ref": "#/components/examples/Shipment"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/shipments/{shipment_id}/label": {
      "get": {
        "operationId": "getShipmentLabel",
        "tags": [
          "Shipping"
        ],
        "summary": "Download the label",
        "description": "The courier's label (waybill) for this parcel, as a file: usually a PDF\n(`Content-Type: application/pdf`), for a few couriers an HTML page sized\nto the label. Print it as it comes. If a courier only serves its label\nat its own address and Ordexs can't fetch it, you get `303 See Other`\nwith that address in `Location`.\n\nEach call asks the courier, so fetch a label when you print it rather\nthan in a loop. A test shipment returns a PDF marked TEST.\n",
        "x-ordexs-scope": "shipping:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_state_transition",
          "courier_not_configured",
          "courier_rejected",
          "request_rejected",
          "upstream_unavailable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/shipment_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The label file.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "303": {
            "description": "The label lives at the courier's address in `Location`."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/shipments/{shipment_id}/cancel": {
      "post": {
        "operationId": "cancelShipment",
        "tags": [
          "Shipping"
        ],
        "summary": "Cancel a shipment",
        "description": "Cancels the parcel at the courier, as the dashboard's **Cancel\nshipment** does. Only possible while the shipment is `pending`: the\ncourier hasn't picked it up. The order goes back to unsent (status\n`deleted`, no tracking code) and can be sent again.\n",
        "x-ordexs-scope": "shipping:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition",
          "courier_not_configured",
          "courier_rejected",
          "upstream_unavailable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/shipment_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The cancelled shipment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shipment"
                },
                "examples": {
                  "cancelled": {
                    "$ref": "#/components/examples/ShipmentCancelled"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/test_helpers/shipments/{shipment_id}/advance": {
      "post": {
        "operationId": "advanceTestShipment",
        "tags": [
          "Shipping"
        ],
        "summary": "Advance a test shipment",
        "description": "**Test keys only.** Moves a simulated shipment as a courier's report\nwould: to `in_transit`, `delivered` or `returned`. The order follows\nexactly as it does live (`delivered` sets the order delivered, and so\non), and the same `shipment.updated` and `order.status_changed`\nwebhooks are sent, so you can test your whole flow before going live.\n",
        "x-ordexs-scope": "shipping:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition",
          "forbidden"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/shipment_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "in_transit",
                      "delivered",
                      "returned"
                    ]
                  },
                  "stage": {
                    "$ref": "#/components/schemas/ShipmentStage"
                  },
                  "cod_status": {
                    "type": "string",
                    "enum": [
                      "delivered_unpaid",
                      "cash_collected",
                      "paid",
                      "archived"
                    ]
                  },
                  "return_status": {
                    "type": "string",
                    "enum": [
                      "suspended",
                      "return_ready",
                      "returned_in"
                    ]
                  }
                }
              },
              "examples": {
                "delivered": {
                  "value": {
                    "status": "delivered",
                    "cod_status": "cash_collected"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The shipment after the move.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shipment"
                },
                "examples": {
                  "shipment": {
                    "$ref": "#/components/examples/Shipment"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/inventory": {
      "get": {
        "operationId": "listInventory",
        "tags": [
          "Inventory"
        ],
        "summary": "List inventory levels",
        "description": "The Inventory page as a list: one level per variant of every product\nthat isn't archived, with what is available, committed to orders,\nincoming, held by the courier, sold in the last 30 days and how many\ndays of stock that leaves.\n",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "filter",
            "in": "query",
            "description": "low (at or under the alert level), out (none left), untracked, reorder (runs out within the reorder window), courier (some held by the courier), incoming (a delivery on its way).",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "low",
                "out",
                "untracked",
                "reorder",
                "courier",
                "incoming"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Matches the product title, SKU, barcode or option values.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "name (A to Z, the default), runway (fewest days of stock first) or newest (newest products first).",
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "runway",
                "newest"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of inventory levels.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventoryLevelList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/inventory/{variant_id}": {
      "get": {
        "operationId": "getInventoryLevel",
        "tags": [
          "Inventory"
        ],
        "summary": "Retrieve an inventory level",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/variant_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The variant's stock picture.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventoryLevel"
                },
                "examples": {
                  "level": {
                    "$ref": "#/components/examples/InventoryLevel"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/inventory/adjustments": {
      "post": {
        "operationId": "adjustInventory",
        "tags": [
          "Inventory"
        ],
        "summary": "Adjust stock",
        "description": "Changes stock for one or more variants (up to 100) with a reason, all\nor nothing, exactly like an adjustment on the Inventory page. Each line\neither adds or removes units (`delta`) or sets the count (`set`).\nEvery change is written to the stock history with your API key as its\nauthor, and `inventory.updated` webhooks follow.\n",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InventoryAdjustment"
              },
              "examples": {
                "restock": {
                  "value": {
                    "reason": "restock",
                    "note": "Supplier delivery #118",
                    "lines": [
                      {
                        "variant_id": "var_2f0e1d3c4b5a49688776655443322110",
                        "delta": 24
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new levels of the variants you changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventoryLevelList"
                },
                "examples": {
                  "levels": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/inventory_movements": {
      "get": {
        "operationId": "listInventoryMovements",
        "tags": [
          "Inventory"
        ],
        "summary": "List stock movements",
        "description": "The stock history: every change to every variant's stock, with why\n(a sale, a restock, a cancelled or returned order, a correction…) and\nwho made it. Newest first. With `created_since`, oldest first, so a\nsync can keep its place.\n",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "variant_id",
            "in": "query",
            "description": "Only this variant's movements.",
            "schema": {
              "type": "string",
              "pattern": "^var_[0-9a-f]{32}$"
            }
          },
          {
            "name": "reason",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/InventoryReason"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of movements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventoryMovementList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/inventory_settings": {
      "get": {
        "operationId": "getInventorySettings",
        "tags": [
          "Inventory"
        ],
        "summary": "Retrieve inventory settings",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventorySettings"
                },
                "examples": {
                  "settings": {
                    "value": {
                      "object": "inventory_settings",
                      "low_stock_threshold": 5,
                      "reorder_days": 14
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateInventorySettings",
        "tags": [
          "Inventory"
        ],
        "summary": "Update inventory settings",
        "description": "Sets the low-stock alert level (0 to 100000), the level at which the merchant is told a variant is running low.",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "low_stock_threshold": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000
                  }
                }
              },
              "examples": {
                "five": {
                  "value": {
                    "low_stock_threshold": 5
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventorySettings"
                },
                "examples": {
                  "settings": {
                    "value": {
                      "object": "inventory_settings",
                      "low_stock_threshold": 5,
                      "reorder_days": 14
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/variants/{variant_id}/receive_incoming": {
      "post": {
        "operationId": "receiveIncoming",
        "tags": [
          "Inventory"
        ],
        "summary": "Receive an incoming delivery",
        "description": "The delivery set on the variant (`incoming`) has arrived: its units\nmove into stock as a restock, and `incoming` returns to 0. Units\nalready promised to pre-orders are covered first, as in the dashboard.\n",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/variant_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The variant's new stock picture.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InventoryLevel"
                },
                "examples": {
                  "level": {
                    "$ref": "#/components/examples/InventoryLevel"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stock_counts": {
      "get": {
        "operationId": "listStockCounts",
        "tags": [
          "Inventory"
        ],
        "summary": "List stock counts",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "applied",
                "discarded"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of stock counts, newest first (without their lines).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockCountList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createStockCount",
        "tags": [
          "Inventory"
        ],
        "summary": "Start a stock count",
        "description": "Opens a count sheet, like **Count stock** on the Inventory page: one\nline per tracked variant (or those matching `filter` and `search`),\neach with the quantity Ordexs expects. Fill it with\nPOST /v1/stock_counts/{id}/lines, then apply or discard it.\n",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "filter": {
                    "type": "string",
                    "enum": [
                      "all",
                      "low",
                      "out",
                      "reorder",
                      "courier",
                      "incoming"
                    ]
                  },
                  "search": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                }
              },
              "examples": {
                "shelf_a": {
                  "value": {
                    "name": "Shelf A, October",
                    "filter": "all"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new count sheet with the first page of its lines.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockCount"
                },
                "examples": {
                  "count": {
                    "$ref": "#/components/examples/StockCount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stock_counts/{stock_count_id}": {
      "get": {
        "operationId": "getStockCount",
        "tags": [
          "Inventory"
        ],
        "summary": "Retrieve a stock count",
        "description": "The sheet and a page of its lines, in variant id order. Pass the last line's `variant_id` as `lines_after` for the next page.",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/stock_count_id"
          },
          {
            "name": "lines_after",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^var_[0-9a-f]{32}$"
            }
          },
          {
            "name": "lines_limit",
            "in": "query",
            "description": "Lines per page, 1 to 500. Default 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The count sheet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockCount"
                },
                "examples": {
                  "count": {
                    "$ref": "#/components/examples/StockCount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stock_counts/{stock_count_id}/lines": {
      "post": {
        "operationId": "setStockCountLines",
        "tags": [
          "Inventory"
        ],
        "summary": "Record counted quantities",
        "description": "Sets what was counted for up to 500 lines of an open sheet. Counting\nagain overwrites; `counted: null` clears a line. Nothing changes in\nstock until the count is applied.\n",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/stock_count_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "lines"
                ],
                "properties": {
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "variant_id",
                        "counted"
                      ],
                      "properties": {
                        "variant_id": {
                          "type": "string",
                          "pattern": "^var_[0-9a-f]{32}$"
                        },
                        "counted": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 1000000
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "counted": {
                  "value": {
                    "lines": [
                      {
                        "variant_id": "var_2f0e1d3c4b5a49688776655443322110",
                        "counted": 17
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The count sheet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockCount"
                },
                "examples": {
                  "count": {
                    "$ref": "#/components/examples/StockCount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stock_counts/{stock_count_id}/apply": {
      "post": {
        "operationId": "applyStockCount",
        "tags": [
          "Inventory"
        ],
        "summary": "Apply a stock count",
        "description": "Every counted line becomes the variant's stock, written to the stock\nhistory as a correction. Lines nobody counted are left alone. The\nsheet is then closed for good.\n",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/stock_count_id"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              },
              "examples": {
                "noted": {
                  "value": {
                    "note": "October count"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The applied sheet, with how many variants and units changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockCount"
                },
                "examples": {
                  "count": {
                    "$ref": "#/components/examples/StockCount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/stock_counts/{stock_count_id}/discard": {
      "post": {
        "operationId": "discardStockCount",
        "tags": [
          "Inventory"
        ],
        "summary": "Discard a stock count",
        "description": "Closes an open sheet without changing any stock.",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/stock_count_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The discarded sheet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockCount"
                },
                "examples": {
                  "count": {
                    "$ref": "#/components/examples/StockCount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/team_members": {
      "get": {
        "operationId": "listTeamMembers",
        "tags": [
          "Orders"
        ],
        "summary": "List team members",
        "description": "The store's active team, to pick who an order is assigned to. Read-only; the team itself is managed in the dashboard.",
        "x-ordexs-scope": "orders:assign",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamMemberList"
                },
                "examples": {
                  "team": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "id": "mem_0a1b2c3d4e5f40718293a4b5c6d7e8f9",
                          "object": "team_member",
                          "name": "Samira",
                          "role": "agent",
                          "can_be_assigned": true,
                          "last_seen_at": "2026-10-12T09:58:00Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/assign": {
      "post": {
        "operationId": "assignOrders",
        "tags": [
          "Orders"
        ],
        "summary": "Assign orders",
        "description": "Gives up to 100 orders to a teammate (`member_id`), or takes them back\n(`member_id: null`), like Assign on the Orders page. The teammate must be\nable to see and edit the Orders page. Each order's history records it.\n",
        "x-ordexs-scope": "orders:assign",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "order_ids",
                  "member_id"
                ],
                "properties": {
                  "order_ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^ord_[0-9a-f]{32}$"
                    }
                  },
                  "member_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^mem_[0-9a-f]{32}$"
                  }
                }
              },
              "examples": {
                "assign": {
                  "value": {
                    "order_ids": [
                      "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e"
                    ],
                    "member_id": "mem_0a1b2c3d4e5f40718293a4b5c6d7e8f9"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The orders, as they are now. `changed` counts the ones that moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderBulkResult"
                },
                "examples": {
                  "result": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "changed": 1,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/archive": {
      "post": {
        "operationId": "archiveOrders",
        "tags": [
          "Orders"
        ],
        "summary": "Archive orders",
        "description": "Archives up to 100 orders (or brings them back with `archived false`), like Archive on the Orders page. Archived orders leave the working lists and stay readable.",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "order_ids"
                ],
                "properties": {
                  "order_ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^ord_[0-9a-f]{32}$"
                    }
                  },
                  "archived": {
                    "type": "boolean",
                    "default": true
                  }
                }
              },
              "examples": {
                "archive": {
                  "value": {
                    "order_ids": [
                      "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The orders, as they are now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderBulkResult"
                },
                "examples": {
                  "result": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "changed": 1,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/contacts": {
      "get": {
        "operationId": "listOrderContacts",
        "tags": [
          "Orders"
        ],
        "summary": "List contacts with the customer",
        "description": "The calls, SMS and WhatsApp messages the team logged on this order, newest first, with each call's outcome.",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact log.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactList"
                },
                "examples": {
                  "log": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createOrderContact",
        "tags": [
          "Orders"
        ],
        "summary": "Log a contact",
        "description": "Records that the customer was called, texted or messaged on WhatsApp,\nlike the order card's call buttons, and optionally how the call went.\nIt doesn't place the call: it writes it down for the team.\n",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "channel"
                ],
                "properties": {
                  "channel": {
                    "type": "string",
                    "enum": [
                      "call",
                      "sms",
                      "whatsapp"
                    ]
                  },
                  "outcome": {
                    "$ref": "#/components/schemas/ContactOutcome"
                  },
                  "duration_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 86400,
                    "description": "For an answered call."
                  }
                }
              },
              "examples": {
                "no_answer": {
                  "value": {
                    "channel": "call",
                    "outcome": "no_answer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The logged contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "examples": {
                  "contact": {
                    "value": {
                      "id": "con_7e8f9a0b1c2d43e4f5a6b7c8d9e0f1a2",
                      "object": "contact",
                      "order_id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
                      "channel": "call",
                      "outcome": "no_answer",
                      "duration_seconds": null,
                      "actor": {
                        "type": "api_key",
                        "name": "API key \"Call center\""
                      },
                      "created_at": "2026-10-12T10:02:00Z",
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/contacts/{contact_id}": {
      "patch": {
        "operationId": "updateOrderContact",
        "tags": [
          "Orders"
        ],
        "summary": "Record a call's outcome",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          },
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^con_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "outcome"
                ],
                "properties": {
                  "outcome": {
                    "$ref": "#/components/schemas/ContactOutcome"
                  },
                  "duration_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 86400
                  }
                }
              },
              "examples": {
                "answered": {
                  "value": {
                    "outcome": "answered",
                    "duration_seconds": 74
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The contact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "examples": {
                  "contact": {
                    "value": {
                      "id": "con_7e8f9a0b1c2d43e4f5a6b7c8d9e0f1a2",
                      "object": "contact",
                      "order_id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
                      "channel": "call",
                      "outcome": "answered",
                      "duration_seconds": 74,
                      "actor": {
                        "type": "api_key",
                        "name": "API key \"Call center\""
                      },
                      "created_at": "2026-10-12T10:02:00Z",
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/notes/{note_id}": {
      "delete": {
        "operationId": "deleteOrderNote",
        "tags": [
          "Orders"
        ],
        "summary": "Delete a note",
        "description": "Deletes a note this API key wrote. In the dashboard, only a note's author (or the store owner) can delete it; for a key, its own notes.",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "forbidden"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          },
          {
            "name": "note_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^note_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "note_0f8b2a9c4d5e4f60a1b2c3d4e5f60718",
                      "object": "note",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/shipments/{shipment_id}/pack": {
      "post": {
        "operationId": "packShipment",
        "tags": [
          "Shipping"
        ],
        "summary": "Mark a parcel packed",
        "description": "The parcel is packed and waiting for the courier, like scanning it on the\ndispatch screen. Only while the courier hasn't picked it up.\n",
        "x-ordexs-scope": "shipping:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/shipment_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The shipment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shipment"
                },
                "examples": {
                  "shipment": {
                    "$ref": "#/components/examples/Shipment"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/shipments/{shipment_id}/validate": {
      "post": {
        "operationId": "validateShipment",
        "tags": [
          "Shipping"
        ],
        "summary": "Validate a parcel with the courier",
        "description": "Tells the courier the parcel is ready, for couriers that need this step\nbefore pickup (the order card's Validate). Couriers without it answer\nrequest_rejected. A test shipment is validated without a courier.\n",
        "x-ordexs-scope": "shipping:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition",
          "courier_not_configured",
          "courier_rejected",
          "request_rejected",
          "upstream_unavailable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/shipment_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The shipment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shipment"
                },
                "examples": {
                  "shipment": {
                    "$ref": "#/components/examples/Shipment"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/shipments/{shipment_id}/refresh": {
      "post": {
        "operationId": "refreshShipment",
        "tags": [
          "Shipping"
        ],
        "summary": "Refresh a parcel's status now",
        "description": "Asks the courier for the parcel's status now instead of waiting for\nOrdexs's next scheduled check, like the order card's refresh button. The\nsame plan-based cool-down applies: too soon after the last check you get\nrate_limited with the seconds to wait. The order follows any change.\n",
        "x-ordexs-scope": "shipping:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition",
          "courier_not_configured",
          "courier_rejected",
          "request_rejected",
          "upstream_unavailable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/shipment_id"
          }
        ],
        "responses": {
          "200": {
            "description": "The shipment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shipment"
                },
                "examples": {
                  "shipment": {
                    "$ref": "#/components/examples/Shipment"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order_id}/tracking": {
      "post": {
        "operationId": "setOrderTracking",
        "tags": [
          "Shipping"
        ],
        "summary": "Set a tracking number by hand",
        "description": "Records the tracking number of a parcel sent outside Ordexs (a courier the\nstore doesn't send to through Ordexs), like typing it on the order card.\nnull clears it. It doesn't create a shipment at a courier.\n",
        "x-ordexs-scope": "shipping:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/order_id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "tracking_code"
                ],
                "properties": {
                  "tracking_code": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 100
                  }
                }
              },
              "examples": {
                "code": {
                  "value": {
                    "tracking_code": "EC-4471-2026"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/abandoned_checkouts": {
      "get": {
        "operationId": "listAbandonedCheckouts",
        "tags": [
          "Abandoned checkouts"
        ],
        "summary": "List abandoned checkouts",
        "description": "Shoppers who left their details at checkout without ordering (the\nAbandoned page). Newest first; with updated_since, oldest change first.\n",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/updated_since"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "confirmed",
                "recovered",
                "deleted"
              ]
            }
          },
          {
            "name": "phone",
            "in": "query",
            "description": "The shopper's phone, E.164 or national.",
            "schema": {
              "type": "string",
              "minLength": 6,
              "maxLength": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of abandoned checkouts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AbandonedCheckoutList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/abandoned_checkouts/assign": {
      "post": {
        "operationId": "assignAbandonedCheckouts",
        "tags": [
          "Abandoned checkouts"
        ],
        "summary": "Assign abandoned checkouts",
        "description": "Gives up to 100 open abandoned checkouts to a teammate to call back, or takes them back (member_id null).",
        "x-ordexs-scope": "orders:assign",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "checkout_ids",
                  "member_id"
                ],
                "properties": {
                  "checkout_ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^chk_[0-9a-f]{32}$"
                    }
                  },
                  "member_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^mem_[0-9a-f]{32}$"
                  }
                }
              },
              "examples": {
                "assign": {
                  "value": {
                    "checkout_ids": [
                      "chk_1f2e3d4c5b6a47980a1b2c3d4e5f6a7b"
                    ],
                    "member_id": "mem_0a1b2c3d4e5f40718293a4b5c6d7e8f9"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The checkouts, as they are now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AbandonedCheckoutList"
                },
                "examples": {
                  "result": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/abandoned_checkouts/{checkout_id}": {
      "get": {
        "operationId": "getAbandonedCheckout",
        "tags": [
          "Abandoned checkouts"
        ],
        "summary": "Retrieve an abandoned checkout",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "checkout_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^chk_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The abandoned checkout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AbandonedCheckout"
                },
                "examples": {
                  "checkout": {
                    "$ref": "#/components/examples/AbandonedCheckout"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateAbandonedCheckout",
        "tags": [
          "Abandoned checkouts"
        ],
        "summary": "Update an abandoned checkout",
        "description": "Fixes the shopper's contact or address before confirming, like editing it on the Abandoned page. Same phone and address rules as an order.",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "name": "checkout_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^chk_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "customer": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      "phone": {
                        "type": "string",
                        "minLength": 6,
                        "maxLength": 20
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "email",
                        "maxLength": 160
                      }
                    }
                  },
                  "shipping_address": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "region": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 10
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      "address1": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    }
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000
                  }
                }
              },
              "examples": {
                "address": {
                  "value": {
                    "shipping_address": {
                      "region": "16",
                      "city": "Bab El Oued",
                      "address1": "12 rue Ali Boumendjel"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The abandoned checkout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AbandonedCheckout"
                },
                "examples": {
                  "checkout": {
                    "$ref": "#/components/examples/AbandonedCheckout"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteAbandonedCheckout",
        "tags": [
          "Abandoned checkouts"
        ],
        "summary": "Delete an abandoned checkout",
        "description": "Removes it from the Abandoned page (it is kept as deleted, not erased).",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "name": "checkout_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^chk_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "chk_1f2e3d4c5b6a47980a1b2c3d4e5f6a7b",
                      "object": "abandoned_checkout",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/abandoned_checkouts/{checkout_id}/confirm": {
      "post": {
        "operationId": "confirmAbandonedCheckout",
        "tags": [
          "Abandoned checkouts"
        ],
        "summary": "Confirm an abandoned checkout",
        "description": "The shopper said yes: the checkout becomes an order, with its cart, its\ndelivery choice and its marketing source, like Confirm on the Abandoned\npage. The answer is the new order. status sets where it lands\n(confirmed by default).\n",
        "x-ordexs-scope": "orders:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition",
          "request_rejected"
        ],
        "parameters": [
          {
            "name": "checkout_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^chk_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "confirmed",
                      "scheduled",
                      "attempt_1",
                      "attempt_2",
                      "attempt_3",
                      "double",
                      "waiting",
                      "cancelled"
                    ],
                    "default": "confirmed"
                  }
                }
              },
              "examples": {
                "confirmed": {
                  "value": {
                    "status": "confirmed"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "order": {
                    "$ref": "#/components/examples/Order"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/customer_segments": {
      "get": {
        "operationId": "listCustomerSegments",
        "tags": [
          "Customers"
        ],
        "summary": "List customer segments",
        "description": "The segments saved on the Customers page (reliable buyers, lapsed customers, a wilaya…), each with how many customers it holds now.",
        "x-ordexs-scope": "customers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The segments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSegmentList"
                },
                "examples": {
                  "segments": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "id": "seg_5a6b7c8d9e0f41a2b3c4d5e6f7a8b9c0",
                          "object": "customer_segment",
                          "name": "Reliable buyers",
                          "description": null,
                          "customer_count": 214,
                          "created_at": "2026-09-02T10:00:00Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/customer_segments/{segment_id}/customers": {
      "get": {
        "operationId": "listSegmentCustomers",
        "tags": [
          "Customers"
        ],
        "summary": "List a segment's customers",
        "description": "The customers in a segment right now (a segment is a saved filter, so it changes as customers do). In id order.",
        "x-ordexs-scope": "customers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "name": "segment_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^seg_[0-9a-f]{32}$"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of customers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/collections": {
      "get": {
        "operationId": "listCollections",
        "tags": [
          "Collections"
        ],
        "summary": "List collections",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/updated_since"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "draft"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "smart"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of collections.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createCollection",
        "tags": [
          "Collections"
        ],
        "summary": "Create a collection",
        "description": "A hand-picked collection (kind manual, with product_ids) or an automated\none (kind smart, with rules: products join and leave as they match),\nlike New collection on the Collections page. The handle is made from\nthe title when left out.\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionWrite"
              },
              "examples": {
                "smart": {
                  "value": {
                    "title": "Summer sale",
                    "kind": "smart",
                    "rules": [
                      {
                        "field": "tag",
                        "op": "eq",
                        "value": "summer"
                      },
                      {
                        "field": "compare_at_price",
                        "op": "is_set"
                      }
                    ],
                    "rules_match": "all"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                },
                "examples": {
                  "collection": {
                    "$ref": "#/components/examples/Collection"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/collections/reorder": {
      "post": {
        "operationId": "reorderCollections",
        "tags": [
          "Collections"
        ],
        "summary": "Reorder collections",
        "description": "Sets the order collections appear in (menus, the storefront's collection list), like dragging them on the page. Pass every collection id, first to last.",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "collection_ids"
                ],
                "properties": {
                  "collection_ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^col_[0-9a-f]{32}$"
                    }
                  }
                }
              },
              "examples": {
                "order": {
                  "value": {
                    "collection_ids": [
                      "col_1a2b3c4d5e6f47a8b9c0d1e2f3a4b5c6"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every collection, in the new order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/collections/preview": {
      "post": {
        "operationId": "previewCollection",
        "tags": [
          "Collections"
        ],
        "summary": "Preview automated conditions",
        "description": "How many products a set of conditions matches, and the first 12 of them, without saving anything.",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "rules"
                ],
                "properties": {
                  "rules": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 30,
                    "items": {
                      "$ref": "#/components/schemas/CollectionRule"
                    }
                  },
                  "rules_match": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ],
                    "default": "all"
                  }
                }
              },
              "examples": {
                "cheap": {
                  "value": {
                    "rules": [
                      {
                        "field": "price",
                        "op": "lt",
                        "value": "2000"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The match.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionPreview"
                },
                "examples": {
                  "preview": {
                    "value": {
                      "object": "collection_preview",
                      "match_count": 14,
                      "sample": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/collections/{collection_id}": {
      "get": {
        "operationId": "getCollection",
        "tags": [
          "Collections"
        ],
        "summary": "Retrieve a collection",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "collection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^col_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                },
                "examples": {
                  "collection": {
                    "$ref": "#/components/examples/Collection"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateCollection",
        "tags": [
          "Collections"
        ],
        "summary": "Update a collection",
        "description": "Send only what changes. product_ids replaces a hand-picked collection's products, in that order (up to 2000).",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "name": "collection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^col_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionWrite"
              },
              "examples": {
                "draft": {
                  "value": {
                    "status": "draft"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                },
                "examples": {
                  "collection": {
                    "$ref": "#/components/examples/Collection"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteCollection",
        "tags": [
          "Collections"
        ],
        "summary": "Delete a collection",
        "description": "Deletes the collection. Its products stay; they just leave it.",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "collection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^col_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "col_1a2b3c4d5e6f47a8b9c0d1e2f3a4b5c6",
                      "object": "collection",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/collections/{collection_id}/duplicate": {
      "post": {
        "operationId": "duplicateCollection",
        "tags": [
          "Collections"
        ],
        "summary": "Duplicate a collection",
        "description": "A draft copy with the same products or conditions.",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "request_rejected"
        ],
        "parameters": [
          {
            "name": "collection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^col_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                },
                "examples": {
                  "collection": {
                    "$ref": "#/components/examples/Collection"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/collections/{collection_id}/products": {
      "get": {
        "operationId": "listCollectionProducts",
        "tags": [
          "Collections"
        ],
        "summary": "List a collection's products",
        "description": "The products, in the collection's own order.",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "name": "collection_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^col_[0-9a-f]{32}$"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductList"
                },
                "examples": {
                  "page": {
                    "$ref": "#/components/examples/ProductList"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/categories": {
      "get": {
        "operationId": "listCategories",
        "tags": [
          "Collections"
        ],
        "summary": "List categories",
        "description": "The categories the store's products use (a product's category field), with how many products each has. Archived products don't count.",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The categories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryList"
                },
                "examples": {
                  "categories": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "category",
                          "name": "Shirts",
                          "product_count": 12
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/reviews": {
      "get": {
        "operationId": "listReviews",
        "tags": [
          "Reviews"
        ],
        "summary": "List reviews",
        "description": "Product reviews, newest first. Pending ones wait for the merchant to publish them (unless the store publishes automatically).",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "published",
                "hidden"
              ]
            }
          },
          {
            "name": "product_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of reviews.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createReview",
        "tags": [
          "Reviews"
        ],
        "summary": "Add a review",
        "description": "Adds a review as the merchant (source merchant), like Add review on the Reviews page; for reviews collected elsewhere.",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product_id",
                  "rating",
                  "body",
                  "author_name"
                ],
                "properties": {
                  "product_id": {
                    "type": "string",
                    "pattern": "^prod_[0-9a-f]{32}$"
                  },
                  "rating": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "author_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "published",
                      "hidden"
                    ],
                    "default": "published"
                  }
                }
              },
              "examples": {
                "five": {
                  "value": {
                    "product_id": "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
                    "rating": 5,
                    "body": "Great quality, fast delivery.",
                    "author_name": "Samira"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Review"
                },
                "examples": {
                  "review": {
                    "$ref": "#/components/examples/Review"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/reviews/{review_id}": {
      "patch": {
        "operationId": "updateReview",
        "tags": [
          "Reviews"
        ],
        "summary": "Publish or hide a review",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "name": "review_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^rev_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "published",
                      "hidden"
                    ]
                  }
                }
              },
              "examples": {
                "publish": {
                  "value": {
                    "status": "published"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Review"
                },
                "examples": {
                  "review": {
                    "$ref": "#/components/examples/Review"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteReview",
        "tags": [
          "Reviews"
        ],
        "summary": "Delete a review",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "review_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^rev_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "rev_4d5e6f7a8b9c40d1e2f3a4b5c6d7e8f9",
                      "object": "review",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/review_settings": {
      "get": {
        "operationId": "getReviewSettings",
        "tags": [
          "Reviews"
        ],
        "summary": "Retrieve review settings",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewSettings"
                },
                "examples": {
                  "settings": {
                    "value": {
                      "object": "review_settings",
                      "auto_publish": false
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateReviewSettings",
        "tags": [
          "Reviews"
        ],
        "summary": "Update review settings",
        "description": "auto_publish true publishes customers' reviews as they arrive; false keeps them pending for the merchant.",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "auto_publish"
                ],
                "properties": {
                  "auto_publish": {
                    "type": "boolean"
                  }
                }
              },
              "examples": {
                "on": {
                  "value": {
                    "auto_publish": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewSettings"
                },
                "examples": {
                  "settings": {
                    "value": {
                      "object": "review_settings",
                      "auto_publish": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/offers": {
      "get": {
        "operationId": "listOffers",
        "tags": [
          "Offers"
        ],
        "summary": "List offers",
        "description": "Bundles, upsells (quantity packs) and cross-sells, newest first. A store has at most 30.",
        "x-ordexs-scope": "offers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bundle",
                "upsell",
                "cross_sell"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "paused"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of offers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfferList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createOffer",
        "tags": [
          "Offers"
        ],
        "summary": "Create an offer",
        "description": "Like New offer on the Offers page. What an offer needs depends on its type:\n- **bundle**: `product_ids` (2 or more, bought together) and usually a `discount`;\n- **upsell**: one product in `product_ids` and its packs in `tiers` (1 to 6);\n- **cross_sell**: `cross_sell` (what arms it and what it suggests), optionally a `discount` on the add-on.\nA store has at most 30 offers (`quota_exceeded`).\n",
        "x-ordexs-scope": "offers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "quota_exceeded"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OfferWrite"
              },
              "examples": {
                "bundle": {
                  "value": {
                    "type": "bundle",
                    "name": "Morning set",
                    "product_ids": [
                      "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
                      "prod_1b2c3d4e5f6a47b8c9d0e1f2a3b4c5d6"
                    ],
                    "discount": {
                      "type": "percent",
                      "value": "15"
                    }
                  }
                },
                "upsell": {
                  "value": {
                    "type": "upsell",
                    "name": "Buy more",
                    "save more": null,
                    "product_ids": [
                      "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21"
                    ],
                    "tiers": [
                      {
                        "quantity": 1
                      },
                      {
                        "quantity": 2,
                        "discount": {
                          "type": "percent",
                          "value": "10"
                        },
                        "badge": "POPULAR"
                      },
                      {
                        "quantity": 3,
                        "discount": {
                          "type": "fixed",
                          "value": "1000.00"
                        },
                        "free_shipping": true
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new offer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Offer"
                },
                "examples": {
                  "offer": {
                    "$ref": "#/components/examples/Offer"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/offers/{offer_id}": {
      "get": {
        "operationId": "getOffer",
        "tags": [
          "Offers"
        ],
        "summary": "Retrieve an offer",
        "x-ordexs-scope": "offers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "offer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ofr_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The offer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Offer"
                },
                "examples": {
                  "offer": {
                    "$ref": "#/components/examples/Offer"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateOffer",
        "tags": [
          "Offers"
        ],
        "summary": "Update an offer",
        "description": "Send only what changes. Lists (product_ids, tiers, the cross_sell id lists) replace the current ones. The type can't change. Pause with status paused.",
        "x-ordexs-scope": "offers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "name": "offer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ofr_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OfferWrite"
              },
              "examples": {
                "pause": {
                  "value": {
                    "status": "paused"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The offer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Offer"
                },
                "examples": {
                  "offer": {
                    "$ref": "#/components/examples/Offer"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteOffer",
        "tags": [
          "Offers"
        ],
        "summary": "Delete an offer",
        "description": "Orders it was already applied to keep their prices.",
        "x-ordexs-scope": "offers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "offer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ofr_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "ofr_2b3c4d5e6f7a48b9c0d1e2f3a4b5c6d7",
                      "object": "offer",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/offers/{offer_id}/performance": {
      "get": {
        "operationId": "getOfferPerformance",
        "tags": [
          "Offers"
        ],
        "summary": "Retrieve an offer's results",
        "description": "The orders the offer was applied to, their revenue and the discount it gave, as the Offers page shows. Cancelled and returned orders don't count.",
        "x-ordexs-scope": "offers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "offer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ofr_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfferPerformance"
                },
                "examples": {
                  "results": {
                    "value": {
                      "object": "offer_performance",
                      "offer_id": "ofr_2b3c4d5e6f7a48b9c0d1e2f3a4b5c6d7",
                      "orders_count": 42,
                      "revenue": {
                        "amount": "210000.00",
                        "currency": "DZD"
                      },
                      "discount_given": {
                        "amount": "18500.00",
                        "currency": "DZD"
                      },
                      "last_order_at": "2026-10-12T08:41:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/discounts": {
      "get": {
        "operationId": "listDiscounts",
        "tags": [
          "Offers"
        ],
        "summary": "List discounts",
        "description": "Discount codes and automatic discounts, newest first. A store has at most 50. Look one code up with `code`.",
        "x-ordexs-scope": "offers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "paused"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "code",
                "automatic"
              ]
            }
          },
          {
            "name": "code",
            "in": "query",
            "description": "Exactly this code (letter case ignored).",
            "schema": {
              "type": "string",
              "maxLength": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of discounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createDiscount",
        "tags": [
          "Offers"
        ],
        "summary": "Create a discount",
        "description": "With a `code`, shoppers type it at checkout. Without one, it is an automatic\ndiscount the store applies by itself. Like the Discounts page.\n",
        "x-ordexs-scope": "offers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "duplicate_discount_code",
          "quota_exceeded"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountWrite"
              },
              "examples": {
                "code": {
                  "value": {
                    "name": "Ramadan",
                    "code": "RAMADAN10",
                    "discount": {
                      "type": "percent",
                      "value": "10"
                    },
                    "usage_limit": 500,
                    "per_customer_limit": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new discount.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Discount"
                },
                "examples": {
                  "discount": {
                    "$ref": "#/components/examples/Discount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/discounts/preview": {
      "post": {
        "operationId": "previewDiscount",
        "tags": [
          "Offers"
        ],
        "summary": "Check a discount code",
        "description": "Whether a code works right now (active, started, not ended, not used up)\nand what it would take off these lines. A shopper's own per-customer\nlimit is checked only when the order is placed.\n",
        "x-ordexs-scope": "offers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20
                  },
                  "line_items": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "variant_id",
                        "quantity"
                      ],
                      "properties": {
                        "variant_id": {
                          "type": "string",
                          "pattern": "^var_[0-9a-f]{32}$"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "check": {
                  "value": {
                    "code": "ramadan10",
                    "line_items": [
                      {
                        "variant_id": "var_3c4d5e6f7a8b49c0d1e2f3a4b5c6d7e8",
                        "quantity": 2
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountPreview"
                },
                "examples": {
                  "valid": {
                    "value": {
                      "object": "discount_preview",
                      "code": "RAMADAN10",
                      "valid": true,
                      "discount_id": "dsc_5d6e7f8a9b0c41d2e3f4a5b6c7d8e9f0",
                      "name": "Ramadan",
                      "amount": {
                        "amount": "500.00",
                        "currency": "DZD"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/discounts/{discount_id}": {
      "get": {
        "operationId": "getDiscount",
        "tags": [
          "Offers"
        ],
        "summary": "Retrieve a discount",
        "x-ordexs-scope": "offers:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "discount_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^dsc_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The discount.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Discount"
                },
                "examples": {
                  "discount": {
                    "$ref": "#/components/examples/Discount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateDiscount",
        "tags": [
          "Offers"
        ],
        "summary": "Update a discount",
        "description": "Send only what changes. Pause with status paused. code null turns a code into an automatic discount.",
        "x-ordexs-scope": "offers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "duplicate_discount_code"
        ],
        "parameters": [
          {
            "name": "discount_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^dsc_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountWrite"
              },
              "examples": {
                "pause": {
                  "value": {
                    "status": "paused"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The discount.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Discount"
                },
                "examples": {
                  "discount": {
                    "$ref": "#/components/examples/Discount"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteDiscount",
        "tags": [
          "Offers"
        ],
        "summary": "Delete a discount",
        "description": "Orders it was already used on keep their prices.",
        "x-ordexs-scope": "offers:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "discount_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^dsc_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "dsc_5d6e7f8a9b0c41d2e3f4a5b6c7d8e9f0",
                      "object": "discount",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/returns": {
      "get": {
        "operationId": "listReturns",
        "tags": [
          "Returns"
        ],
        "summary": "List returns",
        "description": "The Returns queue: parcels on their way back (`in_transit`; `ready` once the\ncourier has it waiting to be picked up) and parcels back in hand\n(`received`), the items an exchange collected included. Checked-in\nreturns leave the list. At most 200 of each kind, newest first.\n",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "name": "stage",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "in_transit",
                "received"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "return",
                "exchange"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The queue.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "counts": {
                        "received": 1,
                        "in_transit": 3
                      },
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/returns/check_in": {
      "post": {
        "operationId": "checkInReturns",
        "tags": [
          "Returns"
        ],
        "summary": "Check returns in",
        "description": "Like checking a box in on the Returns window: each item goes back to stock\nor is written off with a reason. Without `lines`, every item still open goes\nback to stock (or, with `all_as: damaged`, is written off as damaged).\nStock moves only here, and it shows in the stock history under the key's\nname. All or nothing: if one return can't be checked in, none is.\n\nThen the couriers that want it (the Ecotrack family) are told the parcels\nreached you; `courier` reports their answers. A courier that doesn't answer\nnever undoes the check-in.\n",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "request_rejected"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "returns"
                ],
                "properties": {
                  "returns": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 200,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "order_id"
                      ],
                      "properties": {
                        "order_id": {
                          "type": "string",
                          "pattern": "^ord_[0-9a-f]{32}$"
                        },
                        "all_as": {
                          "type": "string",
                          "enum": [
                            "restock",
                            "damaged"
                          ],
                          "description": "Without lines",
                          "what happens to every open item. Default restock.": null
                        },
                        "lines": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 100,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^x?li_[0-9a-f]{32}$",
                                "description": "The item's id from the return."
                              },
                              "restock": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9999
                              },
                              "write_off": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9999
                              },
                              "reason": {
                                "type": "string",
                                "enum": [
                                  "damaged",
                                  "missing",
                                  "used",
                                  "wrong_item",
                                  "other"
                                ],
                                "description": "Required with write_off."
                              },
                              "note": {
                                "type": "string",
                                "maxLength": 500
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "mixed": {
                  "value": {
                    "returns": [
                      {
                        "order_id": "ord_9b8c7d6e5f4a43b2a1c0d9e8f7a6b5c4",
                        "lines": [
                          {
                            "id": "li_1a2b3c4d5e6f47a8b9c0d1e2f3a4b5c6",
                            "restock": 1,
                            "write_off": 1,
                            "reason": "damaged"
                          }
                        ]
                      },
                      {
                        "order_id": "ord_2c3d4e5f6a7b48c9d0e1f2a3b4c5d6e7"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What was checked in.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReturnCheckIn"
                },
                "examples": {
                  "done": {
                    "value": {
                      "object": "return_check_in",
                      "returns": 2,
                      "completed": 2,
                      "restocked": 3,
                      "written_off": 1,
                      "courier": {
                        "confirmed": 2,
                        "not_eligible": 0,
                        "not_found": 0,
                        "failed": 0,
                        "error": null
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/returns/{order_id}": {
      "get": {
        "operationId": "getReturn",
        "tags": [
          "Returns"
        ],
        "summary": "Retrieve a return",
        "description": "The order's return while it is in the queue. not_found once it is checked in.",
        "x-ordexs-scope": "inventory:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ord_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The return.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Return"
                },
                "examples": {
                  "return": {
                    "$ref": "#/components/examples/Return"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/returns/{order_id}/receive": {
      "post": {
        "operationId": "receiveReturn",
        "tags": [
          "Returns"
        ],
        "summary": "Mark a return as arrived",
        "description": "\"It arrived\": the parcel is back in your hands, for a courier that doesn't\nreport the hand-back itself. Stock doesn't move until the check-in.\n",
        "x-ordexs-scope": "inventory:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ord_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The return, now received.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Return"
                },
                "examples": {
                  "return": {
                    "$ref": "#/components/examples/Return"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/cod_balances": {
      "get": {
        "operationId": "listCodBalances",
        "tags": [
          "Money"
        ],
        "summary": "List cash-on-delivery balances",
        "description": "Per courier, like Your cash on the Overview: what it owes for delivered\norders it hasn't paid for yet (`outstanding`), and what its payouts brought\nagainst what they were expected to (`paid`). `courier` null is orders\ndelivered without a courier.\n",
        "x-ordexs-scope": "money:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The balances.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodBalanceList"
                },
                "examples": {
                  "balances": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "cod_balance",
                          "courier": "yalidine",
                          "outstanding": {
                            "orders_count": 37,
                            "amount": {
                              "amount": "158400.00",
                              "currency": "DZD"
                            }
                          },
                          "paid": {
                            "payouts_count": 4,
                            "received": {
                              "amount": "402100.00",
                              "currency": "DZD"
                            },
                            "expected": {
                              "amount": "403000.00",
                              "currency": "DZD"
                            },
                            "difference": {
                              "amount": "-900.00",
                              "currency": "DZD"
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/cod_orders": {
      "get": {
        "operationId": "listCodOrders",
        "tags": [
          "Money"
        ],
        "summary": "List orders awaiting payment",
        "description": "Delivered orders the courier hasn't paid for yet, oldest first.",
        "x-ordexs-scope": "money:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "courier",
            "in": "query",
            "description": "One courier (as in the balances), or none for orders delivered without one.",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodOrderList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "cod_order",
                          "order_id": "ord_9b8c7d6e5f4a43b2a1c0d9e8f7a6b5c4",
                          "order_number": "ORD-00042",
                          "courier": "yalidine",
                          "tracking_code": "YAL-58213",
                          "customer_name": "Samira B.",
                          "total": {
                            "amount": "4300.00",
                            "currency": "DZD"
                          },
                          "payout_id": null,
                          "created_at": "2026-10-08T10:12:00Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/payouts": {
      "get": {
        "operationId": "listPayouts",
        "tags": [
          "Money"
        ],
        "summary": "List payouts",
        "description": "The cash couriers handed over, newest first.",
        "x-ordexs-scope": "money:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of payouts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createPayout",
        "tags": [
          "Money"
        ],
        "summary": "Record a payout",
        "description": "Like Record payout on the Overview. The payout covers `order_ids`, or,\nwithout them, every delivered order of that courier not paid for yet.\n`expected` is their total; `difference` is what the courier kept or added.\n",
        "x-ordexs-scope": "money:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "amount_received"
                ],
                "properties": {
                  "courier": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 40,
                    "description": "The courier that paid",
                    "as in the balances. null or none for orders delivered without one.": null
                  },
                  "amount_received": {
                    "$ref": "#/components/schemas/MoneyString"
                  },
                  "payout_date": {
                    "type": "string",
                    "format": "date",
                    "description": "Default today."
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "The courier's payment reference."
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "order_ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 1000,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^ord_[0-9a-f]{32}$"
                    }
                  }
                }
              },
              "examples": {
                "all": {
                  "value": {
                    "courier": "yalidine",
                    "amount_received": "158400.00",
                    "reference": "VIR-2026-1012"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The payout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payout"
                },
                "examples": {
                  "payout": {
                    "$ref": "#/components/examples/Payout"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/payouts/{payout_id}": {
      "get": {
        "operationId": "getPayout",
        "tags": [
          "Money"
        ],
        "summary": "Retrieve a payout",
        "x-ordexs-scope": "money:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "payout_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pay_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The payout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payout"
                },
                "examples": {
                  "payout": {
                    "$ref": "#/components/examples/Payout"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deletePayout",
        "tags": [
          "Money"
        ],
        "summary": "Delete a payout",
        "description": "Its orders go back to awaiting payment.",
        "x-ordexs-scope": "money:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "payout_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pay_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "pay_6f7a8b9c0d1e42f3a4b5c6d7e8f9a0b1",
                      "object": "payout",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/payouts/{payout_id}/orders": {
      "get": {
        "operationId": "listPayoutOrders",
        "tags": [
          "Money"
        ],
        "summary": "List a payout's orders",
        "x-ordexs-scope": "money:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "name": "payout_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pay_[0-9a-f]{32}$"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of orders.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodOrderList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "object": "cod_order",
                          "order_id": "ord_9b8c7d6e5f4a43b2a1c0d9e8f7a6b5c4",
                          "order_number": "ORD-00042",
                          "courier": "yalidine",
                          "tracking_code": "YAL-58213",
                          "customer_name": "Samira B.",
                          "total": {
                            "amount": "4300.00",
                            "currency": "DZD"
                          },
                          "payout_id": null,
                          "created_at": "2026-10-08T10:12:00Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/uploads": {
      "post": {
        "operationId": "createUpload",
        "tags": [
          "Products"
        ],
        "summary": "Create an image upload slot",
        "description": "For a file you have rather than a public URL. PUT the image's bytes to\n`upload_url` (with the `headers` given, within 15 minutes), then pass\n`id` as `upload_id` to POST /v1/products/{product_id}/images. A slot that\nis never used is deleted after a day.\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "quota_exceeded",
          "upstream_unavailable"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "content_type",
                  "size"
                ],
                "properties": {
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "image/jpeg",
                      "image/png",
                      "image/webp",
                      "image/avif"
                    ]
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3145728,
                    "description": "Bytes. Images are 3 MB at most."
                  }
                }
              },
              "examples": {
                "jpeg": {
                  "value": {
                    "content_type": "image/jpeg",
                    "size": 845120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The slot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                },
                "examples": {
                  "slot": {
                    "value": {
                      "object": "upload",
                      "id": "upl_0a1b2c3d4e5f46a7b8c9d0e1f2a3b4c5",
                      "upload_url": "https://…r2.cloudflarestorage.com/…",
                      "method": "PUT",
                      "headers": {
                        "Content-Type": "image/jpeg"
                      },
                      "max_bytes": 3145728,
                      "expires_at": "2026-10-12T10:15:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/products/{product_id}/images": {
      "post": {
        "operationId": "addProductImage",
        "tags": [
          "Products"
        ],
        "summary": "Add a product image",
        "description": "One of `url` (a public image to import), `upload_id` (a file you PUT to a\nslot from POST /v1/uploads) or `media_id` (an image already in the store's\nmedia library). JPG, PNG, WebP or AVIF, 3 MB at most.\n\nOrdexs makes the sizes the storefront serves (WebP, 320 to 1920 px), adds\nthe file to the media library (it counts toward the store's storage) and\nputs the image on the product at `position` (0 is the main image; default\nlast). At most 50 images a product, and 500 images a store a day through\nthe API (`quota_exceeded`).\n",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "quota_exceeded",
          "upstream_unavailable"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2000
                  },
                  "upload_id": {
                    "type": "string",
                    "pattern": "^upl_[0-9a-f]{32}$"
                  },
                  "media_id": {
                    "type": "string",
                    "pattern": "^med_[0-9a-f]{32}$"
                  },
                  "alt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300,
                    "description": "Describes the image for screen readers and search engines."
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 49,
                    "description": "0 is the main image."
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "url"
                    ]
                  },
                  {
                    "required": [
                      "upload_id"
                    ]
                  },
                  {
                    "required": [
                      "media_id"
                    ]
                  }
                ]
              },
              "examples": {
                "url": {
                  "value": {
                    "url": "https://example.com/hoodie-black.jpg",
                    "alt": "Black oversized hoodie",
                    "position": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The image, on the product.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductImage"
                },
                "examples": {
                  "image": {
                    "$ref": "#/components/examples/ProductImage"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/products/{product_id}/images/{image_id}": {
      "patch": {
        "operationId": "updateProductImage",
        "tags": [
          "Products"
        ],
        "summary": "Update a product image",
        "description": "Change its alt text, or move it (position 0 is the main image).",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          },
          {
            "name": "image_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^img_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "alt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 300
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 49,
                    "description": "0 is the main image."
                  }
                }
              },
              "examples": {
                "main": {
                  "value": {
                    "position": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The image.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductImage"
                },
                "examples": {
                  "image": {
                    "$ref": "#/components/examples/ProductImage"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteProductImage",
        "tags": [
          "Products"
        ],
        "summary": "Remove a product image",
        "description": "Takes the image off the product. The file stays in the media library; a variant that showed it shows the product's images instead.",
        "x-ordexs-scope": "products:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          },
          {
            "name": "image_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^img_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "img_7a8b9c0d1e2f43a4b5c6d7e8f9a0b1c2",
                      "object": "product_image",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/media": {
      "get": {
        "operationId": "listMedia",
        "tags": [
          "Products"
        ],
        "summary": "List the media library",
        "description": "The store's files (images, videos, documents), newest first.",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video",
                "document"
              ]
            }
          },
          {
            "name": "in_use",
            "in": "query",
            "description": "Only files shown somewhere on the store (true), or unused ones (false).",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/media/{media_id}": {
      "get": {
        "operationId": "getMedia",
        "tags": [
          "Products"
        ],
        "summary": "Retrieve a media file",
        "x-ordexs-scope": "products:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "media_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^med_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Media"
                },
                "examples": {
                  "file": {
                    "value": {
                      "id": "med_1b2c3d4e5f6a47b8c9d0e1f2a3b4c5d6",
                      "object": "media",
                      "type": "image",
                      "mime_type": "image/webp",
                      "url": "https://cdn.ordexs.com/…-1920.webp",
                      "file_name": "hoodie-black.webp",
                      "alt": null,
                      "bytes": 412800,
                      "width": 1600,
                      "height": 1600,
                      "sizes": [
                        320,
                        640,
                        1024,
                        1920
                      ],
                      "duration_seconds": null,
                      "poster_url": null,
                      "in_use": true,
                      "created_at": "2026-10-12T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/couriers": {
      "get": {
        "operationId": "listCouriers",
        "tags": [
          "Delivery setup"
        ],
        "summary": "List courier accounts",
        "description": "The courier accounts connected to the store (connecting one, with its keys, is done in the dashboard). Use their ids in delivery settings, routing rules and when sending an order.",
        "x-ordexs-scope": "delivery:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CourierList"
                },
                "examples": {
                  "couriers": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "id": "cour_4e5f6a7b8c9d40e1f2a3b4c5d6e7f8a9",
                          "object": "courier",
                          "brand": "yalidine",
                          "account_name": "Main account",
                          "active": true,
                          "default": true,
                          "connection_ok": true,
                          "created_at": "2026-09-02T10:00:00Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/delivery/settings": {
      "get": {
        "operationId": "getDeliverySettings",
        "tags": [
          "Delivery setup"
        ],
        "summary": "Retrieve delivery settings",
        "x-ordexs-scope": "delivery:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliverySettings"
                },
                "examples": {
                  "settings": {
                    "value": {
                      "object": "delivery_settings",
                      "enabled": true,
                      "strategy": "flat",
                      "modes": {
                        "home": true,
                        "pickup_point": true
                      },
                      "labels": {
                        "home": "Door delivery",
                        "pickup_point": "Stop desk"
                      },
                      "courier_ids": [],
                      "fallback_to_flat_prices": true,
                      "default_courier_id": "cour_4e5f6a7b8c9d40e1f2a3b4c5d6e7f8a9"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateDeliverySettings",
        "tags": [
          "Delivery setup"
        ],
        "summary": "Update delivery settings",
        "description": "Like the Delivery page. `strategy` decides who prices and who ships:\n- **flat**: the store's own prices per region (`/v1/delivery/prices`); the\n  routing rules, then the default courier, choose the courier;\n- **customer_choice**: live rates of `courier_ids`; the shopper picks the courier;\n- **cheapest**: live rates of `courier_ids`; the cheapest is shown and ships.\nCourier rates need at least one courier in `courier_ids`.\n",
        "x-ordexs-scope": "delivery:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliverySettingsUpdate"
              },
              "examples": {
                "flat": {
                  "value": {
                    "strategy": "flat",
                    "modes": {
                      "home": true,
                      "pickup_point": false
                    },
                    "default_courier_id": "cour_4e5f6a7b8c9d40e1f2a3b4c5d6e7f8a9"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliverySettings"
                },
                "examples": {
                  "settings": {
                    "value": {
                      "object": "delivery_settings",
                      "enabled": true,
                      "strategy": "flat",
                      "modes": {
                        "home": true,
                        "pickup_point": true
                      },
                      "labels": {
                        "home": "Door delivery",
                        "pickup_point": "Stop desk"
                      },
                      "courier_ids": [],
                      "fallback_to_flat_prices": true,
                      "default_courier_id": "cour_4e5f6a7b8c9d40e1f2a3b4c5d6e7f8a9"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/delivery/prices": {
      "get": {
        "operationId": "listDeliveryPrices",
        "tags": [
          "Delivery setup"
        ],
        "summary": "List delivery prices",
        "description": "The store's own delivery prices per region, for door delivery and pickup points (used with the flat strategy, and as the fallback for courier rates).",
        "x-ordexs-scope": "delivery:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "Every region.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryPriceList"
                },
                "examples": {
                  "prices": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "country": "DZ",
                      "data": [
                        {
                          "object": "delivery_price",
                          "region": {
                            "code": "16",
                            "name": "Alger"
                          },
                          "home": {
                            "amount": "600.00",
                            "currency": "DZD"
                          },
                          "pickup_point": {
                            "amount": "400.00",
                            "currency": "DZD"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateDeliveryPrices",
        "tags": [
          "Delivery setup"
        ],
        "summary": "Update delivery prices",
        "description": "Sets the prices of the regions listed; the others keep theirs. \"0.00\" is free delivery.",
        "x-ordexs-scope": "delivery:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "region_unknown"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "prices"
                ],
                "properties": {
                  "prices": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "region"
                      ],
                      "minProperties": 2,
                      "properties": {
                        "region": {
                          "type": "string",
                          "maxLength": 10
                        },
                        "home": {
                          "$ref": "#/components/schemas/MoneyString"
                        },
                        "pickup_point": {
                          "$ref": "#/components/schemas/MoneyString"
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "two": {
                  "value": {
                    "prices": [
                      {
                        "region": "16",
                        "home": "500.00",
                        "pickup_point": "300.00"
                      },
                      {
                        "region": "31",
                        "home": "700.00"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every region, after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryPriceList"
                },
                "examples": {
                  "prices": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "country": "DZ",
                      "data": [
                        {
                          "object": "delivery_price",
                          "region": {
                            "code": "16",
                            "name": "Alger"
                          },
                          "home": {
                            "amount": "600.00",
                            "currency": "DZD"
                          },
                          "pickup_point": {
                            "amount": "400.00",
                            "currency": "DZD"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/delivery/routing_rules": {
      "get": {
        "operationId": "listRoutingRules",
        "tags": [
          "Delivery setup"
        ],
        "summary": "List routing rules",
        "description": "Which courier ships an order when the store prices delivery itself (the\nflat strategy): a product rule first, then a region rule, then a weight\nrule, else the default courier.\n",
        "x-ordexs-scope": "delivery:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The rules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingRuleList"
                },
                "examples": {
                  "rules": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createRoutingRule",
        "tags": [
          "Delivery setup"
        ],
        "summary": "Add a routing rule",
        "description": "Like the Delivery page, a courier has one rule of each type: adding regions\nor products to a courier that already has that rule extends it. A region or\nproduct can be routed to one courier only, and weight ranges can't overlap\n(`request_rejected` names the courier that already has it).\n",
        "x-ordexs-scope": "delivery:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "region_unknown",
          "request_rejected"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/RoutingRuleWrite"
                  },
                  {
                    "required": [
                      "courier_id",
                      "type"
                    ]
                  }
                ]
              },
              "examples": {
                "regions": {
                  "value": {
                    "courier_id": "cour_4e5f6a7b8c9d40e1f2a3b4c5d6e7f8a9",
                    "type": "region",
                    "regions": [
                      "16",
                      "09",
                      "35"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingRule"
                },
                "examples": {
                  "rule": {
                    "value": {
                      "id": "rul_9c0d1e2f3a4b45c6d7e8f9a0b1c2d3e4",
                      "object": "routing_rule",
                      "courier_id": "cour_4e5f6a7b8c9d40e1f2a3b4c5d6e7f8a9",
                      "type": "region",
                      "regions": [
                        "16",
                        "09",
                        "35"
                      ],
                      "product_ids": [],
                      "weight_min_grams": null,
                      "weight_max_grams": null,
                      "active": true,
                      "created_at": "2026-10-12T09:00:00Z",
                      "updated_at": "2026-10-12T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/delivery/routing_rules/{rule_id}": {
      "patch": {
        "operationId": "updateRoutingRule",
        "tags": [
          "Delivery setup"
        ],
        "summary": "Update a routing rule",
        "description": "regions and product_ids replace the rule's lists.",
        "x-ordexs-scope": "delivery:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "region_unknown",
          "request_rejected"
        ],
        "parameters": [
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^rul_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoutingRuleWrite"
              },
              "examples": {
                "regions": {
                  "value": {
                    "regions": [
                      "16"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingRule"
                },
                "examples": {
                  "rule": {
                    "value": {
                      "id": "rul_9c0d1e2f3a4b45c6d7e8f9a0b1c2d3e4",
                      "object": "routing_rule",
                      "courier_id": "cour_4e5f6a7b8c9d40e1f2a3b4c5d6e7f8a9",
                      "type": "region",
                      "regions": [
                        "16",
                        "09",
                        "35"
                      ],
                      "product_ids": [],
                      "weight_min_grams": null,
                      "weight_max_grams": null,
                      "active": true,
                      "created_at": "2026-10-12T09:00:00Z",
                      "updated_at": "2026-10-12T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteRoutingRule",
        "tags": [
          "Delivery setup"
        ],
        "summary": "Delete a routing rule",
        "x-ordexs-scope": "delivery:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^rul_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "rul_9c0d1e2f3a4b45c6d7e8f9a0b1c2d3e4",
                      "object": "routing_rule",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/analytics/overview": {
      "get": {
        "operationId": "getAnalyticsOverview",
        "tags": [
          "Analytics"
        ],
        "summary": "Retrieve the overview",
        "description": "The Overview page's numbers for a period: orders, revenue and visits (with\nthe change against the period before), a series to chart, how far the\nperiod's orders got, where their cash stands, couriers, best sellers and\ntop regions. `period` is today, 7d, 30d, 90d or all; or send `start_date`\nand `end_date` (a year at most). Computed live, by the same code as the\ndashboard; poll it every few minutes at most.\n",
        "x-ordexs-scope": "analytics:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "7d",
                "30d",
                "90d",
                "all"
              ],
              "default": "7d"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The overview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsOverview"
                },
                "examples": {
                  "week": {
                    "value": {
                      "object": "analytics_overview",
                      "period": {
                        "key": "7d",
                        "days": 7,
                        "start_at": "2026-10-06T00:00:00Z",
                        "previous_start_at": "2026-09-29T00:00:00Z",
                        "generated_at": "2026-10-12T21:00:00Z"
                      },
                      "summary": {
                        "orders": 184,
                        "orders_change_percent": 12.5,
                        "revenue": {
                          "amount": "612400.00",
                          "currency": "DZD"
                        },
                        "revenue_change_percent": 8.1,
                        "visits": 4210,
                        "visits_change_percent": -3.2,
                        "conversion_rate": 4.4,
                        "visitors_now": 6
                      },
                      "series": [
                        {
                          "start": "2026-10-06T00:00:00Z",
                          "label": "Oct 06",
                          "orders": 25,
                          "revenue": {
                            "amount": "84000.00",
                            "currency": "DZD"
                          },
                          "visits": 590
                        }
                      ],
                      "pipeline": {
                        "total": 184,
                        "confirmed": 151,
                        "shipped": 140,
                        "delivered": 96,
                        "returned": 11,
                        "cancelled": 22,
                        "open": 11
                      },
                      "cash": {
                        "on_the_road": {
                          "orders_count": 33,
                          "amount": {
                            "amount": "110200.00",
                            "currency": "DZD"
                          }
                        },
                        "held_by_couriers": {
                          "orders_count": 41,
                          "amount": {
                            "amount": "140900.00",
                            "currency": "DZD"
                          },
                          "oldest_since": "2026-10-07T10:00:00Z",
                          "oldest_courier": "yalidine"
                        },
                        "paid": {
                          "orders_count": 55,
                          "amount": {
                            "amount": "188000.00",
                            "currency": "DZD"
                          }
                        },
                        "returned": {
                          "orders_count": 11,
                          "amount": {
                            "amount": "36300.00",
                            "currency": "DZD"
                          }
                        }
                      },
                      "couriers": [
                        {
                          "courier": "yalidine",
                          "on_the_road": 20,
                          "delivered": 61,
                          "returned": 7,
                          "held_amount": {
                            "amount": "98200.00",
                            "currency": "DZD"
                          }
                        }
                      ],
                      "top_products": [
                        {
                          "product_id": "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
                          "title": "Oversized hoodie",
                          "units": 58,
                          "sales": {
                            "amount": "203000.00",
                            "currency": "DZD"
                          }
                        }
                      ],
                      "top_regions": [
                        {
                          "region": {
                            "code": "16",
                            "name": "Alger"
                          },
                          "orders": 42,
                          "delivery_rate": 81
                        }
                      ],
                      "open_orders": {
                        "to_confirm": 9,
                        "ready_to_ship": 14
                      },
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/analytics/customers": {
      "get": {
        "operationId": "getAnalyticsCustomers",
        "tags": [
          "Analytics"
        ],
        "summary": "Retrieve customer insights",
        "description": "Customers → Insights: buyers by month and how many came back, reliability,\nthe best customers and the valuable ones going quiet, regions, sources and\nhow long customers take to order again. For everyone, or one saved segment.\nDefault window: the last 12 months.\n",
        "x-ordexs-scope": "analytics:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "segment_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^seg_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The insights.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsCustomers"
                },
                "examples": {
                  "year": {
                    "value": {
                      "object": "analytics_customers",
                      "from": "2025-10-12T00:00:00Z",
                      "to": "2026-10-12T21:00:00Z",
                      "buyers_count": 1240,
                      "reliability": {
                        "reliable": 640,
                        "uncertain": 232,
                        "risky": 48,
                        "new": 320
                      },
                      "months": [],
                      "top_customers": [],
                      "at_risk": [],
                      "regions": [],
                      "sources": [],
                      "repeat_timing": {
                        "sample": 380,
                        "median_days": 34,
                        "buckets": []
                      },
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/analytics/team": {
      "get": {
        "operationId": "getAnalyticsTeam",
        "tags": [
          "Analytics"
        ],
        "summary": "Retrieve team performance",
        "description": "Per active teammate over the last `days`, as the Team page shows it - orders they confirmed, orders assigned to them, and how many of those were delivered.",
        "x-ordexs-scope": "analytics:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsTeam"
                },
                "examples": {
                  "team": {
                    "value": {
                      "object": "analytics_team",
                      "days": 30,
                      "data": [
                        {
                          "member": {
                            "id": "mem_3c4d5e6f7a8b49c0d1e2f3a4b5c6d7e8",
                            "name": "Amina"
                          },
                          "confirmed": 412,
                          "assigned": 520,
                          "delivered": 371,
                          "delivery_rate": 71.3
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/policies": {
      "get": {
        "operationId": "listPolicies",
        "tags": [
          "Content"
        ],
        "summary": "List policies",
        "description": "The store's policies that exist (returns, shipping, terms, privacy), as Settings → Policies shows them.",
        "x-ordexs-scope": "content:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The policies.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyList"
                },
                "examples": {
                  "policies": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/policies/{kind}": {
      "get": {
        "operationId": "getPolicy",
        "tags": [
          "Content"
        ],
        "summary": "Retrieve a policy",
        "x-ordexs-scope": "content:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "returns",
                "shipping",
                "terms",
                "privacy"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Policy"
                },
                "examples": {
                  "policy": {
                    "value": {
                      "object": "policy",
                      "kind": "returns",
                      "title": "Return & refund policy",
                      "body": "You can refuse the package at the door if it is damaged.\n\n- Report a problem within 48 hours.",
                      "published": true,
                      "url": "https://tulips.myordexs.com/policies/returns",
                      "updated_at": "2026-10-13T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "put": {
        "operationId": "putPolicy",
        "tags": [
          "Content"
        ],
        "summary": "Set a policy",
        "description": "Creates or replaces the policy. `body` is plain text: blank lines separate\nparagraphs, lines starting with \"- \" make a list, \"## \" a heading. A policy\nwith an empty body is never published. The title defaults to the usual one.\n",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "returns",
                "shipping",
                "terms",
                "privacy"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "body": {
                    "type": "string",
                    "maxLength": 20000
                  },
                  "published": {
                    "type": "boolean",
                    "default": true
                  }
                }
              },
              "examples": {
                "returns": {
                  "value": {
                    "body": "You can refuse the package at the door if it is damaged.\n\n- Report a problem within 48 hours."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Policy"
                },
                "examples": {
                  "policy": {
                    "value": {
                      "object": "policy",
                      "kind": "returns",
                      "title": "Return & refund policy",
                      "body": "You can refuse the package at the door if it is damaged.\n\n- Report a problem within 48 hours.",
                      "published": true,
                      "url": "https://tulips.myordexs.com/policies/returns",
                      "updated_at": "2026-10-13T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deletePolicy",
        "tags": [
          "Content"
        ],
        "summary": "Delete a policy",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "returns",
                "shipping",
                "terms",
                "privacy"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "object": "policy",
                      "kind": "privacy",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/pages": {
      "get": {
        "operationId": "listPages",
        "tags": [
          "Content"
        ],
        "summary": "List pages",
        "description": "Content pages (About, Contact, Size guide…) and landing pages, newest first.",
        "x-ordexs-scope": "content:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "content",
                "landing"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "published",
                "draft"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of pages.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createPage",
        "tags": [
          "Content"
        ],
        "summary": "Create a content page",
        "description": "A content page, a draft unless `status` is published. `body` is plain text\nlike a policy's. The handle is made from the title when left out, and made\nunique if it is taken. Landing pages are built in the dashboard's page builder.\n",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PageWrite"
                  },
                  {
                    "required": [
                      "title"
                    ]
                  }
                ]
              },
              "examples": {
                "size": {
                  "value": {
                    "title": "Size guide",
                    "body": "## Tops\n\n- S: 86-91 cm chest",
                    "status": "published",
                    "show_in_footer": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                },
                "examples": {
                  "page": {
                    "value": {
                      "id": "pag_5e6f7a8b9c0d41e2f3a4b5c6d7e8f9a0",
                      "object": "page",
                      "kind": "content",
                      "title": "Size guide",
                      "handle": "size-guide",
                      "status": "published",
                      "body": "## Tops\n\n- S: 86-91 cm chest",
                      "product_id": null,
                      "offer_id": null,
                      "seo": {
                        "title": null,
                        "description": null
                      },
                      "show_in_footer": true,
                      "url": "https://tulips.myordexs.com/pages/size-guide",
                      "published_at": "2026-10-13T09:00:00Z",
                      "created_at": "2026-10-13T09:00:00Z",
                      "updated_at": "2026-10-13T09:00:00Z",
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/pages/{page_id}": {
      "get": {
        "operationId": "getPage",
        "tags": [
          "Content"
        ],
        "summary": "Retrieve a page",
        "x-ordexs-scope": "content:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pag_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                },
                "examples": {
                  "page": {
                    "value": {
                      "id": "pag_5e6f7a8b9c0d41e2f3a4b5c6d7e8f9a0",
                      "object": "page",
                      "kind": "content",
                      "title": "Size guide",
                      "handle": "size-guide",
                      "status": "published",
                      "body": "## Tops\n\n- S: 86-91 cm chest",
                      "product_id": null,
                      "offer_id": null,
                      "seo": {
                        "title": null,
                        "description": null
                      },
                      "show_in_footer": true,
                      "url": "https://tulips.myordexs.com/pages/size-guide",
                      "published_at": "2026-10-13T09:00:00Z",
                      "created_at": "2026-10-13T09:00:00Z",
                      "updated_at": "2026-10-13T09:00:00Z",
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updatePage",
        "tags": [
          "Content"
        ],
        "summary": "Update a page",
        "description": "Publish or unpublish, rename, move (handle), SEO and the footer link for any page; `body` for content pages only (a landing page's blocks are edited in the page builder).",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pag_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PageWrite"
              },
              "examples": {
                "publish": {
                  "value": {
                    "status": "published"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                },
                "examples": {
                  "page": {
                    "value": {
                      "id": "pag_5e6f7a8b9c0d41e2f3a4b5c6d7e8f9a0",
                      "object": "page",
                      "kind": "content",
                      "title": "Size guide",
                      "handle": "size-guide",
                      "status": "published",
                      "body": "## Tops\n\n- S: 86-91 cm chest",
                      "product_id": null,
                      "offer_id": null,
                      "seo": {
                        "title": null,
                        "description": null
                      },
                      "show_in_footer": true,
                      "url": "https://tulips.myordexs.com/pages/size-guide",
                      "published_at": "2026-10-13T09:00:00Z",
                      "created_at": "2026-10-13T09:00:00Z",
                      "updated_at": "2026-10-13T09:00:00Z",
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deletePage",
        "tags": [
          "Content"
        ],
        "summary": "Delete a page",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pag_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "pag_5e6f7a8b9c0d41e2f3a4b5c6d7e8f9a0",
                      "object": "page",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/pages/{page_id}/duplicate": {
      "post": {
        "operationId": "duplicatePage",
        "tags": [
          "Content"
        ],
        "summary": "Duplicate a page",
        "description": "A draft copy, landing pages included.",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "validation_failed"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pag_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                },
                "examples": {
                  "page": {
                    "value": {
                      "id": "pag_5e6f7a8b9c0d41e2f3a4b5c6d7e8f9a0",
                      "object": "page",
                      "kind": "content",
                      "title": "Size guide",
                      "handle": "size-guide",
                      "status": "published",
                      "body": "## Tops\n\n- S: 86-91 cm chest",
                      "product_id": null,
                      "offer_id": null,
                      "seo": {
                        "title": null,
                        "description": null
                      },
                      "show_in_footer": true,
                      "url": "https://tulips.myordexs.com/pages/size-guide",
                      "published_at": "2026-10-13T09:00:00Z",
                      "created_at": "2026-10-13T09:00:00Z",
                      "updated_at": "2026-10-13T09:00:00Z",
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/order_form": {
      "get": {
        "operationId": "getOrderForm",
        "tags": [
          "Content"
        ],
        "summary": "Retrieve the order form",
        "description": "The checkout form's fields, buttons and general settings, as the order-form editor shows them. Delivery is under /v1/delivery/settings.",
        "x-ordexs-scope": "content:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The form.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderForm"
                },
                "examples": {
                  "form": {
                    "value": {
                      "object": "order_form",
                      "enabled": true,
                      "fields": [
                        {
                          "id": "name",
                          "type": "text",
                          "label": "Full name",
                          "placeholder": "Full name",
                          "visible": true,
                          "required": true,
                          "show_on_landing": true
                        }
                      ],
                      "buttons": [
                        {
                          "id": "cash_on_delivery",
                          "label": "Order now - Cash on delivery",
                          "visible": true,
                          "sticky": false
                        }
                      ],
                      "general": {
                        "title": "Order details",
                        "subtitle": "Complete your information and confirm your order.",
                        "language": "auto",
                        "appearance": "inline",
                        "sticky_button": false,
                        "variant_per_item": true,
                        "whatsapp_button": false,
                        "whatsapp_phone": null,
                        "whatsapp_message": "Hi, I want to order {{items}}."
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateOrderForm",
        "tags": [
          "Content"
        ],
        "summary": "Update the order form",
        "description": "Change fields (by `id`), buttons (by `id`) and general settings; send only\nwhat changes. Name, phone, region and city stay visible and required, and at\nleast one button stays visible.\n",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "fields": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 80
                        },
                        "placeholder": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "visible": {
                          "type": "boolean"
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "show_on_landing": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "buttons": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "enum": [
                            "cash_on_delivery",
                            "pay_card",
                            "add_to_cart"
                          ]
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "visible": {
                          "type": "boolean"
                        },
                        "sticky": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "general": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "subtitle": {
                        "type": "string",
                        "maxLength": 240
                      },
                      "language": {
                        "type": "string",
                        "enum": [
                          "auto",
                          "ar",
                          "fr",
                          "en"
                        ]
                      },
                      "appearance": {
                        "type": "string",
                        "enum": [
                          "inline",
                          "popup",
                          "sheet",
                          "drawer"
                        ]
                      },
                      "sticky_button": {
                        "type": "boolean"
                      },
                      "variant_per_item": {
                        "type": "boolean"
                      },
                      "whatsapp_button": {
                        "type": "boolean"
                      },
                      "whatsapp_phone": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 32
                      },
                      "whatsapp_message": {
                        "type": "string",
                        "maxLength": 500
                      }
                    }
                  }
                }
              },
              "examples": {
                "email": {
                  "value": {
                    "fields": [
                      {
                        "id": "email",
                        "visible": true,
                        "required": false
                      }
                    ],
                    "general": {
                      "appearance": "popup"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The form.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderForm"
                },
                "examples": {
                  "form": {
                    "value": {
                      "object": "order_form",
                      "enabled": true,
                      "fields": [],
                      "buttons": [],
                      "general": {
                        "title": "Order details",
                        "subtitle": "",
                        "language": "auto",
                        "appearance": "popup",
                        "sticky_button": false,
                        "variant_per_item": true,
                        "whatsapp_button": false,
                        "whatsapp_phone": null,
                        "whatsapp_message": ""
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/pixels": {
      "get": {
        "operationId": "listPixels",
        "tags": [
          "Marketing"
        ],
        "summary": "List pixels",
        "description": "The store's marketing pixels (Integrations → Pixels). Storefront events are sent to every enabled one.",
        "x-ordexs-scope": "marketing:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The pixels.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PixelList"
                },
                "examples": {
                  "pixels": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createPixel",
        "tags": [
          "Marketing"
        ],
        "summary": "Add a pixel",
        "description": "Adds a pixel. A store can have several per provider; `default` marks the one\nused where only one is needed. The Conversions API (server) token is a\nsecret and is added in the dashboard only.\n",
        "x-ordexs-scope": "marketing:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PixelWrite"
                  },
                  {
                    "required": [
                      "provider",
                      "pixel_id"
                    ]
                  }
                ]
              },
              "examples": {
                "meta": {
                  "value": {
                    "provider": "meta",
                    "pixel_id": "1234567890123456"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The pixel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pixel"
                },
                "examples": {
                  "pixel": {
                    "value": {
                      "id": "pix_6a7b8c9d0e1f42a3b4c5d6e7f8a9b0c1",
                      "object": "pixel",
                      "provider": "meta",
                      "name": "Meta pixel",
                      "pixel_id": "1234567890123456",
                      "enabled": true,
                      "default": true,
                      "test_event_code": null,
                      "config": {},
                      "has_server_token": false,
                      "last_event_at": null,
                      "last_error": null,
                      "created_at": "2026-10-13T09:00:00Z",
                      "updated_at": "2026-10-13T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/pixels/{pixel_id}": {
      "get": {
        "operationId": "getPixel",
        "tags": [
          "Marketing"
        ],
        "summary": "Retrieve a pixel",
        "x-ordexs-scope": "marketing:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "pixel_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pix_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The pixel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pixel"
                },
                "examples": {
                  "pixel": {
                    "value": {
                      "id": "pix_6a7b8c9d0e1f42a3b4c5d6e7f8a9b0c1",
                      "object": "pixel",
                      "provider": "meta",
                      "name": "Meta pixel",
                      "pixel_id": "1234567890123456",
                      "enabled": true,
                      "default": true,
                      "test_event_code": null,
                      "config": {},
                      "has_server_token": false,
                      "last_event_at": null,
                      "last_error": null,
                      "created_at": "2026-10-13T09:00:00Z",
                      "updated_at": "2026-10-13T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updatePixel",
        "tags": [
          "Marketing"
        ],
        "summary": "Update a pixel",
        "x-ordexs-scope": "marketing:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found"
        ],
        "parameters": [
          {
            "name": "pixel_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pix_[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PixelWrite"
              },
              "examples": {
                "off": {
                  "value": {
                    "enabled": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The pixel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pixel"
                },
                "examples": {
                  "pixel": {
                    "value": {
                      "id": "pix_6a7b8c9d0e1f42a3b4c5d6e7f8a9b0c1",
                      "object": "pixel",
                      "provider": "meta",
                      "name": "Meta pixel",
                      "pixel_id": "1234567890123456",
                      "enabled": true,
                      "default": true,
                      "test_event_code": null,
                      "config": {},
                      "has_server_token": false,
                      "last_event_at": null,
                      "last_error": null,
                      "created_at": "2026-10-13T09:00:00Z",
                      "updated_at": "2026-10-13T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deletePixel",
        "tags": [
          "Marketing"
        ],
        "summary": "Remove a pixel",
        "x-ordexs-scope": "marketing:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "pixel_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pix_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                },
                "examples": {
                  "deleted": {
                    "value": {
                      "id": "pix_6a7b8c9d0e1f42a3b4c5d6e7f8a9b0c1",
                      "object": "pixel",
                      "deleted": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/bulk_uploads": {
      "post": {
        "operationId": "createBulkUpload",
        "tags": [
          "Bulk"
        ],
        "summary": "Create a bulk file slot",
        "description": "A slot to PUT a bulk job's NDJSON file to (one JSON object per line, 10 MB at most), within 15 minutes. Pass its id to POST /v1/bulk_jobs as upload_id.",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "upstream_unavailable"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "size"
                ],
                "properties": {
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10485760,
                    "description": "Bytes."
                  }
                }
              },
              "examples": {
                "file": {
                  "value": {
                    "size": 2400000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The slot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                },
                "examples": {
                  "slot": {
                    "value": {
                      "object": "upload",
                      "id": "upl_0a1b2c3d4e5f46a7b8c9d0e1f2a3b4c5",
                      "upload_url": "https://…r2.cloudflarestorage.com/…",
                      "method": "PUT",
                      "headers": {
                        "Content-Type": "application/x-ndjson"
                      },
                      "max_bytes": 10485760,
                      "expires_at": "2026-10-13T09:15:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/bulk_jobs": {
      "get": {
        "operationId": "listBulkJobs",
        "tags": [
          "Bulk"
        ],
        "summary": "List bulk jobs",
        "description": "The store's bulk jobs, newest first. Finished jobs are kept 7 days.",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of jobs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkJobList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": []
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createBulkJob",
        "tags": [
          "Bulk"
        ],
        "summary": "Queue a bulk job",
        "description": "Up to 10,000 lines of one `kind`, each the body of the single call it\nstands for, run in the background by Ordexs with this key as the actor:\n\n| kind | Each line is | Needs |\n|---|---|---|\n| orders.create | a POST /v1/orders body | orders:write |\n| orders.update | a PATCH /v1/orders/{id} body plus `order_id` | orders:write |\n| products.create | a POST /v1/products body | products:write |\n| products.update | a PATCH /v1/products/{id} body plus `product_id` | products:write |\n| inventory.adjust | `{ variant_id, delta or set, reason?, note? }` | inventory:write |\n\nSend the lines as a file (`upload_id`, from POST /v1/bulk_uploads) or, for\na few hundred, inline in `lines`. Each line is validated and run exactly as\nthe single endpoint would; one failing line never stops the others. Follow\nprogress with GET /v1/bulk_jobs/{id} or the `bulk_job.completed` webhook,\nthen read each line's outcome from /results. A store runs 3 jobs at a time.\n",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "quota_exceeded",
          "upstream_unavailable",
          "request_rejected"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "orders.create",
                      "orders.update",
                      "products.create",
                      "products.update",
                      "inventory.adjust"
                    ]
                  },
                  "upload_id": {
                    "type": "string",
                    "pattern": "^upl_[0-9a-f]{32}$"
                  },
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 1000,
                    "items": {
                      "type": "object"
                    }
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "upload_id"
                    ]
                  },
                  {
                    "required": [
                      "lines"
                    ]
                  }
                ]
              },
              "examples": {
                "stock": {
                  "value": {
                    "kind": "inventory.adjust",
                    "lines": [
                      {
                        "variant_id": "var_3c4d5e6f7a8b49c0d1e2f3a4b5c6d7e8",
                        "set": 40,
                        "reason": "correction"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The job, queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkJob"
                },
                "examples": {
                  "job": {
                    "value": {
                      "id": "blk_7b8c9d0e1f2a43b4c5d6e7f8a9b0c1d2",
                      "object": "bulk_job",
                      "kind": "orders.create",
                      "status": "running",
                      "total": 8000,
                      "processed": 3120,
                      "succeeded": 3098,
                      "failed": 22,
                      "created_at": "2026-10-13T09:00:00Z",
                      "started_at": "2026-10-13T09:01:00Z",
                      "finished_at": null,
                      "expires_at": null,
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/bulk_jobs/{job_id}": {
      "get": {
        "operationId": "getBulkJob",
        "tags": [
          "Bulk"
        ],
        "summary": "Retrieve a bulk job",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "not_found"
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^blk_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkJob"
                },
                "examples": {
                  "job": {
                    "value": {
                      "id": "blk_7b8c9d0e1f2a43b4c5d6e7f8a9b0c1d2",
                      "object": "bulk_job",
                      "kind": "orders.create",
                      "status": "running",
                      "total": 8000,
                      "processed": 3120,
                      "succeeded": 3098,
                      "failed": 22,
                      "created_at": "2026-10-13T09:00:00Z",
                      "started_at": "2026-10-13T09:01:00Z",
                      "finished_at": null,
                      "expires_at": null,
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/bulk_jobs/{job_id}/cancel": {
      "post": {
        "operationId": "cancelBulkJob",
        "tags": [
          "Bulk"
        ],
        "summary": "Cancel a bulk job",
        "description": "Lines not yet run are skipped (their result says cancelled); lines already run stay done.",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "not_found",
          "invalid_state_transition"
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^blk_[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkJob"
                },
                "examples": {
                  "job": {
                    "value": {
                      "id": "blk_7b8c9d0e1f2a43b4c5d6e7f8a9b0c1d2",
                      "object": "bulk_job",
                      "kind": "orders.create",
                      "status": "running",
                      "total": 8000,
                      "processed": 3120,
                      "succeeded": 3098,
                      "failed": 22,
                      "created_at": "2026-10-13T09:00:00Z",
                      "started_at": "2026-10-13T09:01:00Z",
                      "finished_at": null,
                      "expires_at": null,
                      "livemode": true
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/bulk_jobs/{job_id}/results": {
      "get": {
        "operationId": "listBulkJobResults",
        "tags": [
          "Bulk"
        ],
        "summary": "List a bulk job's results",
        "description": "Each line's outcome, in line order: `ok`, the HTTP `status` the single call\nwould have answered, and `result` — the object's id, or the error body\nexactly as the single call would have returned it. `failed=true` lists only\nthe lines that failed.\n",
        "x-ordexs-scope": "any",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed",
          "not_found"
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^blk_[0-9a-f]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "name": "failed",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkResultList"
                },
                "examples": {
                  "page": {
                    "value": {
                      "object": "list",
                      "has_more": false,
                      "next_cursor": null,
                      "data": [
                        {
                          "line": 17,
                          "state": "done",
                          "ok": false,
                          "status": 422,
                          "result": {
                            "error": {
                              "code": "out_of_stock",
                              "message": "Only 2 left of Black / M.",
                              "request_id": "req_bulk_7b8c9d0e1f2a_17"
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/export": {
      "get": {
        "operationId": "exportOrders",
        "tags": [
          "Bulk"
        ],
        "summary": "Export orders",
        "description": "Every matching order as NDJSON (one Order per line), streamed. Up to\n100,000 orders; filter with `created_since` or `updated_since` to export\nin parts. Same filters and same objects as GET /v1/orders.\n",
        "x-ordexs-scope": "orders:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "unknown_field",
          "validation_failed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/created_since"
          },
          {
            "$ref": "#/components/parameters/updated_since"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "archived",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The orders, one JSON object per line.",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "lines": {
                    "value": "{\"id\":\"ord_9b8c7d6e5f4a43b2a1c0d9e8f7a6b5c4\",\"object\":\"order\",\"number\":\"ORD-00042\"}\n"
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/store": {
      "get": {
        "operationId": "getStore",
        "tags": [
          "Store"
        ],
        "summary": "Retrieve the store",
        "description": "Returns the store the API key belongs to. A test key returns the store's\ntest-mode sandbox, with `livemode: false`.\n",
        "x-ordexs-scope": "store:read",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited"
        ],
        "responses": {
          "200": {
            "description": "The store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Store"
                },
                "examples": {
                  "live": {
                    "value": {
                      "id": "sto_52cac290122d489091f64df771b29e1a",
                      "object": "store",
                      "name": "Atlas Boutique",
                      "slug": "atlas",
                      "url": "https://atlas.myordexs.com",
                      "country": "DZ",
                      "currency": {
                        "code": "DZD",
                        "exponent": 2
                      },
                      "plan": "growth",
                      "livemode": true,
                      "created_at": "2026-05-11T02:33:19Z",
                      "updated_at": "2026-10-09T02:05:49Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateStore",
        "tags": [
          "Store"
        ],
        "summary": "Update the store's details",
        "description": "Like Settings → General: the store's name, contact, address, the\nstorefront's language, the timezone and the order-number prefix. Send only\nwhat changes. The prefix applies to orders created from now on.\n",
        "x-ordexs-scope": "content:write",
        "x-ordexs-errors": [
          "authentication_required",
          "invalid_api_key",
          "plan_required",
          "insufficient_scope",
          "rate_limited",
          "invalid_request",
          "invalid_json",
          "unknown_field",
          "validation_failed",
          "idempotency_in_progress",
          "idempotency_key_reused",
          "region_unknown"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "ar",
                      "ar-ltr",
                      "fr",
                      "en"
                    ],
                    "description": "The storefront language. ar-ltr: Arabic text on a left-to-right page."
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "An IANA timezone such as Africa/Algiers."
                  },
                  "order_prefix": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9-]{1,12}$",
                    "description": "Stored in capitals."
                  },
                  "contact": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 254
                      },
                      "phone": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 32
                      }
                    }
                  },
                  "address": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "region": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 10
                      },
                      "city": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 120
                      },
                      "street": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 240
                      }
                    }
                  }
                }
              },
              "examples": {
                "language": {
                  "value": {
                    "language": "fr",
                    "contact": {
                      "phone": "0551234567"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Store"
                },
                "examples": {
                  "store": {
                    "value": {
                      "id": "sto_52cac290122d489091f64df771b29e1a",
                      "object": "store",
                      "name": "Atlas Boutique",
                      "slug": "atlas",
                      "url": "https://atlas.myordexs.com",
                      "country": "DZ",
                      "currency": {
                        "code": "DZD",
                        "exponent": 2
                      },
                      "plan": "growth",
                      "language": "fr",
                      "timezone": "Africa/Algiers",
                      "order_prefix": "ORD-",
                      "contact": {
                        "email": null,
                        "phone": "0551234567"
                      },
                      "address": {
                        "region": "16",
                        "city": "Alger Centre",
                        "street": null
                      },
                      "livemode": true,
                      "created_at": "2026-05-11T02:33:19Z",
                      "updated_at": "2026-10-13T09:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "webhooks": {
    "order.created": {
      "post": {
        "summary": "An order is created",
        "description": "Sent when an order is created. `data.object` is the Order as the\nAPI returns it.\nFires for every order — storefront, dashboard, API and import.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "order.created"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Order"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "order.updated": {
      "post": {
        "summary": "An order changes",
        "description": "Sent when an order changes. `data.object` is the Order as the\nAPI returns it.\nCustomer, address, lines, totals, tracking code, note, metadata or archiving.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "order.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Order"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "order.status_changed": {
      "post": {
        "summary": "An order's status changes",
        "description": "Sent when an order's status changes. `data.object` is the Order as the\nAPI returns it.\n`data.previous_attributes.status` holds the old status. Includes changes the courier reports.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "order.status_changed"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Order"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "order.cancelled": {
      "post": {
        "summary": "An order is cancelled",
        "description": "Sent when an order is cancelled. `data.object` is the Order as the\nAPI returns it.\nSent alongside `order.status_changed`, for convenience.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "order.cancelled"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Order"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "order.needs_review": {
      "post": {
        "summary": "An order needs the merchant to confirm its address",
        "description": "Sent when an order needs the merchant to confirm its address. `data.object` is the Order as the\nAPI returns it.\n`data.object.needs_review` says why (`city_unmatched`).\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "order.needs_review"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Order"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "order.note_added": {
      "post": {
        "summary": "A note is added to an order",
        "description": "Sent when a note is added to an order. `data.object` is the OrderNote as the\nAPI returns it.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "order.note_added"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/OrderNote"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "product.created": {
      "post": {
        "summary": "A product is created",
        "description": "Sent when a product is created. `data.object` is the Product as the\nAPI returns it.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "product.created"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Product"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "product.updated": {
      "post": {
        "summary": "A product or one of its variants changes",
        "description": "Sent when a product or one of its variants changes. `data.object` is the Product as the\nAPI returns it.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "product.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Product"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "product.deleted": {
      "post": {
        "summary": "A product is archived or deleted",
        "description": "Sent when a product is archived or deleted. `data.object` is the Product as the\nAPI returns it.\nFor an archived product `data.object.status` is `archived`; a deleted one is `{ id, object, deleted: true }`.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "product.deleted"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Product"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "inventory.updated": {
      "post": {
        "summary": "A variant's stock changes",
        "description": "Sent when a variant's stock changes. `data.object` is the Variant as the\nAPI returns it.\n`data.previous_attributes.inventory_quantity` holds the old count.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "inventory.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Variant"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "customer.created": {
      "post": {
        "summary": "A customer is created",
        "description": "Sent when a customer is created. `data.object` is the Customer as the\nAPI returns it.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "customer.created"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Customer"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "customer.updated": {
      "post": {
        "summary": "A customer's name, contact, status, tags or note changes",
        "description": "Sent when a customer's name, contact, status, tags or note changes. `data.object` is the Customer as the\nAPI returns it.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "customer.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Customer"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "shipment.created": {
      "post": {
        "summary": "An order is sent to a courier",
        "description": "Sent when a parcel is registered with a courier, from the dashboard, the\nAPI or an automation. `data.object` is the Shipment as the API returns\nit. A refused send is not a shipment and sends nothing.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "shipment.created"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Shipment"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "shipment.updated": {
      "post": {
        "summary": "A shipment's tracking changes",
        "description": "Sent when the courier reports something new: the status, the stage (out\nfor delivery, no answer, cash collected…), the cash, a return, the\ndriver. `data.object` is the Shipment as the API returns it, and\n`data.previous_attributes` has the old values of what changed.\nCouriers are read on a schedule, so an update can arrive minutes after\nthe event at the courier.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "shipment.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Shipment"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "abandoned_checkout.created": {
      "post": {
        "summary": "A shopper leaves their details at checkout",
        "description": "Sent when a shopper fills in their contact at checkout. They may still\nfinish the order: wait a little, then check status (open means still\nabandoned). data.object is the AbandonedCheckout.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "abandoned_checkout.created"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/AbandonedCheckout"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "abandoned_checkout.updated": {
      "post": {
        "summary": "An abandoned checkout changes",
        "description": "Sent when its status (confirmed, recovered, deleted), contact, total or\nassignee changes — not on every keystroke of the shopper.\nWhen the shopper finishes ordering themselves, this is the last event:\nstatus recovered with order_id, after which the checkout is deleted\n(GET answers 404).\ndata.object is the AbandonedCheckout.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "abandoned_checkout.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/AbandonedCheckout"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "review.created": {
      "post": {
        "summary": "A review is submitted or added",
        "description": "Sent for every new review: a customer's (pending unless the store\npublishes automatically) or one the merchant added. data.object is the Review.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "review.created"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/Review"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "bulk_job.completed": {
      "post": {
        "summary": "A bulk job finished",
        "description": "Every line has run. data.object is the BulkJob, with its succeeded and failed counts; read the outcomes from /v1/bulk_jobs/{id}/results.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "bulk_job.completed"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/BulkJob"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    },
    "ping": {
      "post": {
        "summary": "A test event is requested",
        "description": "Sent when a test event is requested. `data.object` is the WebhookEndpoint as the\nAPI returns it.\nOnly ever sent by `POST /v1/webhook_endpoints/{id}/test`.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "ping"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "$ref": "#/components/schemas/WebhookEndpoint"
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any 2xx counts; anything else is retried."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer ordx_live_…` (or `ordx_test_…`). Create keys in the\ndashboard under Settings → Developers.\n"
      }
    },
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "description": "How many objects to return, 1–100. Default 25.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "description": "The `next_cursor` from the previous page. Repeat the same filters with it.",
        "schema": {
          "type": "string",
          "maxLength": 512
        }
      },
      "updated_since": {
        "name": "updated_since",
        "in": "query",
        "description": "Only objects changed at or after this moment (ISO-8601). Switches the\norder to oldest change first, so you can store the last `updated_at`\nyou saw and resume from it. Objects changed in the same second may be\nreturned again — de-duplicate by `id`.\n",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "created_since": {
        "name": "created_since",
        "in": "query",
        "description": "Only objects created at or after this moment (ISO-8601).",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "order_id": {
        "name": "order_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^ord_[0-9a-f]{32}$"
        }
      },
      "country": {
        "name": "country",
        "in": "query",
        "required": true,
        "description": "ISO 3166-1 alpha-2 country code, for example `DZ`.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z]{2}$"
        }
      },
      "product_id": {
        "name": "product_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^prod_[0-9a-f]{32}$"
        }
      },
      "variant_id": {
        "name": "variant_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^var_[0-9a-f]{32}$"
        }
      },
      "customer_id": {
        "name": "customer_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^cus_[0-9a-f]{32}$"
        }
      },
      "webhook_endpoint_id": {
        "name": "webhook_endpoint_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^we_[0-9a-f]{32}$"
        }
      },
      "stock_count_id": {
        "name": "stock_count_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^cnt_[0-9a-f]{32}$"
        }
      },
      "shipment_id": {
        "name": "shipment_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^shp_[0-9a-f]{32}$"
        }
      }
    },
    "examples": {
      "WebhookEndpoint": {
        "value": {
          "id": "we_8c2f0a1b3d4e4f5a9b8c7d6e5f4a3b2c",
          "object": "webhook_endpoint",
          "url": "https://example.com/ordexs/webhooks",
          "description": "Fulfilment system",
          "events": [
            "order.created",
            "order.status_changed"
          ],
          "status": "enabled",
          "disabled_reason": null,
          "failing_since": null,
          "livemode": true,
          "created_at": "2026-10-11T10:00:00Z",
          "updated_at": "2026-10-11T10:00:00Z"
        }
      },
      "Event": {
        "value": {
          "id": "evt_1a2b3c4d5e6f40718293a4b5c6d7e8f9",
          "object": "event",
          "type": "order.status_changed",
          "api_version": "v1",
          "created_at": "2026-10-11T10:05:00Z",
          "livemode": true,
          "store_id": "sto_52cac290122d489091f64df771b29e1a",
          "data": {
            "object": {
              "id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
              "object": "order",
              "status": "confirmed"
            },
            "previous_attributes": {
              "status": "pending"
            }
          },
          "request": {
            "api_key_id": "key_dabefb2303b6496999008c7c863f6733"
          }
        }
      },
      "OrderCreate": {
        "value": {
          "customer": {
            "name": "Yacine Benali",
            "phone": "+213551234567"
          },
          "shipping_address": {
            "region": "16",
            "city": "Bab El Oued",
            "address1": "12 rue Ali Boumendjel"
          },
          "delivery": {
            "mode": "home"
          },
          "line_items": [
            {
              "variant_id": "var_2f0e1d3c4b5a49688776655443322110",
              "quantity": 2
            }
          ],
          "note": "Call before coming.",
          "external_id": "chat-58213",
          "source_name": "chatbot",
          "metadata": {
            "conversation": "58213"
          }
        }
      },
      "Variant": {
        "value": {
          "id": "var_2f0e1d3c4b5a49688776655443322110",
          "object": "variant",
          "product_id": "prod_6b6d1c2e3f4a4b5c9d8e7f6a5b4c3d2e",
          "title": "Black / M",
          "options": {
            "Color": "Black",
            "Size": "M"
          },
          "sku": "HOOD-BLK-M",
          "barcode": null,
          "price": {
            "amount": "3500.00",
            "currency": "DZD"
          },
          "compare_at_price": {
            "amount": "4200.00",
            "currency": "DZD"
          },
          "inventory_quantity": 14,
          "inventory_tracked": true,
          "incoming_quantity": 0,
          "allow_preorder": false,
          "image_url": "https://cdn.ordexs.com/52cac290-122d-4890-91f6-4df771b29e1a/product/1b2c-1920.webp",
          "livemode": true,
          "created_at": "2026-09-02T10:15:00Z",
          "updated_at": "2026-10-08T18:40:12Z"
        }
      },
      "Product": {
        "value": {
          "id": "prod_6b6d1c2e3f4a4b5c9d8e7f6a5b4c3d2e",
          "object": "product",
          "title": "Oversized hoodie",
          "handle": "oversized-hoodie",
          "description_html": "<p>Heavy cotton, relaxed fit.</p>",
          "status": "published",
          "product_type": "Hoodies",
          "vendor": null,
          "category": null,
          "tags": [
            "winter"
          ],
          "weight_grams": 650,
          "options": [
            {
              "name": "Color",
              "type": "color",
              "values": [
                "Black",
                "Sand"
              ]
            },
            {
              "name": "Size",
              "type": "size",
              "values": [
                "S",
                "M",
                "L"
              ]
            }
          ],
          "variants": [
            {
              "id": "var_2f0e1d3c4b5a49688776655443322110",
              "object": "variant",
              "product_id": "prod_6b6d1c2e3f4a4b5c9d8e7f6a5b4c3d2e",
              "title": "Black / M",
              "options": {
                "Color": "Black",
                "Size": "M"
              },
              "sku": "HOOD-BLK-M",
              "barcode": null,
              "price": {
                "amount": "3500.00",
                "currency": "DZD"
              },
              "compare_at_price": null,
              "inventory_quantity": 14,
              "inventory_tracked": true,
              "incoming_quantity": 0,
              "allow_preorder": false,
              "image_url": null,
              "livemode": true,
              "created_at": "2026-09-02T10:15:00Z",
              "updated_at": "2026-10-08T18:40:12Z"
            }
          ],
          "images": [
            {
              "id": "img_7a8b9c0d1e2f43a4b5c6d7e8f9a0b1c2",
              "url": "https://cdn.ordexs.com/52cac290-122d-4890-91f6-4df771b29e1a/product/1b2c-1920.webp",
              "alt": "Black hoodie",
              "position": 0
            }
          ],
          "url": "https://atlas.myordexs.com/products/oversized-hoodie",
          "livemode": true,
          "created_at": "2026-09-02T10:15:00Z",
          "updated_at": "2026-10-08T18:40:12Z"
        }
      },
      "ProductList": {
        "value": {
          "object": "list",
          "has_more": true,
          "next_cursor": "eyJzIjoiYyIsInQiOiIyMDI2LTA5LTAyVDEwOjE1OjAwLjEyMzQ1NiswMDowMCIsImkiOiI2YjZkMWMyZS0zZjRhLTRiNWMtOWQ4ZS03ZjZhNWI0YzNkMmUifQ",
          "data": []
        }
      },
      "Order": {
        "value": {
          "id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
          "object": "order",
          "number": "ORD-00042",
          "status": "confirmed",
          "source": "storefront",
          "preorder": false,
          "customer": {
            "id": "cus_5d4c3b2a19f84e7d6c5b4a3928170615",
            "name": "Yacine Benali",
            "phone": "+213551234567",
            "phone_2": null,
            "email": null
          },
          "shipping_address": {
            "country": "DZ",
            "region": {
              "code": "16",
              "name": "Algiers"
            },
            "city": {
              "code": null,
              "name": "Bab El Oued"
            },
            "address1": "12 rue Ali Boumendjel"
          },
          "delivery": {
            "mode": "home",
            "label": "Door delivery",
            "courier": {
              "name": "Yalidine"
            },
            "pickup_point": null,
            "tracking_code": null,
            "tracking_url": "https://my-shop.myordexs.com/track/T1qG0VR_IeSl",
            "shipped_at": null
          },
          "line_items": [
            {
              "id": "li_7a6b5c4d3e2f41a0b9c8d7e6f5a4b3c2",
              "product_id": "prod_6b6d1c2e3f4a4b5c9d8e7f6a5b4c3d2e",
              "variant_id": "var_2f0e1d3c4b5a49688776655443322110",
              "title": "Oversized hoodie",
              "variant_title": "Black / M",
              "sku": "HOOD-BLK-M",
              "quantity": 2,
              "unit_price": {
                "amount": "3500.00",
                "currency": "DZD"
              },
              "total": {
                "amount": "7000.00",
                "currency": "DZD"
              },
              "image_url": null
            }
          ],
          "discount_code": null,
          "discount_name": null,
          "offers": [],
          "offer_ids": [],
          "subtotal": {
            "amount": "7000.00",
            "currency": "DZD"
          },
          "shipping": {
            "amount": "600.00",
            "currency": "DZD"
          },
          "discount": {
            "amount": "0.00",
            "currency": "DZD"
          },
          "total": {
            "amount": "7600.00",
            "currency": "DZD"
          },
          "payment": {
            "method": "cod",
            "status": "unpaid",
            "paid_at": null,
            "amount_paid": {
              "amount": "0.00",
              "currency": "DZD"
            },
            "amount_to_collect": {
              "amount": "7600.00",
              "currency": "DZD"
            },
            "card_discount": {
              "amount": "0.00",
              "currency": "DZD"
            }
          },
          "note": "Call before coming.",
          "archived": false,
          "scheduled_for": null,
          "livemode": true,
          "created_at": "2026-10-08T13:58:02Z",
          "updated_at": "2026-10-08T14:05:40Z"
        }
      },
      "OrderList": {
        "value": {
          "object": "list",
          "has_more": false,
          "next_cursor": null,
          "data": []
        }
      },
      "Customer": {
        "value": {
          "id": "cus_5d4c3b2a19f84e7d6c5b4a3928170615",
          "object": "customer",
          "name": "Yacine Benali",
          "phone": "+213551234567",
          "email": null,
          "status": "active",
          "tags": [],
          "note": null,
          "orders_count": 3,
          "delivered_count": 2,
          "returned_count": 0,
          "cancelled_count": 1,
          "total_spent": {
            "amount": "11200.00",
            "currency": "DZD"
          },
          "first_order_at": "2026-07-01T09:12:44Z",
          "last_order_at": "2026-10-08T13:58:02Z",
          "livemode": true,
          "created_at": "2026-07-01T09:12:44Z",
          "updated_at": "2026-10-08T14:05:40Z"
        }
      },
      "Shipment": {
        "value": {
          "id": "shp_7a1b2c3d4e5f40718293a4b5c6d7e8f9",
          "object": "shipment",
          "order_id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
          "courier": {
            "id": "cour_3c2b1a09f8e74d6c5b4a39281706f5e4",
            "brand": "zrexpress",
            "account_name": "ZR Express"
          },
          "tracking_code": "43-K7QW2PZ9-ZR",
          "status": "in_transit",
          "stage": "out_for_delivery",
          "stage_changed_at": "2026-10-12T08:41:10Z",
          "status_detail": "En livraison — Livreur : Karim",
          "cod": {
            "status": null,
            "settled_at": null
          },
          "return_status": null,
          "driver": {
            "name": "Karim",
            "phone": "+213661234567"
          },
          "events": [
            {
              "at": "2026-10-11 16:02:11",
              "label": "Colis créé",
              "kind": null
            },
            {
              "at": "2026-10-12 08:41:10",
              "label": "En livraison",
              "kind": null
            }
          ],
          "failure_message": null,
          "validated_at": "2026-10-11T16:30:00Z",
          "sent_at": "2026-10-11T16:02:09Z",
          "created_at": "2026-10-11T16:02:09Z",
          "updated_at": "2026-10-12T08:41:10Z",
          "livemode": true
        }
      },
      "InventoryLevel": {
        "value": {
          "object": "inventory_level",
          "variant_id": "var_2f0e1d3c4b5a49688776655443322110",
          "product_id": "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
          "product_title": "Linen shirt",
          "variant_title": "M",
          "sku": "LIN-M",
          "barcode": null,
          "tracked": true,
          "available": 12,
          "committed": 3,
          "on_hand": 15,
          "incoming": 24,
          "incoming_due_at": "2026-10-20T00:00:00Z",
          "at_courier": 0,
          "on_shelf": 12,
          "low_stock": false,
          "allow_backorder": false,
          "allow_preorder": true,
          "sold_30d": 31,
          "days_of_cover": 11.6,
          "livemode": true
        }
      },
      "StockCount": {
        "value": {
          "id": "cnt_1b2c3d4e5f6a47b8c9d0e1f2a3b4c5d6",
          "object": "stock_count",
          "name": "Shelf A, October",
          "status": "open",
          "note": null,
          "lines_total": 2,
          "lines_counted": 1,
          "created_at": "2026-10-12T09:00:00Z",
          "applied_at": null,
          "livemode": true,
          "lines": [
            {
              "variant_id": "var_2f0e1d3c4b5a49688776655443322110",
              "product_title": "Linen shirt",
              "variant_title": "M",
              "sku": "LIN-M",
              "barcode": null,
              "expected": 12,
              "counted": 11,
              "current": 12,
              "variance": -1
            },
            {
              "variant_id": "var_3a0e1d3c4b5a49688776655443322111",
              "product_title": "Linen shirt",
              "variant_title": "L",
              "sku": "LIN-L",
              "barcode": null,
              "expected": 6,
              "counted": null,
              "current": 6,
              "variance": null
            }
          ],
          "lines_has_more": false
        }
      },
      "AbandonedCheckout": {
        "value": {
          "id": "chk_1f2e3d4c5b6a47980a1b2c3d4e5f6a7b",
          "object": "abandoned_checkout",
          "status": "open",
          "customer": {
            "name": "Yacine Benali",
            "phone": "+213551234567",
            "email": null
          },
          "shipping_address": {
            "country": "DZ",
            "region": {
              "code": "16",
              "name": "Algiers"
            },
            "city": {
              "code": null,
              "name": "Bab El Oued"
            },
            "address1": null
          },
          "note": null,
          "line_items": [
            {
              "product_id": "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
              "variant_id": "var_2f0e1d3c4b5a49688776655443322110",
              "title": "Linen shirt",
              "variant_title": "M",
              "image_url": null,
              "quantity": 1,
              "unit_price": {
                "amount": "3500.00",
                "currency": "DZD"
              }
            }
          ],
          "subtotal": {
            "amount": "3500.00",
            "currency": "DZD"
          },
          "total": {
            "amount": "4100.00",
            "currency": "DZD"
          },
          "delivery": {
            "mode": "home",
            "label": "Door delivery"
          },
          "order_id": null,
          "assigned_to": null,
          "source": "facebook",
          "recovered_at": null,
          "created_at": "2026-10-12T09:14:00Z",
          "updated_at": "2026-10-12T09:15:12Z",
          "livemode": true
        }
      },
      "Collection": {
        "value": {
          "id": "col_1a2b3c4d5e6f47a8b9c0d1e2f3a4b5c6",
          "object": "collection",
          "title": "Summer sale",
          "handle": "summer-sale",
          "description": null,
          "image_url": null,
          "status": "active",
          "kind": "smart",
          "rules": [
            {
              "field": "tag",
              "op": "eq",
              "value": "summer"
            }
          ],
          "rules_match": "all",
          "sort_mode": "manual",
          "position": 0,
          "product_count": 14,
          "seo": {
            "title": null,
            "description": null
          },
          "livemode": true,
          "created_at": "2026-10-12T09:00:00Z",
          "updated_at": "2026-10-12T09:00:00Z"
        }
      },
      "Review": {
        "value": {
          "id": "rev_4d5e6f7a8b9c40d1e2f3a4b5c6d7e8f9",
          "object": "review",
          "product_id": "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
          "rating": 5,
          "title": null,
          "body": "Great quality, fast delivery.",
          "author_name": "Samira",
          "status": "published",
          "source": "merchant",
          "published_at": "2026-10-12T09:05:00Z",
          "created_at": "2026-10-12T09:05:00Z",
          "livemode": true
        }
      },
      "Offer": {
        "value": {
          "id": "ofr_2b3c4d5e6f7a48b9c0d1e2f3a4b5c6d7",
          "object": "offer",
          "type": "upsell",
          "name": "Buy more, save more",
          "status": "active",
          "state": "active",
          "starts_at": null,
          "ends_at": null,
          "show_countdown": false,
          "discount": null,
          "free_shipping": false,
          "product_ids": [
            "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21"
          ],
          "variant_ids": null,
          "tiers": [
            {
              "quantity": 1,
              "discount": null,
              "free_shipping": false,
              "label": null,
              "badge": null,
              "image_url": null
            },
            {
              "quantity": 2,
              "discount": {
                "type": "percent",
                "value": "10"
              },
              "free_shipping": false,
              "label": null,
              "badge": "POPULAR",
              "image_url": null
            }
          ],
          "cross_sell": null,
          "created_at": "2026-10-12T09:00:00Z",
          "updated_at": "2026-10-12T09:00:00Z",
          "livemode": true
        }
      },
      "Discount": {
        "value": {
          "id": "dsc_5d6e7f8a9b0c41d2e3f4a5b6c7d8e9f0",
          "object": "discount",
          "name": "Ramadan",
          "code": "RAMADAN10",
          "kind": "code",
          "discount": {
            "type": "percent",
            "value": "10"
          },
          "applies_to": "store",
          "product_ids": [],
          "collection_ids": [],
          "starts_at": null,
          "ends_at": null,
          "usage_limit": 500,
          "per_customer_limit": 1,
          "times_used": 37,
          "status": "active",
          "state": "active",
          "created_at": "2026-10-12T09:00:00Z",
          "updated_at": "2026-10-12T09:00:00Z",
          "livemode": true
        }
      },
      "Return": {
        "value": {
          "object": "return",
          "order_id": "ord_9b8c7d6e5f4a43b2a1c0d9e8f7a6b5c4",
          "order_number": "ORD-00042",
          "kind": "return",
          "stage": "received",
          "ready": true,
          "ready_at": "2026-10-10T09:00:00Z",
          "returned_at": "2026-10-09T16:20:00Z",
          "received_at": "2026-10-11T11:05:00Z",
          "original_order_id": null,
          "customer": {
            "name": "Samira B.",
            "phone": "+213551234567"
          },
          "courier": "yalidine",
          "tracking_code": "YAL-58213",
          "courier_status": "Retourné au vendeur",
          "total": {
            "amount": "4300.00",
            "currency": "DZD"
          },
          "items": [
            {
              "id": "li_1a2b3c4d5e6f47a8b9c0d1e2f3a4b5c6",
              "product_id": "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
              "variant_id": "var_3c4d5e6f7a8b49c0d1e2f3a4b5c6d7e8",
              "title": "Oversized hoodie",
              "variant_title": "Black / M",
              "quantity": 2,
              "image_url": null,
              "tracks_stock": true,
              "checked_in": false
            }
          ],
          "livemode": true
        }
      },
      "Payout": {
        "value": {
          "id": "pay_6f7a8b9c0d1e42f3a4b5c6d7e8f9a0b1",
          "object": "payout",
          "courier": "yalidine",
          "reference": "VIR-2026-1012",
          "payout_date": "2026-10-12",
          "amount_received": {
            "amount": "158400.00",
            "currency": "DZD"
          },
          "expected": {
            "amount": "158400.00",
            "currency": "DZD"
          },
          "difference": {
            "amount": "0.00",
            "currency": "DZD"
          },
          "orders_count": 37,
          "notes": null,
          "created_at": "2026-10-12T09:00:00Z",
          "livemode": true
        }
      },
      "ProductImage": {
        "value": {
          "id": "img_7a8b9c0d1e2f43a4b5c6d7e8f9a0b1c2",
          "object": "product_image",
          "product_id": "prod_8a7b6c5d4e3f42019a8b7c6d5e4f3a21",
          "url": "https://cdn.ordexs.com/52cac290-122d-4890-91f6-4df771b29e1a/products/0a1b2c3d-4e5f-46a7-b8c9-d0e1f2a3b4c5-1920.webp",
          "alt": "Black oversized hoodie",
          "position": 1,
          "media_id": "med_1b2c3d4e5f6a47b8c9d0e1f2a3b4c5d6",
          "created_at": "2026-10-12T09:00:00Z"
        }
      },
      "ShipmentCancelled": {
        "value": {
          "id": "shp_7a1b2c3d4e5f40718293a4b5c6d7e8f9",
          "object": "shipment",
          "order_id": "ord_9b1c2d3e4f5a4b6c8d7e6f5a4b3c2d1e",
          "courier": {
            "id": "cour_3c2b1a09f8e74d6c5b4a39281706f5e4",
            "brand": "zrexpress",
            "account_name": "ZR Express"
          },
          "tracking_code": "43-K7QW2PZ9-ZR",
          "status": "cancelled",
          "stage": "deleted",
          "stage_changed_at": "2026-10-11T16:20:00Z",
          "status_detail": null,
          "cod": {
            "status": null,
            "settled_at": null
          },
          "return_status": null,
          "driver": null,
          "events": [],
          "failure_message": null,
          "validated_at": null,
          "sent_at": "2026-10-11T16:02:09Z",
          "created_at": "2026-10-11T16:02:09Z",
          "updated_at": "2026-10-11T16:20:00Z",
          "livemode": true
        }
      },
      "ShipmentList": {
        "value": {
          "object": "list",
          "has_more": false,
          "next_cursor": null,
          "data": []
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Something went wrong. The body always has the same shape.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "insufficient_scope": {
                "value": {
                  "error": {
                    "code": "insufficient_scope",
                    "message": "This API key does not have the \"orders:write\" permission. Edit the key's permissions under Settings → Developers, or use a key that has it.",
                    "details": {
                      "required_scope": "orders:write"
                    },
                    "request_id": "req_7f3a9c2e41b84d0c9a1e5f6b"
                  }
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "request_id"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable, machine-readable error code. Branch on this, never on `message`."
              },
              "message": {
                "type": "string",
                "description": "A plain-English sentence that says what went wrong and what to do about it."
              },
              "details": {
                "type": "object",
                "additionalProperties": true,
                "description": "Extra structured information, for example the fields that failed validation."
              },
              "request_id": {
                "type": "string",
                "description": "Quote this when you contact support."
              }
            }
          }
        }
      },
      "Currency": {
        "type": "object",
        "required": [
          "code",
          "exponent"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[A-Z]{3}$",
            "description": "ISO 4217 currency code."
          },
          "exponent": {
            "type": "integer",
            "description": "Number of decimals every amount in this currency has (DZD 2, TND 3)."
          }
        }
      },
      "Store": {
        "type": "object",
        "required": [
          "id",
          "object",
          "name",
          "country",
          "currency",
          "livemode",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^sto_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "store"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": [
              "string",
              "null"
            ],
            "description": "The store's address on ordexs.com. `null` in test mode."
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The public storefront. `null` in test mode."
          },
          "country": {
            "type": "string",
            "pattern": "^[A-Z]{2}$",
            "description": "ISO 3166-1 alpha-2 country the store sells in."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "plan": {
            "type": "string",
            "enum": [
              "starter",
              "growth",
              "scale"
            ],
            "description": "The store's Ordexs plan. Decides rate limits."
          },
          "language": {
            "type": "string",
            "enum": [
              "ar",
              "ar-ltr",
              "fr",
              "en"
            ],
            "description": "The storefront language."
          },
          "timezone": {
            "type": "string"
          },
          "order_prefix": {
            "type": "string",
            "description": "The start of order numbers, as in ORD-00042."
          },
          "contact": {
            "type": "object",
            "properties": {
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "address": {
            "type": "object",
            "properties": {
              "region": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "street": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "livemode": {
            "type": "boolean",
            "description": "`false` when the request was made with a test key."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Money": {
        "type": "object",
        "required": [
          "amount",
          "currency"
        ],
        "description": "An amount of money. `amount` is a decimal STRING with exactly the\ncurrency's number of decimals (\"1250.00\" in DZD, \"12.500\" in TND) —\nnever parse it into a float.\n",
        "properties": {
          "amount": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        }
      },
      "ListEnvelope": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` to get the next page. `null` on the last page."
          }
        }
      },
      "Variant": {
        "type": "object",
        "required": [
          "id",
          "object",
          "product_id",
          "title",
          "options",
          "price",
          "inventory_quantity",
          "livemode",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^var_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "variant"
          },
          "product_id": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "description": "The option values joined, e.g. \"Black / M\". \"Default\" for a product without options."
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Option name → value."
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "price": {
            "$ref": "#/components/schemas/Money"
          },
          "compare_at_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ]
          },
          "cost": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only present when the key has the `products:read_costs` scope."
          },
          "inventory_quantity": {
            "type": "integer",
            "description": "Units in stock. Negative when units are owed to pre-orders."
          },
          "inventory_tracked": {
            "type": "boolean"
          },
          "incoming_quantity": {
            "type": "integer",
            "description": "Units on their way from a supplier."
          },
          "incoming_due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the incoming delivery is expected."
          },
          "allow_preorder": {
            "type": "boolean",
            "description": "Orderable past zero",
            "up to the incoming delivery. Set on the product.": null
          },
          "allow_backorder": {
            "type": "boolean",
            "description": "Orderable past zero without limit; the merchant owes the units."
          },
          "at_courier": {
            "type": "integer",
            "description": "Units kept at the courier's warehouse."
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Product": {
        "type": "object",
        "required": [
          "id",
          "object",
          "title",
          "handle",
          "status",
          "options",
          "variants",
          "images",
          "livemode",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^prod_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "product"
          },
          "title": {
            "type": "string"
          },
          "handle": {
            "type": "string",
            "description": "The product's address in the storefront."
          },
          "description_html": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published",
              "archived"
            ]
          },
          "product_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendor": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "weight_grams": {
            "type": [
              "integer",
              "null"
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "description": "How the option is shown, e.g. color, size or text."
                },
                "values": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Variant"
            }
          },
          "images": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^img_[0-9a-f]{32}$"
                },
                "url": {
                  "type": "string"
                },
                "alt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "position": {
                  "type": "integer"
                }
              }
            }
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The product's page in the storefront. Null while it isn't published, and in test mode."
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Also moves when a variant's stock or price changes."
          }
        }
      },
      "ProductList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          }
        ]
      },
      "OrderStatus": {
        "type": "string",
        "description": "`pending` → `confirmed` → (with a courier) `shipped` → `delivered` or\n`returned`. `scheduled`, `attempt_1`…`attempt_3`, `double`, `waiting`\nand `cancelled` are set by the merchant's team; `preparing`, `shipped`,\n`delivered`, `returned` and `deleted` come from the courier. New values\nmay be added — treat an unknown one like `pending`.\n",
        "enum": [
          "pending",
          "confirmed",
          "scheduled",
          "attempt_1",
          "attempt_2",
          "attempt_3",
          "double",
          "waiting",
          "cancelled",
          "preparing",
          "shipped",
          "delivered",
          "returned",
          "deleted"
        ]
      },
      "Address": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "region": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "city": {
            "type": "object",
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          "address1": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Order": {
        "type": "object",
        "required": [
          "id",
          "object",
          "number",
          "status",
          "customer",
          "shipping_address",
          "line_items",
          "subtotal",
          "shipping",
          "total",
          "payment",
          "livemode",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ord_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "order"
          },
          "number": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number the merchant uses, e.g. \"ORD-00042\"."
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "source": {
            "type": "string",
            "description": "Where the order came from: storefront, dashboard, api or import."
          },
          "source_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The integration that created it, as it named itself in source_name."
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The id the integration gave this order."
          },
          "needs_review": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the merchant must check this order before it can go to a courier. city_unmatched — the city was not recognised. null when nothing needs checking."
          },
          "preorder": {
            "type": "boolean",
            "description": "Marked as a pre-order (the goods are on their way to the merchant)."
          },
          "assigned_to": {
            "type": [
              "object",
              "null"
            ],
            "description": "The teammate working this order.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "type": {
            "type": "string",
            "enum": [
              "delivery",
              "exchange",
              "pickup",
              "cash_collection"
            ],
            "description": "See OrderCreate.type. New values may be added."
          },
          "exchange_of": {
            "type": [
              "string",
              "null"
            ],
            "description": "The delivered order this exchange replaces goods from."
          },
          "collect": {
            "type": [
              "object",
              "null"
            ],
            "description": "What the courier takes back, for an exchange or a pickup.",
            "properties": {
              "stage": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Where the collected goods are (pending until they come back)."
              },
              "summary": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The line the courier prints for the goods to collect."
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "original_line_item_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "product_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "variant_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "variant_title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "quantity": {
                      "type": "integer"
                    },
                    "restocked": {
                      "type": "integer",
                      "description": "Units put back into stock when they came back."
                    },
                    "written_off": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Your own key/value pairs, returned as you sent them."
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "E.164."
              },
              "phone_2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "shipping_address": {
            "$ref": "#/components/schemas/Address"
          },
          "delivery": {
            "type": "object",
            "properties": {
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "home",
                  "pickup_point",
                  null
                ]
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "courier": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  }
                }
              },
              "pickup_point": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "tracking_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tracking_url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri",
                "description": "The customer's tracking page for this order, on the store's address (https://<store>.myordexs.com/track/<code>). Send it to the customer: it shows every step of the delivery, in the store's language. Each order has its own private link, and it stays the same if the parcel is sent again. It stops working 3 days after the order is delivered or returned (the page then says the link has expired); a cancelled order has no tracking page. null in test mode."
              },
              "shipped_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "line_items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "product_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "variant_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "variant_title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sku": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "integer"
                },
                "unit_price": {
                  "$ref": "#/components/schemas/Money"
                },
                "total": {
                  "$ref": "#/components/schemas/Money"
                },
                "image_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "discount_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The code the shopper used; null when none",
            "or once that discount is deleted.": null
          },
          "discount_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The name of the discount applied",
            "kept even after the discount is deleted.": null
          },
          "offers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Names of the offers applied."
          },
          "offer_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The offers applied",
            "in the order of offers.": null
          },
          "subtotal": {
            "$ref": "#/components/schemas/Money"
          },
          "shipping": {
            "$ref": "#/components/schemas/Money"
          },
          "discount": {
            "$ref": "#/components/schemas/Money"
          },
          "total": {
            "$ref": "#/components/schemas/Money"
          },
          "payment": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "description": "\"cod\" (cash on delivery), \"card\" (paid in full online by card) or \"card_deposit\" (a deposit paid online by card, the rest in cash on delivery). More methods may be added."
              },
              "status": {
                "type": "string",
                "enum": [
                  "unpaid",
                  "pending",
                  "partially_paid",
                  "paid"
                ],
                "description": "unpaid: nothing received yet. pending: the shopper chose card and has not finished paying. partially_paid: a card deposit was received, the rest is collected on delivery. paid: fully paid (online, or the cash was recorded)."
              },
              "paid_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "amount_paid": {
                "$ref": "#/components/schemas/Money",
                "description": "What the shopper already paid online toward the order."
              },
              "amount_to_collect": {
                "$ref": "#/components/schemas/Money",
                "description": "What the courier collects in cash at delivery: total minus amount_paid."
              },
              "card_discount": {
                "$ref": "#/components/schemas/Money",
                "description": "The store’s discount for paying by card, already included in discount and taken off total. Zero for cash on delivery."
              }
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's note at checkout."
          },
          "archived": {
            "type": "boolean"
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrderList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          }
        ]
      },
      "Author": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "staff",
              "api_key",
              "system"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "OrderNote": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^note_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "order_note"
          },
          "order_id": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "author": {
            "$ref": "#/components/schemas/Author"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrderNoteList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderNote"
                }
              }
            }
          }
        ]
      },
      "OrderHistoryEntry": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "order_history_entry"
          },
          "type": {
            "type": "string",
            "enum": [
              "note",
              "status_change",
              "assignment",
              "courier",
              "export",
              "system"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "to_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor": {
            "$ref": "#/components/schemas/Author"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrderHistoryList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderHistoryEntry"
                }
              }
            }
          }
        ]
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^cus_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "customer"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "E.164."
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "needs_followup",
              "do_not_contact"
            ],
            "description": "do_not_contact: blocked by the merchant."
          },
          "reliability": {
            "type": "object",
            "description": "The delivery score: how likely this customer is to accept a COD parcel, from their delivered, returned and cancelled orders here and (at half weight) at other Ordexs stores.",
            "properties": {
              "score": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 100,
                "description": "Percentage, null with no delivered, returned or cancelled order yet."
              },
              "tier": {
                "type": "string",
                "enum": [
                  "new",
                  "reliable",
                  "uncertain",
                  "risky"
                ],
                "description": "reliable: 75 and up. uncertain: 50-74. risky: under 50. new: no finished orders."
              }
            }
          },
          "whatsapp_opt_in": {
            "type": "boolean"
          },
          "whatsapp_opt_in_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "orders_count": {
            "type": "integer"
          },
          "delivered_count": {
            "type": "integer"
          },
          "returned_count": {
            "type": "integer"
          },
          "cancelled_count": {
            "type": "integer"
          },
          "total_spent": {
            "$ref": "#/components/schemas/Money"
          },
          "first_order_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_order_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CustomerList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          }
        ]
      },
      "AbandonedCheckout": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^chk_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "abandoned_checkout"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "confirmed",
              "recovered",
              "deleted"
            ],
            "description": "open: still abandoned. confirmed / recovered: the team turned it into an order (order_id). deleted: removed by the team, or closed after 30 days without activity. A checkout the shopper finished themselves is deleted outright (see abandoned_checkout.updated)."
          },
          "customer": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": "string"
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "shipping_address": {
            "type": "object",
            "properties": {
              "country": {
                "type": "string"
              },
              "region": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "city": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "code": {
                    "type": "null"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              "address1": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "line_items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "product_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "variant_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "variant_title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "image_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "integer"
                },
                "unit_price": {
                  "$ref": "#/components/schemas/Money"
                }
              }
            }
          },
          "subtotal": {
            "$ref": "#/components/schemas/Money"
          },
          "total": {
            "$ref": "#/components/schemas/Money"
          },
          "delivery": {
            "type": "object",
            "properties": {
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "home",
                  "pickup_point",
                  null
                ]
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The order it became",
            "once confirmed.": null
          },
          "assigned_to": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the shopper came from (an ad",
            "a campaign…).": null
          },
          "recovered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "AbandonedCheckoutList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AbandonedCheckout"
                }
              }
            }
          }
        ]
      },
      "CustomerSegment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^seg_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "customer_segment"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "customer_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CustomerSegmentList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CustomerSegment"
                }
              }
            }
          }
        ]
      },
      "CollectionRule": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "field",
          "op"
        ],
        "description": "One condition. Text fields (title, vendor, product_type, category, status):\neq, neq, contains, not_contains, starts_with, ends_with, is_set,\nis_not_set. tag: eq, neq, contains. Numbers (price, compare_at_price,\ninventory): gt, lt, eq, neq, is_set, is_not_set.\n",
        "properties": {
          "field": {
            "type": "string",
            "enum": [
              "title",
              "vendor",
              "product_type",
              "category",
              "status",
              "tag",
              "price",
              "compare_at_price",
              "inventory"
            ]
          },
          "op": {
            "type": "string",
            "enum": [
              "eq",
              "neq",
              "contains",
              "not_contains",
              "starts_with",
              "ends_with",
              "is_set",
              "is_not_set",
              "gt",
              "lt"
            ]
          },
          "value": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "CollectionWrite": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "handle": {
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "maxLength": 120,
            "description": "The collection's address in the storefront."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 20000
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "draft"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "manual",
              "smart"
            ],
            "description": "manual: product_ids. smart: rules decide."
          },
          "rules": {
            "type": "array",
            "maxItems": 30,
            "items": {
              "$ref": "#/components/schemas/CollectionRule"
            }
          },
          "rules_match": {
            "type": "string",
            "enum": [
              "all",
              "any"
            ]
          },
          "sort_mode": {
            "type": "string",
            "enum": [
              "manual",
              "alpha_asc",
              "alpha_desc",
              "price_asc",
              "price_desc",
              "created_desc",
              "created_asc",
              "best_selling"
            ]
          },
          "product_ids": {
            "type": "array",
            "maxItems": 2000,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          },
          "seo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "title": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 120
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 320
              }
            }
          }
        }
      },
      "Collection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^col_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "collection"
          },
          "title": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "draft"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "manual",
              "smart"
            ]
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CollectionRule"
            }
          },
          "rules_match": {
            "type": "string",
            "enum": [
              "all",
              "any"
            ]
          },
          "sort_mode": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "product_count": {
            "type": "integer"
          },
          "seo": {
            "type": "object",
            "properties": {
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CollectionList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Collection"
                }
              }
            }
          }
        ]
      },
      "CollectionPreview": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "collection_preview"
          },
          "match_count": {
            "type": "integer"
          },
          "sample": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "handle": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "image_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "price": {
                  "$ref": "#/components/schemas/Money"
                }
              }
            }
          }
        }
      },
      "CategoryList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "category"
                    },
                    "name": {
                      "type": "string"
                    },
                    "product_count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Review": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^rev_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "review"
          },
          "product_id": {
            "type": "string"
          },
          "rating": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "body": {
            "type": "string"
          },
          "author_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "published",
              "hidden"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "customer",
              "merchant"
            ]
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "ReviewList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Review"
                }
              }
            }
          }
        ]
      },
      "ReviewSettings": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "review_settings"
          },
          "auto_publish": {
            "type": "boolean"
          }
        }
      },
      "DiscountValue": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "value"
        ],
        "description": "percent: value is a percentage up to 90 (\"10\", \"12.5\"). fixed: value is an amount in the store's currency (\"500.00\").",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "percent",
              "fixed"
            ]
          },
          "value": {
            "type": "string",
            "pattern": "^[0-9]{1,10}(\\.[0-9]{1,3})?$"
          }
        }
      },
      "OfferTier": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "quantity"
        ],
        "properties": {
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999
          },
          "discount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DiscountValue"
              },
              {
                "type": "null"
              }
            ],
            "description": "The pack's price break; null or left out for the regular price."
          },
          "free_shipping": {
            "type": "boolean",
            "default": false
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40,
            "description": "Left out: \"N ×\"."
          },
          "badge": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 20,
            "description": "Such as POPULAR or BEST VALUE."
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "Left out: the product's image."
          }
        }
      },
      "OfferCrossSell": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "trigger_scope": {
            "type": "string",
            "enum": [
              "products",
              "collection",
              "all"
            ],
            "description": "What arms it: carts holding trigger_product_ids, a product of trigger_collection_ids, or every cart."
          },
          "trigger_product_ids": {
            "type": "array",
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          },
          "trigger_collection_ids": {
            "type": "array",
            "maxItems": 50,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^col_[0-9a-f]{32}$"
            }
          },
          "suggested_product_ids": {
            "type": "array",
            "maxItems": 50,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          },
          "placements": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "order_button",
                "summary",
                "checkout_summary",
                "cart",
                "post_purchase"
              ]
            }
          },
          "priority": {
            "type": "integer",
            "minimum": -1000,
            "maximum": 1000,
            "description": "Higher shows first when several apply."
          },
          "max_items": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 8
          },
          "auto_fill": {
            "type": "boolean",
            "description": "Fill the suggestions with the store's best sellers when suggested_product_ids is short."
          }
        }
      },
      "OfferWrite": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "bundle",
              "upsell",
              "cross_sell"
            ],
            "description": "Required to create; can't change after."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "show_countdown": {
            "type": "boolean",
            "description": "Show a countdown to ends_at. Needs ends_at."
          },
          "discount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DiscountValue"
              },
              {
                "type": "null"
              }
            ],
            "description": "Bundles and cross-sells. Upsells set theirs per pack."
          },
          "free_shipping": {
            "type": "boolean",
            "description": "Bundles and cross-sells."
          },
          "product_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            },
            "description": "Bundle: 2 or more. Upsell: exactly 1."
          },
          "variant_ids": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^var_[0-9a-f]{32}$"
            },
            "description": "Upsell: only these variants of the product count. null: all of them."
          },
          "tiers": {
            "type": "array",
            "minItems": 1,
            "maxItems": 6,
            "items": {
              "$ref": "#/components/schemas/OfferTier"
            },
            "description": "Upsell: the packs; at least one must have a discount."
          },
          "cross_sell": {
            "$ref": "#/components/schemas/OfferCrossSell"
          }
        }
      },
      "Offer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ofr_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "offer"
          },
          "type": {
            "type": "string",
            "enum": [
              "bundle",
              "upsell",
              "cross_sell"
            ]
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "scheduled",
              "expired",
              "paused"
            ],
            "description": "Where the offer is in its schedule now."
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "show_countdown": {
            "type": "boolean"
          },
          "discount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DiscountValue"
              },
              {
                "type": "null"
              }
            ]
          },
          "free_shipping": {
            "type": "boolean"
          },
          "product_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "variant_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "tiers": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/OfferTier"
            }
          },
          "cross_sell": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OfferCrossSell"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "OfferList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Offer"
                }
              }
            }
          }
        ]
      },
      "OfferPerformance": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "offer_performance"
          },
          "offer_id": {
            "type": "string"
          },
          "orders_count": {
            "type": "integer"
          },
          "revenue": {
            "$ref": "#/components/schemas/Money"
          },
          "discount_given": {
            "$ref": "#/components/schemas/Money"
          },
          "last_order_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "DiscountWrite": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{2,19}$",
            "description": "Stored in capitals. null makes it an automatic discount."
          },
          "discount": {
            "$ref": "#/components/schemas/DiscountValue"
          },
          "applies_to": {
            "type": "string",
            "enum": [
              "store",
              "collection",
              "product"
            ]
          },
          "product_ids": {
            "type": "array",
            "maxItems": 500,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          },
          "collection_ids": {
            "type": "array",
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^col_[0-9a-f]{32}$"
            }
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "usage_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "Total uses across all shoppers."
          },
          "per_customer_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          }
        }
      },
      "Discount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^dsc_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "discount"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "code",
              "automatic"
            ]
          },
          "discount": {
            "$ref": "#/components/schemas/DiscountValue"
          },
          "applies_to": {
            "type": "string",
            "enum": [
              "store",
              "collection",
              "product"
            ]
          },
          "product_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "collection_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "usage_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "per_customer_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "times_used": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "scheduled",
              "expired",
              "used_up",
              "paused"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "DiscountList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Discount"
                }
              }
            }
          }
        ]
      },
      "DiscountPreview": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "discount_preview"
          },
          "code": {
            "type": "string"
          },
          "valid": {
            "type": "boolean"
          },
          "discount_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Return": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "return"
          },
          "order_id": {
            "type": "string"
          },
          "order_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "return",
              "exchange"
            ],
            "description": "exchange: the items an exchange order collected from the customer."
          },
          "stage": {
            "type": "string",
            "enum": [
              "in_transit",
              "received"
            ]
          },
          "ready": {
            "type": "boolean",
            "description": "The courier has the parcel waiting to be picked up."
          },
          "ready_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "returned_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "received_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "original_order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "For an exchange",
            "the order it replaced.": null
          },
          "customer": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "courier": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracking_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "courier_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "The courier's own words for the parcel's state."
          },
          "total": {
            "$ref": "#/components/schemas/Money"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "li_… for a return, xli_… for an exchange. Pass it to check_in."
                },
                "product_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "variant_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "variant_title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "integer"
                },
                "image_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tracks_stock": {
                  "type": "boolean",
                  "description": "false when the variant doesn't track stock (restocking it moves nothing)."
                },
                "checked_in": {
                  "type": "boolean"
                }
              }
            }
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "ReturnList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Return"
                }
              },
              "counts": {
                "type": "object",
                "description": "As the Returns badge counts them.",
                "properties": {
                  "received": {
                    "type": "integer",
                    "description": "Back in hand or ready to pick up."
                  },
                  "in_transit": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        ]
      },
      "ReturnCheckIn": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "return_check_in"
          },
          "returns": {
            "type": "integer"
          },
          "completed": {
            "type": "integer",
            "description": "Returns with every item now checked in."
          },
          "restocked": {
            "type": "integer"
          },
          "written_off": {
            "type": "integer"
          },
          "courier": {
            "type": "object",
            "description": "What the couriers said when told the parcels arrived (only couriers that ask for it).",
            "properties": {
              "confirmed": {
                "type": "integer"
              },
              "not_eligible": {
                "type": "integer"
              },
              "not_found": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "CodBalanceList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "cod_balance"
                    },
                    "courier": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "outstanding": {
                      "type": "object",
                      "properties": {
                        "orders_count": {
                          "type": "integer"
                        },
                        "amount": {
                          "$ref": "#/components/schemas/Money"
                        }
                      }
                    },
                    "paid": {
                      "type": "object",
                      "properties": {
                        "payouts_count": {
                          "type": "integer"
                        },
                        "received": {
                          "$ref": "#/components/schemas/Money"
                        },
                        "expected": {
                          "$ref": "#/components/schemas/Money"
                        },
                        "difference": {
                          "$ref": "#/components/schemas/Money"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "CodOrderList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "cod_order"
                    },
                    "order_id": {
                      "type": "string"
                    },
                    "order_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "courier": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "tracking_code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "$ref": "#/components/schemas/Money"
                    },
                    "payout_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Payout": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^pay_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "payout"
          },
          "courier": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "payout_date": {
            "type": "string",
            "format": "date"
          },
          "amount_received": {
            "$ref": "#/components/schemas/Money"
          },
          "expected": {
            "$ref": "#/components/schemas/Money"
          },
          "difference": {
            "$ref": "#/components/schemas/Money"
          },
          "orders_count": {
            "type": "integer"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "PayoutList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Payout"
                }
              }
            }
          }
        ]
      },
      "ProductImage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^img_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "product_image"
          },
          "product_id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "The largest size. The others are the same address ending in -320, -640 and -1024 instead of -1920."
          },
          "alt": {
            "type": [
              "string",
              "null"
            ]
          },
          "position": {
            "type": "integer",
            "description": "0 is the main image."
          },
          "media_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file in the media library."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Upload": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "upload"
          },
          "id": {
            "type": "string",
            "pattern": "^upl_[0-9a-f]{32}$"
          },
          "upload_url": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "const": "PUT"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "max_bytes": {
            "type": "integer"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Media": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^med_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "media"
          },
          "type": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "document"
            ]
          },
          "mime_type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "file_name": {
            "type": "string"
          },
          "alt": {
            "type": [
              "string",
              "null"
            ]
          },
          "bytes": {
            "type": "integer"
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "sizes": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "The WebP widths stored for an image."
          },
          "duration_seconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "poster_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "in_use": {
            "type": "boolean",
            "description": "Shown somewhere on the store."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MediaList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Media"
                }
              }
            }
          }
        ]
      },
      "Courier": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^cour_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "courier"
          },
          "brand": {
            "type": "string"
          },
          "account_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "default": {
            "type": "boolean",
            "description": "Ships orders no rule routes elsewhere."
          },
          "connection_ok": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "The last connection test's result."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CourierList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Courier"
                }
              }
            }
          }
        ]
      },
      "DeliverySettings": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "delivery_settings"
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether checkout asks for a delivery option at all."
          },
          "strategy": {
            "type": "string",
            "enum": [
              "flat",
              "customer_choice",
              "cheapest"
            ]
          },
          "modes": {
            "type": "object",
            "properties": {
              "home": {
                "type": "boolean"
              },
              "pickup_point": {
                "type": "boolean"
              }
            }
          },
          "labels": {
            "type": "object",
            "properties": {
              "home": {
                "type": "string"
              },
              "pickup_point": {
                "type": "string"
              }
            }
          },
          "courier_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The couriers whose live rates are used (customer_choice and cheapest)."
          },
          "fallback_to_flat_prices": {
            "type": "boolean",
            "description": "Use the store's prices where a courier has no rate for a region."
          },
          "default_courier_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DeliverySettingsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "strategy": {
            "type": "string",
            "enum": [
              "flat",
              "customer_choice",
              "cheapest"
            ]
          },
          "modes": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "home": {
                "type": "boolean"
              },
              "pickup_point": {
                "type": "boolean"
              }
            }
          },
          "labels": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "home": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "pickup_point": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              }
            }
          },
          "courier_ids": {
            "type": "array",
            "maxItems": 20,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^cour_[0-9a-f]{32}$"
            }
          },
          "fallback_to_flat_prices": {
            "type": "boolean"
          },
          "default_courier_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^cour_[0-9a-f]{32}$"
          }
        }
      },
      "DeliveryPriceList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "country": {
                "type": "string"
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "delivery_price"
                    },
                    "region": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "home": {
                      "$ref": "#/components/schemas/Money"
                    },
                    "pickup_point": {
                      "$ref": "#/components/schemas/Money"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "RoutingRuleWrite": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "courier_id": {
            "type": "string",
            "pattern": "^cour_[0-9a-f]{32}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "region",
              "product",
              "weight"
            ]
          },
          "regions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "maxLength": 10
            }
          },
          "product_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^prod_[0-9a-f]{32}$"
            }
          },
          "weight_min_grams": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "weight_max_grams": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "null for no upper limit."
          }
        }
      },
      "RoutingRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^rul_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "routing_rule"
          },
          "courier_id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "region",
              "product",
              "weight"
            ]
          },
          "regions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "product_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "weight_min_grams": {
            "type": [
              "integer",
              "null"
            ]
          },
          "weight_max_grams": {
            "type": [
              "integer",
              "null"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RoutingRuleList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RoutingRule"
                }
              }
            }
          }
        ]
      },
      "AnalyticsOverview": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "analytics_overview"
          },
          "period": {
            "type": "object"
          },
          "summary": {
            "type": "object",
            "properties": {
              "orders": {
                "type": "integer"
              },
              "orders_change_percent": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Against the period before. null when there is nothing to compare with."
              },
              "revenue": {
                "$ref": "#/components/schemas/Money"
              },
              "revenue_change_percent": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "visits": {
                "type": "integer",
                "description": "Storefront visits."
              },
              "visits_change_percent": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "conversion_rate": {
                "type": "number",
                "description": "Orders per 100 visits."
              },
              "visitors_now": {
                "type": "integer",
                "description": "On the storefront in the last 5 minutes."
              }
            }
          },
          "series": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "pipeline": {
            "type": "object",
            "description": "How far this period's orders got. confirmed and shipped count every order that reached that step or went past it."
          },
          "cash": {
            "type": [
              "object",
              "null"
            ],
            "description": "Where the money of this period's orders stands now."
          },
          "couriers": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "top_products": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "top_regions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "open_orders": {
            "type": "object"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "AnalyticsCustomers": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "analytics_customers"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "buyers_count": {
            "type": "integer"
          },
          "reliability": {
            "type": "object"
          },
          "months": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "top_customers": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "at_risk": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Customers who spent a lot and haven't ordered for a while."
          },
          "regions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "repeat_timing": {
            "type": "object"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "AnalyticsTeam": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "analytics_team"
          },
          "days": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "member": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  }
                },
                "confirmed": {
                  "type": "integer"
                },
                "assigned": {
                  "type": "integer"
                },
                "delivered": {
                  "type": "integer"
                },
                "delivery_rate": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "Policy": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "policy"
          },
          "kind": {
            "type": "string",
            "enum": [
              "returns",
              "shipping",
              "terms",
              "privacy"
            ]
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "published": {
            "type": "boolean"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PolicyList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Policy"
                }
              }
            }
          }
        ]
      },
      "PageWrite": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "handle": {
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "maxLength": 80
          },
          "status": {
            "type": "string",
            "enum": [
              "published",
              "draft"
            ]
          },
          "body": {
            "type": "string",
            "maxLength": 60000
          },
          "show_in_footer": {
            "type": "boolean"
          },
          "seo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "title": {
                "type": "string",
                "maxLength": 160
              },
              "description": {
                "type": "string",
                "maxLength": 320
              }
            }
          }
        }
      },
      "Page": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^pag_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "page"
          },
          "kind": {
            "type": "string",
            "enum": [
              "content",
              "landing"
            ]
          },
          "title": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "published",
              "draft"
            ]
          },
          "body": {
            "type": [
              "string",
              "null"
            ],
            "description": "Content pages only."
          },
          "product_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "What a landing page sells."
          },
          "offer_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "seo": {
            "type": "object"
          },
          "show_in_footer": {
            "type": "boolean"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "PageList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          }
        ]
      },
      "OrderForm": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "order_form"
          },
          "enabled": {
            "type": "boolean"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "buttons": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "general": {
            "type": "object"
          }
        }
      },
      "PixelWrite": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "meta",
              "tiktok",
              "google",
              "snapchat",
              "pinterest",
              "custom"
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 60
          },
          "pixel_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "enabled": {
            "type": "boolean"
          },
          "default": {
            "type": "boolean"
          },
          "test_event_code": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 60,
            "description": "The provider's test code while you check events arrive."
          },
          "config": {
            "type": "object",
            "description": "Provider extras, such as a Google conversion label."
          }
        }
      },
      "Pixel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^pix_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "pixel"
          },
          "provider": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "pixel_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "default": {
            "type": "boolean"
          },
          "test_event_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "config": {
            "type": "object"
          },
          "has_server_token": {
            "type": "boolean",
            "description": "Whether a Conversions API token was set in the dashboard. The token itself is never returned."
          },
          "last_event_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PixelList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Pixel"
                }
              }
            }
          }
        ]
      },
      "BulkJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^blk_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "bulk_job"
          },
          "kind": {
            "type": "string",
            "enum": [
              "orders.create",
              "orders.update",
              "products.create",
              "products.update",
              "inventory.adjust"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "cancelled"
            ]
          },
          "total": {
            "type": "integer"
          },
          "processed": {
            "type": "integer"
          },
          "succeeded": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the job and its results are deleted."
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "BulkJobList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BulkJob"
                }
              }
            }
          }
        ]
      },
      "BulkResultList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "line": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "claimed",
                        "done"
                      ]
                    },
                    "ok": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "status": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "TeamMember": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^mem_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "team_member"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "can_be_assigned": {
            "type": "boolean",
            "description": "Can see and edit the Orders page",
            "so orders can be assigned to them.": null
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "TeamMemberList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TeamMember"
                }
              }
            }
          }
        ]
      },
      "OrderBulkResult": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "changed": {
                "type": "integer",
                "description": "How many orders actually changed."
              },
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          }
        ]
      },
      "ContactOutcome": {
        "type": "string",
        "enum": [
          "answered",
          "no_answer",
          "busy",
          "rejected",
          "wrong_number",
          "callback_later"
        ]
      },
      "Contact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^con_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "contact"
          },
          "order_id": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "call",
              "sms",
              "whatsapp"
            ]
          },
          "outcome": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ContactOutcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_seconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "actor": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "user",
                  "api_key",
                  "system"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "ContactList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          }
        ]
      },
      "InventoryReason": {
        "type": "string",
        "description": "Why stock moved. Set by you: restock, manual_adjust, correction. Set by\nOrdexs: initial (first stock), sale (an order took units),\norder_cancelled, order_returned, exchange_returned, order_reopened,\norder_deleted, order_edited. New values may be added.\n",
        "enum": [
          "initial",
          "sale",
          "restock",
          "manual_adjust",
          "correction",
          "order_cancelled",
          "order_returned",
          "exchange_returned",
          "order_reopened",
          "order_deleted",
          "order_edited"
        ]
      },
      "InventoryLevel": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "inventory_level"
          },
          "variant_id": {
            "type": "string",
            "pattern": "^var_[0-9a-f]{32}$"
          },
          "product_id": {
            "type": "string",
            "pattern": "^prod_[0-9a-f]{32}$"
          },
          "product_title": {
            "type": "string"
          },
          "variant_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracked": {
            "type": "boolean",
            "description": "Whether the store counts this variant's stock. Untracked variants are always orderable."
          },
          "available": {
            "type": "integer",
            "description": "What can still be ordered. Negative when pre-orders or back-orders took more than the shelf holds."
          },
          "committed": {
            "type": "integer",
            "description": "Units taken by orders not yet with a courier."
          },
          "on_hand": {
            "type": "integer",
            "description": "available + committed: what should physically be in the store."
          },
          "incoming": {
            "type": "integer",
            "description": "Units of a delivery on its way."
          },
          "incoming_due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "at_courier": {
            "type": "integer",
            "description": "Units the merchant keeps at the courier's warehouse."
          },
          "on_shelf": {
            "type": "integer",
            "description": "Available units in the merchant's own place."
          },
          "low_stock": {
            "type": "boolean",
            "description": "At or under the store's alert level."
          },
          "allow_backorder": {
            "type": "boolean"
          },
          "allow_preorder": {
            "type": "boolean"
          },
          "sold_30d": {
            "type": "integer",
            "description": "Units sold in the last 30 days."
          },
          "days_of_cover": {
            "type": [
              "number",
              "null"
            ],
            "description": "How many days the stock lasts at the 30-day pace. null when nothing sold."
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "InventoryLevelList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InventoryLevel"
                }
              }
            }
          }
        ]
      },
      "InventoryAdjustment": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "lines"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "restock",
              "manual_adjust",
              "correction"
            ],
            "default": "manual_adjust",
            "description": "restock: new units arrived. correction: the count was wrong. manual_adjust: anything else."
          },
          "note": {
            "type": "string",
            "maxLength": 500,
            "description": "Shown in the stock history."
          },
          "lines": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "variant_id"
              ],
              "properties": {
                "variant_id": {
                  "type": "string",
                  "pattern": "^var_[0-9a-f]{32}$"
                },
                "delta": {
                  "type": "integer",
                  "minimum": -1000000,
                  "maximum": 1000000,
                  "description": "Units to add (positive) or remove (negative)."
                },
                "set": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 1000000,
                  "description": "The new count. Send delta or set",
                  "not both.": null
                }
              },
              "oneOf": [
                {
                  "required": [
                    "delta"
                  ]
                },
                {
                  "required": [
                    "set"
                  ]
                }
              ]
            }
          }
        }
      },
      "InventoryMovement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^mov_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "inventory_movement"
          },
          "variant_id": {
            "type": "string"
          },
          "product_id": {
            "type": "string"
          },
          "delta": {
            "type": "integer"
          },
          "balance_after": {
            "type": "integer",
            "description": "Available stock right after this movement."
          },
          "reason": {
            "$ref": "#/components/schemas/InventoryReason"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The order that caused it",
            "for order-driven movements.": null
          },
          "actor": {
            "type": "object",
            "description": "Who moved the stock.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "user",
                  "api_key",
                  "system"
                ]
              },
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The API key",
                "when type is api_key.": null
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          }
        }
      },
      "InventoryMovementList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InventoryMovement"
                }
              }
            }
          }
        ]
      },
      "InventorySettings": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "inventory_settings"
          },
          "low_stock_threshold": {
            "type": "integer",
            "description": "A tracked variant at or under this many units is low on stock."
          },
          "reorder_days": {
            "type": "integer",
            "description": "How many days of stock the reorder suggestion aims for."
          }
        }
      },
      "StockCountLine": {
        "type": "object",
        "properties": {
          "variant_id": {
            "type": "string"
          },
          "product_title": {
            "type": "string"
          },
          "variant_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "expected": {
            "type": "integer",
            "description": "Stock when the sheet was opened."
          },
          "counted": {
            "type": [
              "integer",
              "null"
            ],
            "description": "What was counted. null until someone counts it."
          },
          "current": {
            "type": "integer",
            "description": "Stock right now (sales keep happening while you count)."
          },
          "variance": {
            "type": [
              "integer",
              "null"
            ],
            "description": "counted - current: what applying will change."
          }
        }
      },
      "StockCount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^cnt_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "stock_count"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "applied",
              "discarded"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines_total": {
            "type": "integer"
          },
          "lines_counted": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "applied_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StockCountLine"
            },
            "description": "A page of lines (single-count answers only)."
          },
          "lines_has_more": {
            "type": "boolean"
          },
          "adjusted_variants": {
            "type": "integer",
            "description": "On apply",
            "how many variants changed.": null
          },
          "adjusted_units": {
            "type": "integer",
            "description": "On apply",
            "the total units added or removed.": null
          }
        }
      },
      "StockCountList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StockCount"
                }
              }
            }
          }
        ]
      },
      "ShipmentStatus": {
        "type": "string",
        "description": "`pending` (registered with the courier, not picked up yet),\n`in_transit`, `delivered`, `returned`, `cancelled`, or `failed` (the\ncourier refused it). New values may be added.\n",
        "enum": [
          "pending",
          "in_transit",
          "delivered",
          "returned",
          "cancelled",
          "failed"
        ]
      },
      "ShipmentStage": {
        "type": "string",
        "description": "A finer reading of the courier's last report, for display. Decide on\n`status`, show `stage`. New values may be added.\n",
        "enum": [
          "pending",
          "validated",
          "confirming",
          "picked_up",
          "out_for_delivery",
          "at_desk",
          "no_answer",
          "postponed",
          "on_hold",
          "exchange_pending",
          "delivered",
          "partial",
          "cash_collected",
          "paid",
          "returning",
          "return_ready",
          "returned",
          "failed",
          "lost",
          "deleted"
        ]
      },
      "Shipment": {
        "type": "object",
        "required": [
          "id",
          "object",
          "order_id",
          "courier",
          "tracking_code",
          "status",
          "livemode",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^shp_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "shipment"
          },
          "order_id": {
            "type": "string",
            "pattern": "^ord_[0-9a-f]{32}$"
          },
          "courier": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The store's courier account. null for a test shipment."
              },
              "brand": {
                "type": "string",
                "description": "The courier company, e.g. \"zrexpress\", \"yalidine\". \"test\" for a test shipment."
              },
              "account_name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The name the merchant gave the account."
              }
            }
          },
          "tracking_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The courier's tracking number. null when the send failed."
          },
          "status": {
            "$ref": "#/components/schemas/ShipmentStatus"
          },
          "stage": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ShipmentStage"
              },
              {
                "type": "null"
              }
            ]
          },
          "stage_changed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "status_detail": {
            "type": [
              "string",
              "null"
            ],
            "description": "The courier's own words for its last report, in the courier's language."
          },
          "cod": {
            "type": "object",
            "description": "The cash on delivery, as the courier reports it.",
            "properties": {
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "delivered_unpaid",
                  "cash_collected",
                  "paid",
                  "archived",
                  null
                ],
                "description": "delivered_unpaid: delivered, the courier has not collected yet. cash_collected: the courier holds the cash. paid: the courier paid the merchant. null when the courier does not report it."
              },
              "settled_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "return_status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "suspended",
              "return_ready",
              "returned_in",
              null
            ],
            "description": "suspended: on hold at the courier. return_ready: coming back, waiting for the merchant to collect it. returned_in: handed back."
          },
          "driver": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "E.164 when it could be read."
              }
            }
          },
          "events": {
            "type": "array",
            "description": "The courier's history of the parcel, oldest first (the last 50).",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The courier's own timestamp, as it sends it."
                },
                "label": {
                  "type": "string"
                },
                "kind": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "failure_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the courier refused the parcel",
            "when status is failed.": null
          },
          "validated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the parcel was validated with the courier."
          },
          "packed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the parcel was marked packed."
          },
          "last_checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When Ordexs last asked the courier about it."
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ShipmentList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Shipment"
                }
              }
            }
          }
        ]
      },
      "Country": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "country"
          },
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "phone": {
            "type": "object",
            "properties": {
              "calling_code": {
                "type": "string"
              },
              "national_digits": {
                "type": "integer"
              },
              "trunk_prefix": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "region_label": {
            "type": "string",
            "description": "What the country calls a region, e.g. \"Wilaya\"."
          },
          "city_label": {
            "type": "string"
          }
        }
      },
      "CountryList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Country"
                }
              }
            }
          }
        ]
      },
      "Region": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "region"
          },
          "country": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "iso_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-2 code when one exists."
          },
          "name": {
            "type": "string"
          },
          "name_local": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "RegionList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Region"
                }
              }
            }
          }
        ]
      },
      "City": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "city"
          },
          "country": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "name_local": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CityList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/City"
                }
              }
            }
          }
        ]
      },
      "DeliveryRate": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "delivery_rate"
          },
          "mode": {
            "type": "string",
            "enum": [
              "home",
              "pickup_point"
            ]
          },
          "label": {
            "type": "string"
          },
          "price": {
            "$ref": "#/components/schemas/Money"
          },
          "courier": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^cour_[0-9a-f]{32}$"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "DeliveryRates": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "delivery_rates"
          },
          "country": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "delivery_required": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryRate"
            }
          }
        }
      },
      "MoneyString": {
        "type": "string",
        "pattern": "^[0-9]{1,10}(\\.[0-9]{1,3})?$",
        "description": "An amount as a decimal string in the store's currency, with no more\ndecimals than the currency has (\"3500.00\" in DZD, \"12.500\" in TND).\n"
      },
      "Metadata": {
        "type": "object",
        "maxProperties": 20,
        "propertyNames": {
          "maxLength": 40
        },
        "additionalProperties": {
          "type": "string",
          "maxLength": 500
        },
        "description": "Up to 20 string key/value pairs of your own. Returned as sent, never shown to shoppers."
      },
      "Deleted": {
        "type": "object",
        "required": [
          "id",
          "object",
          "deleted"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "StatusReason": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "no_answer",
              "postponed",
              "changed_mind",
              "price_too_high",
              "duplicate"
            ],
            "description": "Why the status changed. Shown to the merchant's team on the order."
          },
          "text": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "OrderCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "customer",
          "shipping_address"
        ],
        "properties": {
          "customer": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "phone"
            ],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "phone": {
                "type": "string",
                "minLength": 6,
                "maxLength": 20,
                "description": "E.164 (\"+213551234567\") or the national form."
              },
              "phone_2": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 20
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "email",
                "maxLength": 160
              }
            }
          },
          "shipping_address": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "region",
              "city",
              "address1"
            ],
            "properties": {
              "country": {
                "type": "string",
                "pattern": "^[A-Za-z]{2}$",
                "description": "Optional. The store's own country is the only one accepted for now."
              },
              "region": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "A region from GET /v1/regions: its code (\"16\"), its ISO code (\"DZ-16\") or its name (\"Alger\", \"الجزائر\"; one typo is tolerated). The order stores the region code."
              },
              "city": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160,
                "description": "The city's name. An unrecognised name sets `needs_review`."
              },
              "address1": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            }
          },
          "delivery": {
            "type": "object",
            "additionalProperties": false,
            "description": "Required (with mode) when the store charges for delivery (GET /v1/delivery/rates says so). For a pickup or a cash collection, only courier_id is read.",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "home",
                  "pickup_point"
                ]
              },
              "courier_id": {
                "type": "string",
                "pattern": "^cour_[0-9a-f]{32}$",
                "description": "A courier from GET /v1/delivery/rates. Leave it out to use the cheapest rate for the mode."
              },
              "pickup_point_id": {
                "type": "string",
                "maxLength": 100
              },
              "pickup_point_name": {
                "type": "string",
                "maxLength": 200
              }
            }
          },
          "line_items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "description": "What is delivered. Required except for a pickup (its goods are in collect) and a cash collection (it has none).",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "quantity"
              ],
              "description": "A catalogue line (variant_id) or a custom one (title and unit_price).",
              "properties": {
                "variant_id": {
                  "type": "string",
                  "pattern": "^var_[0-9a-f]{32}$"
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 240,
                  "description": "A custom line's name",
                  "for something not in the catalogue.": null
                },
                "variant_title": {
                  "type": "string",
                  "maxLength": 240
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 999
                },
                "unit_price": {
                  "$ref": "#/components/schemas/MoneyString",
                  "description": "Set the price by hand, as the dashboard's Create order allows. Leave it out to use the variant's price. Required on a custom line."
                }
              },
              "oneOf": [
                {
                  "required": [
                    "variant_id"
                  ]
                },
                {
                  "required": [
                    "title"
                  ]
                }
              ]
            }
          },
          "type": {
            "type": "string",
            "enum": [
              "delivery",
              "exchange",
              "pickup",
              "cash_collection"
            ],
            "default": "delivery",
            "description": "delivery: goods go to the customer. exchange: goods go to the\ncustomer and the courier takes others back (collect). pickup: the\ncourier only collects goods from the customer. cash_collection: no\ngoods; the courier collects an amount (total).\n"
          },
          "collect": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "lines"
            ],
            "description": "What the courier takes back, for an exchange or a pickup. Name lines of an\nearlier order with original_order_id and line_item_id (that order must be\ndelivered), or describe them like line_items.\n",
            "properties": {
              "original_order_id": {
                "type": "string",
                "pattern": "^ord_[0-9a-f]{32}$"
              },
              "lines": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "quantity"
                  ],
                  "properties": {
                    "line_item_id": {
                      "type": "string",
                      "pattern": "^li_[0-9a-f]{32}$",
                      "description": "A line of original_order_id."
                    },
                    "variant_id": {
                      "type": "string",
                      "pattern": "^var_[0-9a-f]{32}$"
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 240
                    },
                    "variant_title": {
                      "type": "string",
                      "maxLength": 240
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 999
                    },
                    "unit_price": {
                      "$ref": "#/components/schemas/MoneyString"
                    }
                  }
                }
              }
            }
          },
          "total": {
            "$ref": "#/components/schemas/MoneyString",
            "description": "What the courier collects, set by hand: the amount of a cash collection,\nthe price difference of an exchange. Leave it out and it is the lines plus\ndelivery.\n"
          },
          "shipping_fee": {
            "$ref": "#/components/schemas/MoneyString",
            "description": "The delivery fee, set by hand instead of the store's rate."
          },
          "discount_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "offer_ids": {
            "type": "array",
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^ofr_[0-9a-f]{32}$"
            },
            "description": "Offers the shopper took (a bundle, a quantity pack, a cross-sell add-on), as\nthe storefront sends them. The store checks each one against the lines and\nits schedule, and applies only those that qualify; the rest are ignored.\n"
          },
          "note": {
            "type": "string",
            "maxLength": 1000,
            "description": "The customer's note, shown on the order."
          },
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Your own id for this order. Unique per store and source_name."
          },
          "source_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "A short name for your integration, e.g. \"chatbot\"."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "preorder": {
            "type": "boolean",
            "default": false,
            "description": "A pre-order, like the dashboard's Pre-order switch: a line may take\nunits from the variant's incoming delivery when the shelf is empty,\nand the order is marked as a pre-order for the merchant. Products\nset to allow pre-orders take them anyway; this flag extends it to any\nproduct with a delivery on its way.\n"
          },
          "ship": {
            "type": "object",
            "additionalProperties": false,
            "description": "Send the order to the courier right after creating it, like the\ndashboard's \"Upload after creating\". Needs the shipping:write scope.\nThe order is created even if the courier refuses it: the answer\nthen carries ship_error instead of shipment. Ignored by preview.\n",
            "properties": {
              "courier_id": {
                "type": "string",
                "pattern": "^cour_[0-9a-f]{32}$",
                "description": "A courier account from GET /v1/delivery/rates. Leave it out to use the order's courier, the routing rules or the default."
              }
            }
          }
        }
      },
      "OrderCreated": {
        "description": "The new order. When the request had \"ship\", also what happened to the send.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Order"
          },
          {
            "type": "object",
            "properties": {
              "shipment": {
                "description": "The shipment, when \"ship\" was sent and the courier took the parcel.",
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Shipment"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "ship_error": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Why the send failed, in the usual error shape (code, message, details). The order exists; send it later with POST /v1/orders/{order_id}/ship.",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "details": {
                    "type": "object"
                  },
                  "request_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        ]
      },
      "OrderUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "customer": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "phone": {
                "type": "string",
                "minLength": 6,
                "maxLength": 20
              },
              "phone_2": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 20
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "email",
                "maxLength": 160
              }
            }
          },
          "shipping_address": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "country": {
                "type": "string",
                "pattern": "^[A-Za-z]{2}$"
              },
              "region": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "A region code",
                "ISO code or name": null,
                "as on create.": null
              },
              "city": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "address1": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "line_items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "description": "The order's new lines, replacing the old ones (the order card's Edit\nitems). Stock follows: units come back for removed lines, and more\nunits must be available (or coming, for a pre-order) for added ones.\nThe total is recalculated unless you send total.\n",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "quantity"
              ],
              "description": "A catalogue line (variant_id) or a custom one (title and unit_price).",
              "properties": {
                "variant_id": {
                  "type": "string",
                  "pattern": "^var_[0-9a-f]{32}$"
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 240,
                  "description": "A custom line's name",
                  "for something not in the catalogue.": null
                },
                "variant_title": {
                  "type": "string",
                  "maxLength": 240
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 999
                },
                "unit_price": {
                  "$ref": "#/components/schemas/MoneyString",
                  "description": "Set the price by hand, as the dashboard's Create order allows. Leave it out to use the variant's price. Required on a custom line."
                }
              },
              "oneOf": [
                {
                  "required": [
                    "variant_id"
                  ]
                },
                {
                  "required": [
                    "title"
                  ]
                }
              ]
            }
          },
          "shipping_fee": {
            "$ref": "#/components/schemas/MoneyString"
          },
          "total": {
            "$ref": "#/components/schemas/MoneyString",
            "description": "What the courier collects, set by hand. For a cash collection, its amount."
          },
          "scheduled_for": {
            "type": "string",
            "format": "date-time",
            "description": "Schedule the order for this moment (up to a year ahead); its status becomes scheduled, like the order card's Schedule."
          },
          "courier": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "courier_id"
            ],
            "description": "Change the courier this order will go to, like the order card's courier picker. Its delivery fee can change with it.",
            "properties": {
              "courier_id": {
                "type": "string",
                "pattern": "^cour_[0-9a-f]{32}$"
              },
              "shipping_fee": {
                "$ref": "#/components/schemas/MoneyString"
              }
            }
          }
        }
      },
      "ProductOptionIn": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "values"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "type": {
            "type": "string",
            "enum": [
              "color",
              "size",
              "text"
            ],
            "description": "How the storefront shows it."
          },
          "values": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          }
        }
      },
      "VariantCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "options",
          "price"
        ],
        "properties": {
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "description": "Option name → value, one for each of the product's options."
          },
          "price": {
            "$ref": "#/components/schemas/MoneyString"
          },
          "compare_at_price": {
            "$ref": "#/components/schemas/MoneyString"
          },
          "cost": {
            "$ref": "#/components/schemas/MoneyString"
          },
          "sku": {
            "type": "string",
            "maxLength": 100
          },
          "barcode": {
            "type": "string",
            "maxLength": 100
          },
          "inventory_quantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "inventory_tracked": {
            "type": "boolean"
          }
        }
      },
      "VariantUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "image_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^img_[0-9a-f]{32}$",
            "description": "The variant's own image, one of its product's images. null: none (the product's images show)."
          },
          "price": {
            "$ref": "#/components/schemas/MoneyString"
          },
          "compare_at_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MoneyString"
              },
              {
                "type": "null"
              }
            ]
          },
          "cost": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MoneyString"
              },
              {
                "type": "null"
              }
            ]
          },
          "sku": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "inventory_quantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000,
            "description": "The new stock count. Recorded as a stock adjustment in the store's inventory history. For a reason other than an adjustment, use POST /v1/inventory/adjustments."
          },
          "inventory_tracked": {
            "type": "boolean"
          },
          "allow_backorder": {
            "type": "boolean",
            "description": "Let it be ordered past zero. Turning it off is refused while units are still owed."
          },
          "incoming": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "quantity"
            ],
            "description": "A delivery on its way. Pre-orders can claim it. quantity 0 clears it; POST /v1/variants/{id}/receive_incoming books it into stock when it lands.",
            "properties": {
              "quantity": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000
              },
              "due_in_days": {
                "type": "integer",
                "minimum": 0,
                "maximum": 365,
                "description": "How many days from today it is expected."
              }
            }
          },
          "at_courier": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000,
            "description": "Units kept at the courier's warehouse (for couriers that ship from their own stock). Can't exceed what is available."
          }
        }
      },
      "ProductCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title",
          "variants"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description_html": {
            "type": "string",
            "maxLength": 100000
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ],
            "description": "Default draft."
          },
          "handle": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,59}$",
            "description": "The product's address in the storefront. Made from the title when left out."
          },
          "product_type": {
            "type": "string",
            "maxLength": 100
          },
          "vendor": {
            "type": "string",
            "maxLength": 100
          },
          "category": {
            "type": "string",
            "maxLength": 100
          },
          "tags": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "weight_grams": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "options": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/ProductOptionIn"
            }
          },
          "variants": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "description": "With no options, exactly one variant whose `options` is `{}`.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/VariantCreate"
                }
              ]
            }
          }
        }
      },
      "ProductUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description_html": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100000
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published",
              "archived"
            ]
          },
          "handle": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,59}$"
          },
          "product_type": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "vendor": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "tags": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "weight_grams": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "allow_preorder": {
            "type": "boolean",
            "description": "Pre-orders for every variant of the product, up to each variant's incoming delivery. Turning it off is refused while pre-ordered units are still owed."
          }
        }
      },
      "CustomerCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name"
        ],
        "anyOf": [
          {
            "required": [
              "phone"
            ]
          },
          {
            "required": [
              "email"
            ]
          }
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "phone": {
            "type": "string",
            "minLength": 6,
            "maxLength": 20
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 160
          },
          "tags": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "note": {
            "type": "string",
            "maxLength": 2000
          }
        }
      },
      "CustomerUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "needs_followup",
              "do_not_contact"
            ],
            "description": "do_not_contact blocks the customer, like the Customers page's Block."
          },
          "tags": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "whatsapp_opt_in": {
            "type": "boolean",
            "description": "Whether the customer agreed to WhatsApp messages. Only set it to true with their consent."
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^we_[0-9a-f]{32}$"
          },
          "object": {
            "type": "string",
            "const": "webhook_endpoint"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled",
              "auto_disabled"
            ],
            "description": "`auto_disabled`: every delivery failed for 3 days, so Ordexs stopped sending. Set `status: enabled` to resume."
          },
          "disabled_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "failing_since": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When deliveries started failing without a success since."
          },
          "livemode": {
            "type": "boolean"
          },
          "secret": {
            "type": "string",
            "description": "Only in the response to create and rotate_secret."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookEndpointList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          }
        ]
      },
      "WebhookEventType": {
        "type": "string",
        "enum": [
          "*",
          "order.created",
          "order.updated",
          "order.status_changed",
          "order.cancelled",
          "order.needs_review",
          "order.note_added",
          "product.created",
          "product.updated",
          "product.deleted",
          "inventory.updated",
          "customer.created",
          "customer.updated",
          "shipment.created",
          "shipment.updated",
          "abandoned_checkout.created",
          "abandoned_checkout.updated",
          "review.created",
          "bulk_job.completed"
        ]
      },
      "WebhookEndpointCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "pattern": "^https://"
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            },
            "description": "The event types to send, or `[\"*\"]` for all of them (including ones added later)."
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "WebhookEndpointUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "pattern": "^https://"
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          }
        }
      },
      "Event": {
        "type": "object",
        "required": [
          "id",
          "object",
          "type",
          "api_version",
          "created_at",
          "livemode",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^evt_[0-9a-f]{32}$",
            "description": "Unique per event. Deliveries can repeat — ignore an id you've already processed."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string"
          },
          "api_version": {
            "type": "string",
            "const": "v1"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          },
          "store_id": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "type": "object",
                "description": "The object as it was when the change was saved."
              },
              "previous_attributes": {
                "type": "object",
                "description": "The fields that changed and their old values, when known."
              }
            }
          },
          "request": {
            "type": "object",
            "properties": {
              "api_key_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The API key that caused the change, if any."
              }
            }
          }
        }
      },
      "EventList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          }
        ]
      }
    }
  }
}