Order Endpoint (Orders)
Orders v2.32.0
Read, create, and modify orders; delete history entries.
Overview
| Operation | Method | Endpoint | Scope |
|---|---|---|---|
| Export | GET | /xpanel/xoport/Export/JSON/orders | orders:read |
| Create | POST | /xpanel/xoport/Import/JSON/orders | orders:write |
| Update | PUT | /xpanel/xoport/Import/JSON/orders | orders:write |
| Delete History Entry | DELETE | /xpanel/xoport/Delete/JSON/order_status_history/{id} | orders:write |
Note: Import and deleting history entries require orders:write. The API does not delete an order itself: DELETE /Delete/JSON/orders returns HTTP 501 NOT_IMPLEMENTED. Stock is booked automatically on create. Only DELETE /Delete/JSON/order_status_history/{id} deletes a history entry: the order status is updated accordingly, and the shop rejects the oldest entry of an order (HTTP 409 FIRST_HISTORY_ENTRY). Details: Delete API.
Import (POST / PUT)
Creates or updates an order. POST = Create, PUT with orders_id = Update. All fields are validated and written by the same service that the marketplace imports use to create orders.
Minimal Payload (Create)
{
"data": [{
"customers_id": 51,
"payment_method": "PayPal",
"products": [
{"products_id": 42, "quantity": 2, "products_price": "29.99"}
]
}]
}
Full Payload with All Options
{
"data": [{
"customers_id": 51,
"language_id": 2,
"payment_method": "Stripe",
"shipping_method": "DHL",
"tax_flag": 1,
"totals_mode": "auto",
"expected_total": "59.98",
"strict_totals": true,
"currency": "EUR",
"products": [
{
"products_id": 42,
"quantity": 2,
"products_price": "29.99",
"products_tax": "19.00",
"attributes": [
{"option_id": 1, "value_id": 5}
]
}
],
"external_reference": {
"source": "amazon",
"external_id": "AMZ-12345"
},
"tracking": [
{"service_provider": "DHL", "code": "1234567890", "link": "https://nolp.dhl.de/?piececode=1234567890"}
]
}]
}
Totals Modes (v2.21.0)
totals_mode controls how order totals are calculated:
| Mode | Behavior | Usage |
|---|---|---|
auto Default | No totals values in the payload → The shop recalculates everything from scratch. With totals values → these are adopted. | Default behavior: The caller has no totals; the shop calculates them. |
recalc | Loads products_price + products_tax fresh from the database (customer group price + specials + category/customer discount, country-aware) and recalculates subtotal/tax/total. Additionally, purchase price (products_ek_price) and GTIN are reloaded. Manual line items (products_id=0) remain unchanged. | Force a safe recalculation; dropship parity with the checkout. |
verbatim | The shop adopts the included totals values exactly as provided, WITHOUT recalculation. | Marketplace imports with a fixed total amount (Amazon, Otto, eBay). |
tax_flag Auto-Derive & Price Interpretation
If tax_flag is not explicitly set, it is derived from the customer group:
customers_groups.show_tax = 1+DISPLAY_PRICE_WITH_TAX = true→tax_flag = 1(Gross)customers_groups.show_tax = 0→tax_flag = 0(Net)- Tax-exempt groups (e.g., EU VAT ID) →
tax_flag = 2(Tax-Exempt)
Interpretation of products_price depending on tax_flag
tax_flag | products_price is | ot_subtotal | ot_tax | ot_total |
|---|---|---|---|---|
0 (Net) | net | Σ(net × qty) | Σ(net × rate/100), added | Subtotal + Shipping + Tax |
1 (Gross) | gross | Σ(gross × qty) | For informational purposes (“incl. VAT”) | Subtotal + Shipping (Tax NOT added) |
2 (Tax-free) | net = gross | Σ(price × qty) | 0 | Subtotal + Shipping |
⚠️ Important for marketplace imports: If the marketplace sends net prices, tax_flag: 0 MUST be explicitly set—otherwise, the prices (for a gross customer group) will be interpreted as gross.
Since v2.122.8, line items with a negative tax amount—such as refunds—receive their tax line as in the checkout. When appending line items via PUT, the tax for negative line items is included. New line items now record on creation whether they are goods or services; documents for intra-Community supplies of goods and services thus remain stable.
Origin of the Price
Whether an amount is read as net or gross depends on who determined it: the integration (payload) or the shop (database, shipping module).
| Origin | tax_flag = 0 (Net) | tax_flag = 1 (Gross) | tax_flag = 2 (Tax-Free) |
|---|---|---|---|
Integration: prices in the modes auto and verbatim, recalc line items without a match in the shop or without products_id, custom attributes[].price, totals.shipping | net, tax on top | sent gross, tax included. The shop stores the line item and custom attribute surcharges as net (since v2.122.11) | net, no tax |
Shop: recalc matches (group price, special price, category discount), preselected attributes (apply_default_attributes), shipping from compute_shipping | net, tax on top | net, grossed up: line = net × (1 + rate/100) | net, no tax |
Line items via PUT with products_mode: "append" | net | net | net |
- Line item prices that an integration sends gross with
tax_flag = 1are stored net by the shop (÷ (1 + rate/100), 8 decimal places), as with an order from the checkout. Previously, the gross price was stored in the line item, and the order editor, invoice PDF, order email and the later appending of line items added the tax a second time. orders:readreturns such line items net (products_price,final_price,attributes[].options_values_price): 10.00 at 19% becomes8.40336134. Integrations that read these fields back and compare them with what they sent need to adjust. Total lines,order_total/tax_totalof the response and the drift check remain the same.- In two cases, the checkout value now applies: the surcharge of preselected attributes (
apply_default_attributes) on such a line item is taxed as well, and a shipping tier based on order value (compute_shipping) calculates with the net value. Shipping and grand total can change as a result; anexpected_totaladjusted to the old value then reportsTOTAL_DRIFT. - Existing orders are not converted. If you append something to an older order with line items stored gross, their double tax remains.
- The shipping line of a net order (
tax_flag = 0) carriestax0 and the tax rate intax2, like a net order from the checkout; tax-free orders carry 0 and 0 even inverbatimmode, gross orders carry the rate in both columns as before. If you read the shipping rate only fromtotals[].tax, usetax2for net orders. The totals remain the same and stored orders unchanged; the e-invoice of such orders now shows shipping with the correct amount. - When appending line items via
PUT, the shipping tax of a net order from the checkout is now included; previously, it was missing from the grand total.
Line Item Field service on Creation
Since v2.122.8, every newly created line item (POST and PUT with products_mode: "append") stores whether it is goods (0) or a service (1). On the invoice and e-invoice, the value decides the tax note for intra-Community supplies of goods or services and the exclusion of the right of withdrawal.
Without the field, the shop determines the value from the product, like the checkout and the order editor:
| Line item | service |
|---|---|
| Product field “Service” set | 1 |
| Weight 0 (including the attributes) and download file, if product downloads are active | 1 |
| all other products | 0 |
free-form line item without products_id | 0 |
New in v2.122.11 With the field, the value sent applies even if it contradicts the product data, for example for a free-form service line item:
curl -X POST "https://shop.de/xpanel/xoport/Import/JSON/orders" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"type":"orders","data":[{"customers_id":123,"products":[
{"products_name":"Programmierung Schnittstelle","products_quantity":3,
"products_price":150.00,"products_tax":0,"service":1}]}]}'
- Allowed values are
1,0,true,false,"1"and"0". Any other value is not applied: the response reportsservice_invalidinrecords[].warnings, and the value is taken from the product. - Only on creation. Existing line items keep their value:
products_mode: "update"rejectsservice, the record fails withFIELD_NOT_UPDATABLE, and nothing is written, not even the other fields (response HTTP 200, as with every bulk import). To correct it, cancel the line item and append it again withservice. - Shops up to 4.9.170 do not know the field: it is skipped as
UNKNOWN_FIELD(HTTP 400 with?_strict=true), and a free-form service line item is goods there. Whether a shop knows the field is shown byapi_versioninGET /me. - The export returns the value per line item in
products[].service:0,1ornullfor older orders without a stored value.
language_id Auto-Derive (v2.21.0)
If language_id is not included in the payload, it is resolved using cascading rules:
- Payload value (if set)
customers.language_idfrom the customer masterDEFAULT_LANGUAGEfrom the shop configuration (code lookup in thelanguagestable)- Fallback:
1(English)
Note: $_SESSION['languages_id'] is intentionally NOT a fallback in the xoPort context—otherwise, the language of the Admin API caller would be unintentionally applied to the customer order.
Drift check: expected_total + strict_totals
Optionally, the caller can include the expected total amount—the shop compares it and raises an alert if there is a discrepancy:
expected_total(decimal): Expectedot_totalamount after calculation.strict_totals(boolean, defaultfalse):false→ Drift is reported as a warning in the response; the order is created anyway.true→ The order is rejected if the calculated total ≠expected_total(tolerance: 0.01 €).
Usage: Marketplace imports where the marketplace already knows the final total—the shop validates that price × quantity × tax + shipping also add up to the same total locally.
Convenience Fields & Checkout Parity (v2.28.0–v2.32.0)
For integrations that only know the customer number, a different shipping address, and SKU/quantity—the order is created so that it carries prices, attributes, shipping, and confirmation exactly as a manual shop order would (dropship parity, e.g., SPV → SST).
| Field / Behavior | Type | Description |
|---|---|---|
| Address Auto-Fill | auto | If customers_id > 0 and billing is missing or incomplete, the customer’s default billing address is loaded. Explicitly provided fields take precedence. If delivery is missing required fields, it falls back to billing. v2.28.0 |
SKU/products_model Resolution | auto | Items need only provide {products_model, quantity} — products_id and name are resolved from the shop database. Unknown model → Warning PRODUCT_MODEL_NOT_FOUND. v2.28.0 |
apply_default_attributes | bool (Default false) | For each item without its own attributes, retrieves the preselected option values, including the signed surcharge—including display attributes (option type 5, e.g., “Version”/“Protection Class”)—as carried by the checkout. v2.28.0 / v2.30.0 |
compute_shipping | bool (Default false) | Without an explicit totals.shipping, the cheapest shipping option is calculated “headless” using the frontend’s shipping calculation for the shipping address and stored as ot_shipping. Best-effort: Error → Warning SHIPPING_AUTO_FAILED / SHIPPING_AUTO_EMPTY; the order is retained. v2.30.0 Since v2.122.9, the shipping line is also generated when the merchandise value is 0 (tax rate: the highest rate among the items; if there is none, the shipping method’s rate). |
send_confirmation_email | bool (Default false) | After successful creation, the standard order confirmation is sent to the customer (including copies from SEND_EXTRA_ORDER_EMAILS_TO). Result stored as confirmation_email_sent (true/false) in the record. v2.29.0 |
Category/Customer Discount in the recalc | auto | The recalc mode applies the category/customer discount (customers_discount + customers_groups_discount, including subcategory inheritance) in addition to group prices and specials—the lower effective price takes precedence. Problem → Warning CATEGORY_DISCOUNT_UNAVAILABLE. v2.31.0 |
additional_address | string | Address suffix per address block — is copied to customers_additional_address, delivery_additional_address, and billing_additional_address. v2.32.0 |
Tax line per rate (v2.32.0): ot_tax is written for each tax rate with a rate-specific title in frontend format — “plus 19% sales tax” (net) or “including 19% sales tax” (gross), provided that MODULE_ORDER_TOTAL_PREFIX=true.
Sub-Resources
external_reference — Marketplace Integration
Links the order to an external source. Allowed fields:
source(string, required): e.g.,amazon,ebay,otto,kaufland.external_id(string, required): ID/number on the marketplace.marketplace_id(int, optional): Internal XONIC marketplace ID.
tracking — Shipment Tracking
Array of tracking entries. Per entry, the following are allowed:
service_provider(alias:method): Carrier name (DHL, DPD, UPS, …).code(alias:tracking_number): Shipment number.link: Tracking URL.label_link: Shipping label URL (PDF).external_id: ID assigned by the shipping provider.is_retoure(bool): Return shipment instead of outbound shipment.
status_history — Status History
Append-only audit log. Per entry: orders_status_id, comments, customer_notified (0/1), date_added.
customer_notified at the order level
Boolean; controls whether sending the confirmation email is triggered when the status changes.
Sample Request (Create)
curl -X POST "https://shop.de/xpanel/xoport/Import/JSON/orders" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"data": [{
"customers_id": 51,
"payment_method": "PayPal",
"tax_flag": 0,
"expected_total": "71.38",
"products": [{"products_id": 42, "quantity": 2, "products_price": "29.99", "products_tax": "19.00"}]
}]
}'
Sample Response (Success)
{
"success": true,
"api_version": "2.32.0",
"type": "orders",
"operation": "create",
"data": [{
"orders_id": 46482,
"customers_id": 51,
"ot_subtotal": "59.98",
"ot_tax": "11.40",
"ot_total": "71.38",
"totals_mode": "auto",
"tax_flag": 0,
"language_id": 2
}],
"warnings": []
}
Sample Response (Drift Check Failed, strict_totals=true)
{
"success": false,
"api_version": "2.32.0",
"error": {
"code": "TOTAL_DRIFT",
"message": "Calculated ot_total 71.38 differs from expected_total 70.00 (diff: 1.38).",
"details": {"expected": "70.00", "calculated": "71.38", "tolerance": "0.01"}
}
}
Error Codes
| Code | Meaning |
|---|---|
INVALID_PAYLOAD | Required fields are missing or the data type is incorrect. |
CUSTOMER_NOT_FOUND | customers_id does not exist. |
PRODUCT_NOT_FOUND | products_id does not exist. |
TOTAL_DRIFT | expected_total ≠ calculated total and strict_totals=true. |
STOCK_INSUFFICIENT | Stock is insufficient (if auto_stock=true). |
DUPLICATE_EXTERNAL_REFERENCE | The combination source + external_id already exists. |
Non-fatal warnings (order is created anyway; returned in warnings[]): PRODUCT_MODEL_NOT_FOUND, RECALC_PRODUCT_NOT_FOUND, CATEGORY_DISCOUNT_UNAVAILABLE, SHIPPING_AUTO_FAILED, SHIPPING_AUTO_EMPTY, TOTAL_DRIFT (unless strict_totals=true), UNKNOWN_FIELD.
Export (GET)
Retrieve orders using GET /orders, scope orders:read.
| Parameters | Type | Description |
|---|---|---|
status | int | Order status |
date_from, date_to | point in time | Order date from or to |
since | point in time | Sync: changed or ordered on or after the point in time |
last_modified | point in time | New in v2.122.10: alternative name for since (notice FILTER_ALIAS); passing both with different points in time results in an HTTP 400 error |
customer_id | int | Orders from a customer |
products_id, products_model, categories_id | int / string / int | Orders that contain this product or a product of the category |
marketplace_id | int | Marketplace of the order |
external_id, source | string | Order number or source of the marketplace integration |
po_number | string | Order reference |
delivery_country | string | New in v2.122.9: delivery country as an ISO code (two or three letters); multiple codes are separated by commas; an unknown code results in an HTTP 400 error |
sort, order | string | List sorting (default: ascending by orders_id) |
limit, offset, page | int | Pagination |
Path forms
/order/{id},/orders/{von}:{bis},/orders/{von}:, and/orders/new:{datum}(ordered on or after the date).- Since v2.122.9, filters apply in addition to the path form. Up to version 2.122.8, a filter replaced the path form:
/order/{id}?status=3returned all orders with status 3. - Since v2.122.10, path forms are paginated in the database, in ascending order by ID. Without
?limit=, the response remains unpaginated up to the maximum limit; beyond that, it is returned in the default page size withhas_more.new:{datum}is validated (YYYY-MM-DD,YYYY-MM-DD HH:MM, orYYYY-MM-DD HH:MM:SS); otherwise, HTTP 400INVALID_RANGEis returned. - v2.122.12 The segment after
/orderor/ordersis an integer with at most 18 digits, a range with integer boundaries, ornew:{datum}with an unencoded colon; anything else results in HTTP 400INVALID_RANGE. Leading or trailing whitespace does not count:/order/42%20is order 42.
/orders/new%3A2026-10-01(colon encoded, e.g. withurlencode()) returned the full list instead of the delta under HTTP 200 up to v2.122.11, so a sync ran over the entire data set. Now HTTP 400: send the colon afternewunencoded./order/42x,/order/42%2Band/orders/5%3A10returned the list, while/order/42.0,/order/+5, and/orders/100.0:200.0returned the intended record or range. All now result in HTTP 400. Send the ID as an integer without decimal places; decimals are typical for values from spreadsheets./order/42%20and/order/42%0Areturned the list and are now order 42.
Invalid values
- Since v2.122.10, points in time must be in fixed formats:
YYYY-MM-DD,YYYY-MM-DD HH:MM, orYYYY-MM-DD HH:MM:SS, optionally with a time zone (Zor±HH:MM; send the plus sign as%2B). Values such asyesterdayor01.10.2026result in HTTP 400INVALID_FILTER_VALUE. - Since v2.122.10, list values such as
?customer_id[]=5, as well as a comma-separated list, text, or decimal number instatus,customer_id,marketplace_id,products_id, andcategories_id, result in HTTP 400INVALID_FILTER_VALUEwithdetails[]. Previously, such a filter was silently ignored, and the response contained all orders. Onlydelivery_countryaccepts multiple values. - An empty value is considered unset.
warnings[]reports unknown parameters asUNKNOWN_FILTER; with?_strict=true, the call returns HTTP 400.
Order Status Master Data (order_statuses)
New in v2.122.10: All order statuses with names for each language and their meanings, scope orders:read. Previously, a status was only returned with the order, as an ID and with the name in a single language.
curl "https://shop.de/xpanel/xoport/Export/JSON/order_statuses" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"{
"success": true,
"api_version": "2.122.10",
"type": "order_statuses",
"data": [
{
"orders_status_id": 5,
"orders_status_label": "secondary",
"orders_status_label_bg": "#000000",
"orders_status_label_color": "#ffffff",
"orders_status_sort_order": 0,
"is_default": false,
"is_cancelled": true,
"is_offer": false,
"counts_as_revenue": false,
"is_paid": false,
"is_shipped": false,
"languages": {
"en": { "language_id": 1, "language_code": "en", "orders_status_name": "Returned/Cancelled" },
"de": { "language_id": 2, "language_code": "de", "orders_status_name": "Retoure/Storniert" }
}
}
],
"stats": { "total": 1, "count": 1, "timestamp": "2026-10-15 10:00:00" }
}Flags
| Flags | Meaning |
|---|---|
is_default | Status of new orders |
is_cancelled | Cancellation: the shop reverses the inventory posting |
is_offer | Offer (separate “Offers” tab in the backend) |
counts_as_revenue | Neither cancellation nor offer; same distinction as order_stats.orders_count_valid on /customers. Does not indicate payment or shipping |
is_paid | Paid (payment received) |
is_shipped | Shipped; cancellation statuses are never is_shipped, even if the shop lists them in its shipping list (factory default of the 4.9 series: 3,5) |
The flags follow the shop’s status settings. An empty setting flags no status. Not included in the record: “returned,” “completed,” and partial payment.
Path forms and parameters
/order_statuses: all statuses, sorted in ascending order byorders_status_id./order_status/{id}and/order_statuses/{id}: exactly this status; if no match is found, HTTP 404NOT_FOUND./order_statuses/{von}:{bis}and/order_statuses/{von}:: range; empty = HTTP 200 with an emptydata.- No filters;
?language=does not change anything—all languages are always returned.new:{datum}returns HTTP 400INVALID_RANGE.
orders_status_label is the color class of the backend list (custom = custom colors from orders_status_label_bg and orders_status_label_color), orders_status_sort_order is the sort order in the dropdown lists. These values come from the German-language row, as on /orders.