Orders
Update order
Change an order before it is collected.
PATCH
/v1/orders/{orderId}Bearer tokenReturns JSONSuccess 200
An order can be edited while it is Pending or Ready for Pickup. Send only what you want to change. Sending boxes replaces all boxes and recalculates the totals. After collection the order can no longer be edited through the API.
Request
Headers
| Field | Type | Description |
|---|---|---|
Authorizationrequired | string | The access token from Get token, as "Bearer <token>". |
Content-Typerequired | string | Always application/json when a body is sent. |
Path parameters
| Field | Type | Description |
|---|---|---|
orderIdrequired | string | The order's id (the UUID, not the short Order ID). |
Request body
| Field | Type | Description |
|---|---|---|
customerAddressIdoptional | string | The delivery address: an address id of that customer. |
merchantReferenceoptional | string | Your own order number, up to 100 characters. It must be unique among your orders that are not cancelled. |
serviceIdoptional | string | The delivery service, from List services. |
paymentModeoptional | prepaid | cod | prepaid: you pay the shipping charge. cod: cash is collected from the customer at delivery. |
codAmountoptional | number | The cash to collect. Required when paymentMode is cod. |
insuranceElectedoptional | boolean | Insure this shipment. The premium is added at dispatch. |
declaredValueoptional | number | The value of the goods. Insurance and customs duty are worked out from it. |
deliveryContactNameoptional | string | Who receives the shipment, if not the address contact. |
deliveryAltPhoneoptional | string | A second phone number for delivery. |
deliveryInstructionsoptional | string | Instructions for the driver. |
boxesoptional | array | The boxes of the shipment. At least one. On an update, this replaces all boxes. |
boxes[].lengthrequired | number | Length in cm. |
boxes[].widthrequired | number | Width in cm. |
boxes[].heightrequired | number | Height in cm. |
boxes[].standardBoxIdoptional | string | A standard box id, from List standard boxes. |
boxes[].isFragileoptional | boolean | Handling flags: isFragile, isLiquid, isBattery, isPerishable, isOversize. |
boxes[].itemsrequired | array | The products in the box. At least one. |
boxes[].items[].productNamerequired | string | Product name. |
boxes[].items[].skuoptional | string | Your product code. |
boxes[].items[].quantityrequired | number | How many, 1 or more. |
boxes[].items[].unitPricerequired | number | Price of one unit. |
boxes[].items[].unitWeightrequired | number | Weight of one unit in kg. |
boxes[].items[].hsCodeoptional | string | Customs (HS) code. Needed for cross-border orders. |
boxes[].items[].originCountryIdoptional | string | The country the product was made in. |
customsoptional | object | Customs details. Required for a cross-border order. |
customs.exportReasonrequired | sale | gift | sample | return_goods | repair | Why the goods are being sent. |
customs.incotermrequired | ddp | dap | Who pays duties: ddp (you) or dap (the receiver). |
customs.declaredCustomsValuerequired | number | The value declared to customs. |
customs.declaredCurrencyrequired | string | Currency of the declared value, as a 3-letter code. |
Example request
curl -X PATCH "https://api.swiftazu.com/v1/orders/dffcd25d-6eb3-4b90-868c-6deca160ad74" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"deliveryInstructions": "Leave with reception"
}'Response
Example response · 200
{
"status": "ok"
}Errors
| HTTP | Code | Meaning |
|---|---|---|
| 404 | not_found | The record does not exist, or it is not yours. |
| 400 | invalid_request | The request broke a business rule. message says which one. |
| 409 | duplicate_merchant_reference | Another order of yours (not cancelled) already uses this merchantReference. Send a new one. |
Every call can also return the shared errors listed on the Overview page. Overview