Ship Order
Records a shipment for some or all items of an order and updates the order status. You can send your own tracking details, or ask the store to generate a shipping label through its shipping integration.
HTTP Request
- URL:
/orders/{id}/ship - Method:
POST - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_ORDER
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the order to ship. |
Request Body
The request body is a JSON object with a ShipOrder object.
| Field | Type | Required | Description |
|---|---|---|---|
ShipOrder | Object | Yes | Shipment details. See ShipOrder Object. |
generateShipment | Boolean | No | true to generate a shipping label. Default is false. Not used when you send a tracking number or tracking URL. |
ShipOrder Object
| Field | Type | Required | Description |
|---|---|---|---|
items | Array | Yes | Items to ship. See Item Object. |
carrier | String | No | Carrier code or name, for example ups. Defaults to the order's shipping method. |
trackingNumber | String | No | Tracking number. |
trackingUrl | String | No | Tracking page URL. |
packageDetail | Object | No | Package details. See Package Detail Object. |
Item Object
| Field | Type | Required | Description |
|---|---|---|---|
id | String | Yes | ID of the order line item, or ID of the product. |
variantId | String | No | Variant ID. Use it with a product ID when the product appears on more than one line. |
quantity | Number | Yes | Quantity to ship. Cannot be more than the quantity not yet shipped. |
Package Detail Object
| Field | Type | Required | Description |
|---|---|---|---|
packageCode | String | No | Carrier package code. |
packageName | String | No | Package name. |
weight | Object | No | Package weight, for example { "value": 16, "unit": "ounce" }. |
dimensions | Object | No | Package size, for example { "length": 10, "width": 8, "height": 4, "unit": "inch" }. |
cURL Example
curl --location '<BASE_URL>/orders/664f2310d5775459152d6dd8/ship' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"ShipOrder": {
"items": [{ "id": "664f2310d5775459152d6ddb", "quantity": 6 }],
"carrier": "ups",
"trackingNumber": "1Z999AA10123456784",
"trackingUrl": "https://www.ups.com/track?tracknum=1Z999AA10123456784",
"packageDetail": {
"packageCode": "package",
"weight": { "value": 16, "unit": "ounce" },
"dimensions": { "length": 10, "width": 8, "height": 4, "unit": "inch" }
}
}
}'
Response
- 200 OK: The shipment was recorded.
- 400 Bad Request: The access token is missing or invalid, the items are missing, a quantity is more than what is left to ship, or the shipping label could not be created.
- 404 Not Found: No order exists with this ID.
Sample JSON Response
{
"success": true,
"message": "Order shipped successfully",
"data": {
"_id": "664f2310d5775459152d6dd8",
"entityId": "ORD-1042",
"orderStatus": "partially fulfilled",
"lineItems": [
{
"_id": "664f2310d5775459152d6ddb",
"name": "Safety Glasses",
"sku": "SFTY-4006",
"quantity": 12,
"fulfilledQuantity": 6
}
],
"fulfilledItems": [
{
"_id": "665a1b2cd5775459152d7001",
"items": [
{
"lineItemId": "664f2310d5775459152d6ddb",
"quantity": 12,
"remainingQuantity": 6
}
],
"carrier": "ups",
"carrierName": "ups",
"trackingNumber": "1Z999AA10123456784",
"trackingUrl": "https://www.ups.com/track?tracknum=1Z999AA10123456784",
"labelId": null,
"labelDownloadUrl": null,
"packageDetail": {
"packageCode": "package",
"weight": { "value": 16, "unit": "ounce" },
"dimensions": { "length": 10, "width": 8, "height": 4, "unit": "inch" }
},
"fulfilledAt": "2024-05-24T15:20:00.000Z",
"voided": false
}
],
"payments": []
}
}
Response Details
Order Data
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the shipment was recorded. |
message | String | Result message. |
data | Object | The updated order. The new shipment is the last entry in fulfilledItems. See Get Order for shipment fields. |
Notes
- After the shipment, the order status becomes
fulfilledwhen every line is fully shipped, orpartially fulfilledotherwise. - Shipping labels can be generated when the order's shipping method uses the store's custom shipping integration. The ship-from address comes from the warehouse or the store's origin address settings.
- The customer receives a fulfillment email.
- To cancel a shipment, use Void Shipment.