Order Endpoint (Orders)

Endpoint

Orders v2.32.0

Read, create, and modify orders; delete history entries.


Overview

OperationMethodEndpointScope
ExportGET/xpanel/xoport/Export/JSON/ordersorders:read
CreatePOST/xpanel/xoport/Import/JSON/ordersorders:write
UpdatePUT/xpanel/xoport/Import/JSON/ordersorders:write
Delete History EntryDELETE/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:

ModeBehaviorUsage
auto DefaultNo 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.
recalcLoads 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.
verbatimThe 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_flagproducts_price isot_subtotalot_taxot_total
0 (Net)netΣ(net × qty)Σ(net × rate/100), addedSubtotal + Shipping + Tax
1 (Gross)grossΣ(gross × qty)For informational purposes (“incl. VAT”)Subtotal + Shipping (Tax NOT added)
2 (Tax-free)net = grossΣ(price × qty)0Subtotal + 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).

Origintax_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.shippingnet, tax on topsent 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_shippingnet, tax on topnet, grossed up: line = net × (1 + rate/100)net, no tax
Line items via PUT with products_mode: "append"netnetnet
Changed in v2.122.11:
  • Line item prices that an integration sends gross with tax_flag = 1 are 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:read returns such line items net (products_price, final_price, attributes[].options_values_price): 10.00 at 19% becomes 8.40336134. Integrations that read these fields back and compare them with what they sent need to adjust. Total lines, order_total/tax_total of 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; an expected_total adjusted to the old value then reports TOTAL_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) carries tax 0 and the tax rate in tax2, like a net order from the checkout; tax-free orders carry 0 and 0 even in verbatim mode, gross orders carry the rate in both columns as before. If you read the shipping rate only from totals[].tax, use tax2 for 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 itemservice
Product field “Service” set1
Weight 0 (including the attributes) and download file, if product downloads are active1
all other products0
free-form line item without products_id0

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 reports service_invalid in records[].warnings, and the value is taken from the product.
  • Only on creation. Existing line items keep their value: products_mode: "update" rejects service, the record fails with FIELD_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 with service.
  • 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 by api_version in GET /me.
  • The export returns the value per line item in products[].service: 0, 1 or null for 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:

  1. Payload value (if set)
  2. customers.language_id from the customer master
  3. DEFAULT_LANGUAGE from the shop configuration (code lookup in the languages table)
  4. 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): Expected ot_total amount after calculation.
  • strict_totals (boolean, default false):
    • 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 / BehaviorTypeDescription
Address Auto-FillautoIf 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 ResolutionautoItems 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_attributesbool (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_shippingbool (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_emailbool (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 recalcautoThe 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_addressstringAddress 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

CodeMeaning
INVALID_PAYLOADRequired fields are missing or the data type is incorrect.
CUSTOMER_NOT_FOUNDcustomers_id does not exist.
PRODUCT_NOT_FOUNDproducts_id does not exist.
TOTAL_DRIFTexpected_total ≠ calculated total and strict_totals=true.
STOCK_INSUFFICIENTStock is insufficient (if auto_stock=true).
DUPLICATE_EXTERNAL_REFERENCEThe 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.

ParametersTypeDescription
statusintOrder status
date_from, date_topoint in timeOrder date from or to
sincepoint in timeSync: changed or ordered on or after the point in time
last_modifiedpoint in timeNew 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_idintOrders from a customer
products_id, products_model, categories_idint / string / intOrders that contain this product or a product of the category
marketplace_idintMarketplace of the order
external_id, sourcestringOrder number or source of the marketplace integration
po_numberstringOrder reference
delivery_countrystringNew 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, orderstringList sorting (default: ascending by orders_id)
limit, offset, pageintPagination

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=3 returned 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 with has_more. new:{datum} is validated (YYYY-MM-DD, YYYY-MM-DD HH:MM, or YYYY-MM-DD HH:MM:SS); otherwise, HTTP 400 INVALID_RANGE is returned.
  • v2.122.12 The segment after /order or /orders is an integer with at most 18 digits, a range with integer boundaries, or new:{datum} with an unencoded colon; anything else results in HTTP 400 INVALID_RANGE. Leading or trailing whitespace does not count: /order/42%20 is order 42.
Changed in v2.122.12:
  • /orders/new%3A2026-10-01 (colon encoded, e.g. with urlencode()) 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 after new unencoded.
  • /order/42x, /order/42%2B and /orders/5%3A10 returned the list, while /order/42.0, /order/+5, and /orders/100.0:200.0 returned 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%20 and /order/42%0A returned 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, or YYYY-MM-DD HH:MM:SS, optionally with a time zone (Z or ±HH:MM; send the plus sign as %2B). Values such as yesterday or 01.10.2026 result in HTTP 400 INVALID_FILTER_VALUE.
  • Since v2.122.10, list values such as ?customer_id[]=5, as well as a comma-separated list, text, or decimal number in status, customer_id, marketplace_id, products_id, and categories_id, result in HTTP 400 INVALID_FILTER_VALUE with details[]. Previously, such a filter was silently ignored, and the response contained all orders. Only delivery_country accepts multiple values.
  • An empty value is considered unset. warnings[] reports unknown parameters as UNKNOWN_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

FlagsMeaning
is_defaultStatus of new orders
is_cancelledCancellation: the shop reverses the inventory posting
is_offerOffer (separate “Offers” tab in the backend)
counts_as_revenueNeither cancellation nor offer; same distinction as order_stats.orders_count_valid on /customers. Does not indicate payment or shipping
is_paidPaid (payment received)
is_shippedShipped; 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 by orders_status_id.
  • /order_status/{id} and /order_statuses/{id}: exactly this status; if no match is found, HTTP 404 NOT_FOUND.
  • /order_statuses/{von}:{bis} and /order_statuses/{von}:: range; empty = HTTP 200 with an empty data.
  • No filters; ?language= does not change anything—all languages are always returned. new:{datum} returns HTTP 400 INVALID_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.