Create Orders/Trackings
The Order API provides a comprehensive, idempotent endpoint for managing order and tracking data in the parcelLab system.
This API allows you to create new orders, update existing orders, add shipment trackings, cancel trackings, cancel orders, and cancel or reduce line items.
Endpoint Details
Method:
PUTPath:
/v4/track/orders/Full URL:
https://api.parcellab.com/v4/track/orders/Authentication: Header
Authorization: Parcellab-API-Token <token>
This endpoint is idempotent, meaning you can safely call it multiple times with the same data without creating duplicate orders. If an order exists, it will be updated; if not, it will be created.
Example API Call
Use following samples as a starting point for the API interaction. Swap your token in the header (use your token in the same format) and set your account key in the payload.
For sample payloads at different stages of the order lifecycle, see below: Typical Use Cases for OMS and WMS Integration
Best Practices
Use Idempotent Updates: The
PUTendpoint is idempotent. Use it for both creation and updates to avoid duplicates.Partial Updates: For scalar order fields, only send the fields you want to update. Lists such as
articles_orderrepresent the current order-level list you send and can replace the stored list.Order Identification: Use either
order_number+accountorexternal_idto identify orders. When creating new orders,external_idis generated by parcelLab and returned in the response.Tracking Identification: Trackings require either
tracking_number+courierorexternal_reference.Use
change_line_item_quantityfor line-item cancellations: To cancel or reduce an existing order line, send achange_line_item_quantitymutation with the new absolute quantity. Usequantity: 0to cancel the line. For full-order cancellation, use thecancel_ordermutation instead.Keep line identifiers unique per logical line:
line_item_idshould uniquely identify one logical order line. If the same SKU appears on multiple lines, do not reuse the sameline_item_id; use the source system's stable line key so each line can be targeted independently.Keep order and tracking line identifiers aligned: If you send shipment-level
tracking.articles, the identifiers in those articles should match the corresponding item inarticles_orderbyline_item_idororder_item_id. This alignment is required for later line-item changes to be reflected correctly on the order status page and in downstream payloads.Check Mutation Results: An accepted request can still contain
mutations[].result.success: falsefor individual mutation failures. Also checkmutations[].result.warningsfor accepted payload changes, such as dropped custom tracking fields.Validate Line Item Quantities: Before cancelling or reducing a line, make sure the new quantity is not below the quantity already shipped.
Send complete address objects: Only include
shipping_addressorbilling_addresswhen all required address details are available. Includeaddress_line,postal_code,city,country_iso3, and eitherlast_nameorcompany_name. Ifregion_codeis unknown or invalid for the country, omit it. Do not send partial address objects or unexpected address fields, as invalid address payloads can return400 Bad Request.Tags: You can set tags on a tracking to identify custom attributes in filters and exports. For example:
tags: ["loyalty_customer", "customer_loyalty:gold", "international_order", "dropship"].
Data Models
Order Schema
For upserts, send only the fields you want to set or update.
Line Item Order Schema
Represents individual products in articles_order.
Tracking Schema
Represent an individual shipment, package or parcel used to fulfill (parts of) an order.
Additional Data
parcelLab in general allows you to send additional attributes with custom data. For full data-element definitions, refer to the following page.
Data ModelMutations
Mutations allow you to perform action-oriented changes on an order without replacing the full order payload. They can be used to add or cancel trackings, cancel an order, and change line items.
Supported mutation types are:
add_trackingcancel_trackingcancel_orderchange_line_item_quantityadd_line_itemreplace_line_item
Typical Use Cases for OMS and WMS Integration
You can use the Order API to update parcelLab about all updates on the order from placement to cancellation or fulfillment.
Integration Flow
Order Placement: Create the order with all known information
Cancellations: Handle line-item cancellations with
change_line_item_quantityor full-order cancellations withcancel_orderFulfillment: Add trackings as items ship
Delivery: System automatically updates based on carrier events (outside of this API)
Sample Mutations
FAQs
Last updated
Was this helpful?