Swiftazu

Orders

Create order

Create an order with its boxes and the products inside them.

POST/v1/orders
Bearer tokenIdempotency-KeyReturns JSONSuccess 201

The order starts as Pending and gets an Order ID. It is not priced yet: the price is set when you dispatch it. Send your own order number as merchantReference. The same checks as in the portal apply: the destination must be covered, the service must allow the payment mode, and a cross-border order needs its customs details.

Request

Headers

FieldTypeDescription
AuthorizationrequiredstringThe access token from Get token, as "Bearer <token>".
Content-TyperequiredstringAlways application/json when a body is sent.
Idempotency-KeyoptionalstringOptional. Your own unique value for this action (up to 200 characters). Sending the same call again with the same value returns the first result and does nothing a second time.

Request body

FieldTypeDescription
customerIdrequiredstringThe customer the order is for.
customerAddressIdrequiredstringThe delivery address: an address id of that customer.
merchantReferenceoptionalstringYour own order number, up to 100 characters. It must be unique among your orders that are not cancelled.
serviceIdoptionalstringThe delivery service, from List services.
paymentModerequiredprepaid | codprepaid: you pay the shipping charge. cod: cash is collected from the customer at delivery.
codAmountoptionalnumberThe cash to collect. Required when paymentMode is cod.
insuranceElectedoptionalbooleanInsure this shipment. The premium is added at dispatch.
declaredValueoptionalnumberThe value of the goods. Insurance and customs duty are worked out from it.
deliveryContactNameoptionalstringWho receives the shipment, if not the address contact.
deliveryAltPhoneoptionalstringA second phone number for delivery.
deliveryInstructionsoptionalstringInstructions for the driver.
boxesrequiredarrayThe boxes of the shipment. At least one. On an update, this replaces all boxes.
boxes[].lengthrequirednumberLength in cm.
boxes[].widthrequirednumberWidth in cm.
boxes[].heightrequirednumberHeight in cm.
boxes[].standardBoxIdoptionalstringA standard box id, from List standard boxes.
boxes[].isFragileoptionalbooleanHandling flags: isFragile, isLiquid, isBattery, isPerishable, isOversize.
boxes[].itemsrequiredarrayThe products in the box. At least one.
boxes[].items[].productNamerequiredstringProduct name.
boxes[].items[].skuoptionalstringYour product code.
boxes[].items[].quantityrequirednumberHow many, 1 or more.
boxes[].items[].unitPricerequirednumberPrice of one unit.
boxes[].items[].unitWeightrequirednumberWeight of one unit in kg.
boxes[].items[].hsCodeoptionalstringCustoms (HS) code. Needed for cross-border orders.
boxes[].items[].originCountryIdoptionalstringThe country the product was made in.
customsoptionalobjectCustoms details. Required for a cross-border order.
customs.exportReasonrequiredsale | gift | sample | return_goods | repairWhy the goods are being sent.
customs.incotermrequiredddp | dapWho pays duties: ddp (you) or dap (the receiver).
customs.declaredCustomsValuerequirednumberThe value declared to customs.
customs.declaredCurrencyrequiredstringCurrency of the declared value, as a 3-letter code.
Example request
curl -X POST "https://api.swiftazu.com/v1/orders" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7c2f6f0a-3f55-4f0e-9a51-2a1e3b6c9d10" \
  -d '{
  "customerId": "8778df1e-9b74-420d-b826-d17cdad86d36",
  "customerAddressId": "0df7f36c-417a-4145-b956-743f66c4f9b7",
  "merchantReference": "WEB-10482",
  "serviceId": "5c8e7ef4-e345-433f-baa7-43921d5a9332",
  "paymentMode": "prepaid",
  "insuranceElected": true,
  "declaredValue": 350,
  "boxes": [
    {
      "length": 30,
      "width": 20,
      "height": 15,
      "items": [
        {
          "productName": "Linen shirt",
          "sku": "LS-001",
          "quantity": 2,
          "unitPrice": 120,
          "unitWeight": 0.4
        },
        {
          "productName": "Canvas tote",
          "sku": "CT-014",
          "quantity": 1,
          "unitPrice": 110,
          "unitWeight": 0.6
        }
      ]
    }
  ]
}'

Response

Example response · 201
{
  "id": "dffcd25d-6eb3-4b90-868c-6deca160ad74",
  "orderId": "SWZORDYFSADMR",
  "storeId": "100001",
  "status": "pending",
  "isDemo": true
}

Errors

HTTPCodeMeaning
400invalid_requestThe request broke a business rule. message says which one.
403demo_allowance_exhaustedThe demo Application has used all of its demo orders. The answer carries demoAllowance and demoOrdersUsed.
409duplicate_merchant_referenceAnother order of yours (not cancelled) already uses this merchantReference. Send a new one.
400invalid_idempotency_keyThe Idempotency-Key header is empty or longer than 200 characters.
409idempotency_in_progressA call with this key is still running. Retry shortly.
409idempotency_key_reusedThis key was already used for a different call.

Every call can also return the shared errors listed on the Overview page. Overview