Swiftazu

Orders

Create orders in bulk

Create up to 100 orders in one call, with a result for each one.

POST/v1/orders/bulk
Bearer tokenIdempotency-KeyReturns JSONSuccess 200

Each order is checked and created on its own, so one bad order does not stop the others. The answer is always 200; read results to see which rows were created (ok: true) and why any row failed.

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
ordersrequiredarrayThe orders to create, each with the same fields as Create order. 1 to 100.
Example request
curl -X POST "https://api.swiftazu.com/v1/orders/bulk" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7c2f6f0a-3f55-4f0e-9a51-2a1e3b6c9d10" \
  -d '{
  "orders": [
    {
      "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
            }
          ]
        }
      ]
    },
    {
      "customerId": "8778df1e-9b74-420d-b826-d17cdad86d36",
      "customerAddressId": "0df7f36c-417a-4145-b956-743f66c4f9b7",
      "merchantReference": "WEB-10483",
      "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 · 200
{
  "total": 3,
  "created": 2,
  "failed": 1,
  "results": [
    {
      "index": 0,
      "ok": true,
      "id": "dffcd25d-6eb3-4b90-868c-6deca160ad74",
      "orderId": "SWZORDYFSADMR",
      "merchantReference": "WEB-10482"
    },
    {
      "index": 1,
      "ok": true,
      "id": "30b653a8-e845-425b-85a6-0d2a6f1a5a46",
      "orderId": "SWZORDLKCVYQB",
      "merchantReference": "WEB-10483"
    },
    {
      "index": 2,
      "ok": false,
      "code": "validation_failed",
      "message": "The order is not valid.",
      "details": [
        "boxes: boxes must contain at least 1 elements"
      ]
    }
  ]
}

Errors

HTTPCodeMeaning
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