Rates & Labels

To ship an order, get rates for it, then buy the recommended rate with the purchaseToken that comes with it. Only the rate ShipWave recommends carries a token, so it is the only rate you can buy through this API. The other rates are returned for comparison.

ShipWave packs each order into one box or several. A single-box order is bought from rates[]. A multi-box order is bought from aggregatedRates[], which totals one rate per box.

Every price is what your account is charged. Each rate, totalRate and recommendation.rate in the rates response, and the rate on each purchased label, is the amount ShipWave charges your account for that label, in USD. Buying the recommended rate charges exactly the price it was quoted at. A multi-box price is the sum of each box's label price.

Both endpoints need the write:orders scope. Getting rates is a POST, so it counts as a write call. See Authentication.


Get Shipping Rates

POST /api/v1/orders/:id/rates

Packs the order, fetches carrier rates for each package, and marks one rate as recommended. Only that rate includes a purchaseToken.

By default, ShipWave recommends the lowest-priced eligible rate. Your automation rules can change that: a rule that sets a carrier or service, or a rule that prefers one carrier over another. recommendation.source says which kind of rule applied.

Requirements

  • An assigned warehouse. Otherwise you get 400 (No warehouse assigned to this order).
  • No active shipment. An order with a label that hasn't been voided returns 409. To rate the remaining quantities of a partly shipped order, send fulfillmentItems (see Partial Fulfillment).
  • Stock at the assigned warehouse for the items being rated. If the warehouse can't fulfill them, you get 400 with each short SKU's needed and available quantity.
  • Product catalog data for every shippable line item. The item's SKU must match a product variant in the store's catalog. The variant needs a length and width greater than 0, a height (0 is accepted for letters and flats), and a weight. If any are missing, you get 400 listing the SKUs, for example Cannot generate label. Missing dimensions: SKU-123. Please set product defaults before shipping. A missing weight returns the same kind of message. A line item with no SKU is reported as missing. Variants marked as not requiring shipping are skipped.
    • To skip the catalog for a whole-order quote, set all four package overrides on the order with PUT /orders/:id: lengthOverride, widthOverride, heightOverride and weightOverrideOz. The three dimension overrides alone skip the dimension check, but each SKU still needs a catalog weight. Overrides are ignored when you send fulfillmentItems.
    • For a partial shipment, you can skip the catalog by sending exact cartons in packages.
  • Customs data for international orders. When the destination country differs from the warehouse country, each line item needs a SKU, and its catalog variant needs an HS code and a country of origin. Otherwise you get 400 listing what is missing. A US address with a territory or military state code (for example PR, GU or AE) also gets customs information, but the HS code and country of origin are not required for it. When a line item has a SKU override, customs data comes from the override SKU's variant, the same variant used for its dimensions.
  • A phone number for the label. Carriers such as FedEx require a phone on the label. When the order's shipping address has no phone, ShipWave puts your warehouse address's phone on the label instead. If neither has one, you get 400 asking you to add a phone to the order's shipping address or to the warehouse address.
  • A billing account that can pay for labels. If the account can't be billed, you get 402 PAYMENT_REQUIRED before any carrier rates are fetched.

Request Body (optional)

You can send no body at all to rate the whole order.

FieldTypeRequiredDescription
fulfillmentItemsarraynoRate only these items and quantities. See Partial Fulfillment
packagesarraynoExact cartons to rate instead of letting ShipWave estimate boxes. Requires fulfillmentItems
customsValuesobjectnoPer-unit declared customs value in USD, keyed by SKU, e.g. {"SKU-123": 45.00}. Use the SKU shown in customsItems[].code: the line item's SKU override when it has one. Only allowed on shipments that require customs. Each SKU must be in this shipment, and each value must be at least 0.01 with no more than two decimal places
enforceDgCompliancebooleannoWhen true, rates that fail ShipWave's dangerous-goods checks cannot be recommended. Defaults to false, which reports findings in dgCompliance without changing the recommendation

Fulfillment item object:

FieldTypeRequiredDescription
orderItemIdstringyesLine item ID from the order
quantityintegernoUnits to ship, 1 or more (default 1). It cannot exceed the item's unfulfilled quantity

Package object:

FieldTypeRequiredDescription
weightOzintegeryesCarton weight in ounces, 1–2400
lengthnumberyesInches, greater than 0 and at most 200
widthnumberyesInches, greater than 0 and at most 200
heightnumberyesInches, greater than 0 and at most 200
itemIdsstring[]yesOrder item IDs in this carton, listed once per unit

Send 1 to 100 packages. Taken together, the packages' itemIds must exactly match the units in fulfillmentItems. ShipWave puts each carton's dimensions in longest-first order and raises them to at least 6 × 3 × 0.25 inches.

Example

curl -X POST https://shipwave.app/api/v1/orders/clx1abc2d3efg/rates \
  -H "Authorization: Bearer sw_live_abc123..."
const res = await fetch(
  "https://shipwave.app/api/v1/orders/clx1abc2d3efg/rates",
  {
    method: "POST",
    headers: { Authorization: "Bearer sw_live_abc123..." },
  }
);
const { data } = await res.json();

Response (Single-Box)

When the order packs into one box, buy from rates[]. Rate objects are abridged here; see Rate Object. Purchase tokens are shown as placeholders.

{
  "data": {
    "orderId": "clx1abc2d3efg",
    "customsItems": [],
    "easypostShipmentId": "shp_abc123",
    "rates": [
      {
        "easypostId": "rate_abc456",
        "carrier": "UPS",
        "service": "Ground",
        "rate": 9.75,
        "deliveryDays": 5,
        "deliveryDate": "2026-10-27T00:00:00Z",
        "is_regional": false,
        "recommended": true,
        "purchaseToken": "<purchaseToken for rate_abc456>"
      },
      {
        "easypostId": "rate_xyz789",
        "carrier": "USPS",
        "service": "Priority",
        "rate": 12.5,
        "deliveryDays": 2,
        "deliveryDate": "2026-10-23T00:00:00Z",
        "is_regional": false,
        "recommended": false
      }
    ],
    "isMultiBox": false,
    "packageCount": 1,
    "aggregatedRates": [
      {
        "carrier": "UPS",
        "service": "Ground",
        "totalRate": 9.75,
        "perBoxRateIds": ["rate_abc456"],
        "perBoxShipmentIds": ["shp_abc123"],
        "deliveryDays": 5,
        "is_regional": false,
        "recommended": true,
        "purchaseToken": "<separate multi-box token; use rates[] instead>"
      },
      {
        "carrier": "USPS",
        "service": "Priority",
        "totalRate": 12.5,
        "perBoxRateIds": ["rate_xyz789"],
        "perBoxShipmentIds": ["shp_abc123"],
        "deliveryDays": 2,
        "is_regional": false,
        "recommended": false
      }
    ],
    "recommendation": {
      "singleRateId": "rate_abc456",
      "aggregatedRateKey": "shp_abc123|rate_abc456",
      "carrier": "UPS",
      "service": "Ground",
      "rate": 9.75,
      "source": "cheapest"
    },
    "perBoxShipments": [
      {
        "packageIndex": 0,
        "easypostShipmentId": "shp_abc123",
        "weightLbs": 4.2,
        "dimensions": { "length": 12, "width": 10, "height": 6 },
        "rates": [
          { "easypostId": "rate_abc456", "carrier": "UPS", "service": "Ground", "rate": 9.75, "deliveryDays": 5, "is_regional": false },
          { "easypostId": "rate_xyz789", "carrier": "USPS", "service": "Priority", "rate": 12.5, "deliveryDays": 2, "is_regional": false }
        ],
        "itemIds": ["clx1item1", "clx1item1"]
      }
    ],
    "fulfillmentScope": null,
    "addressVerification": {
      "deliverySuccess": true,
      "deliveryErrors": [],
      "correctedAddress": null,
      "hasCorrectedFields": false,
      "correctedFields": []
    },
    "dgCompliance": {
      "checked": false,
      "enforced": false,
      "hasRestrictions": false,
      "messages": [],
      "restrictions": []
    },
    "purchaseTokenTtlSeconds": 900
  }
}

A single-box response also lists every rate in aggregatedRates, and the recommended entry there carries its own token. Buying with that token works, but it returns the multi-box response shape. For single-box orders, use the token from rates[].

Response (Multi-Box)

When the order needs several boxes, rates is empty and easypostShipmentId is box 1's shipment. Buy from aggregatedRates[]. Each aggregated rate combines one rate per box.

{
  "data": {
    "orderId": "clx1abc2d3efg",
    "customsItems": [],
    "easypostShipmentId": "shp_box1",
    "rates": [],
    "isMultiBox": true,
    "packageCount": 2,
    "aggregatedRates": [
      {
        "carrier": "UPS",
        "service": "Ground",
        "totalRate": 45.95,
        "perBoxRateIds": ["rate_a1", "rate_a2"],
        "perBoxShipmentIds": ["shp_box1", "shp_box2"],
        "deliveryDays": 4,
        "is_regional": false,
        "recommended": true,
        "purchaseToken": "<purchaseToken for UPS Ground, both boxes>"
      },
      {
        "carrier": "FedEx",
        "service": "FEDEX_GROUND",
        "totalRate": 50.3,
        "perBoxRateIds": ["rate_b1", "rate_b2"],
        "perBoxShipmentIds": ["shp_box1", "shp_box2"],
        "deliveryDays": 5,
        "is_regional": false,
        "recommended": false
      }
    ],
    "recommendation": {
      "singleRateId": null,
      "aggregatedRateKey": "shp_box1|rate_a1,shp_box2|rate_a2",
      "carrier": "UPS",
      "service": "Ground",
      "rate": 45.95,
      "source": "cheapest"
    },
    "perBoxShipments": [
      {
        "packageIndex": 0,
        "easypostShipmentId": "shp_box1",
        "weightLbs": 35,
        "dimensions": { "length": 24, "width": 16, "height": 14 },
        "rates": [
          { "easypostId": "rate_a1", "carrier": "UPS", "service": "Ground", "rate": 24.1, "deliveryDays": 4, "is_regional": false },
          { "easypostId": "rate_b1", "carrier": "FedEx", "service": "FEDEX_GROUND", "rate": 26.4, "deliveryDays": 5, "is_regional": false }
        ],
        "itemIds": ["clx1item1", "clx1item2"]
      },
      {
        "packageIndex": 1,
        "easypostShipmentId": "shp_box2",
        "weightLbs": 30,
        "dimensions": { "length": 24, "width": 16, "height": 12 },
        "rates": [
          { "easypostId": "rate_a2", "carrier": "UPS", "service": "Ground", "rate": 21.85, "deliveryDays": 4, "is_regional": false },
          { "easypostId": "rate_b2", "carrier": "FedEx", "service": "FEDEX_GROUND", "rate": 23.9, "deliveryDays": 5, "is_regional": false }
        ],
        "itemIds": ["clx1item1"]
      }
    ],
    "fulfillmentScope": null,
    "addressVerification": {
      "deliverySuccess": true,
      "deliveryErrors": [],
      "correctedAddress": null,
      "hasCorrectedFields": false,
      "correctedFields": []
    },
    "dgCompliance": {
      "checked": false,
      "enforced": false,
      "hasRestrictions": false,
      "messages": [],
      "restrictions": []
    },
    "purchaseTokenTtlSeconds": 900
  }
}

In this example, line item clx1item1 has quantity 2, so it appears in both boxes.

Response Fields

FieldTypeDescription
orderIdstringThe order ID
customsItemsarrayCustoms lines ShipWave will declare. Empty when the shipment doesn't need customs. See Customs Item Object
easypostShipmentIdstringThe shipment to buy for a single-box order. For a multi-box order, box 1's shipment
ratesarraySingle-box rates, lowest price first, each priced at what your account is charged. Empty for multi-box orders. See Rate Object
isMultiBoxbooleantrue when the order needs more than one box
packageCountnumberNumber of boxes
aggregatedRatesarrayOne entry per combined option across all boxes. See Aggregated Rate Object
recommendationobjectSummary of the rate to buy. See Recommendation Object
perBoxShipmentsarrayOne entry per box, also for single-box orders. See Per-Box Shipment Object
fulfillmentScopeobject | nullThe items being rated when you sent fulfillmentItems, otherwise null
addressVerificationobject | nullThe carrier's delivery-address check. null when no verification result came back
dgComplianceobjectDangerous-goods findings. See Dangerous Goods
purchaseTokenTtlSecondsnumberToken lifetime in seconds (900, 15 minutes)

Rate Object

Entries in rates[].

FieldTypeDescription
easypostIdstringRate ID (rate_...)
carrierstringCarrier name, e.g. USPS, UPS, FedEx
servicestringService level, e.g. Priority, Ground
ratenumberPrice in USD your account is charged for this label
deliveryDaysnumber | nullEstimated transit days
deliveryDatestring | nullEstimated delivery date (ISO 8601)
recommendedbooleantrue for the one rate ShipWave recommends
purchaseTokenstringPresent only on the recommended rate

Rate objects can also include informational fields such as is_regional, programs, timeInTransitP85, predictedDeliveryDate and deliveryAccuracy. Which ones appear varies. They are not needed to buy a label.

Aggregated Rate Object

Entries in aggregatedRates[].

FieldTypeDescription
carrierstringCarrier name, or Mixed when the least-rate combination uses different carriers or services per box
servicestringService level, or LeastRate for a Mixed combination
totalRatenumberPrice in USD your account is charged for all the boxes: the sum of each box's label price
perBoxShipmentIdsstring[]Shipment ID for each box
perBoxRateIdsstring[]Rate ID for each box, in the same order as perBoxShipmentIds
deliveryDaysnumber | nullEstimated transit days
is_regionalbooleanWhether the option relies on a regional carrier
isMixedCarrierbooleanPresent on the least-rate combination; true when its boxes use different carriers or services
perBoxRatesarrayPresent on the least-rate combination: carrier, service, rate (the price you are charged for that box), deliveryDays and is_regional for each box
recommendedbooleantrue for the one aggregated rate ShipWave recommends
purchaseTokenstringPresent only on the recommended aggregated rate

Recommendation Object

FieldTypeDescription
singleRateIdstring | nullID of the recommended entry in rates[]. null for multi-box orders
aggregatedRateKeystring | nullShipment and rate pairs of the recommended aggregated rate, as shp_...|rate_... joined by commas
carrierstring | nullCarrier of the rate to buy
servicestring | nullService of the rate to buy
ratenumber | nullPrice your account is charged for the rate to buy: the rates[] entry's rate for single-box, the aggregated totalRate for multi-box
sourcestringcheapest, carrier_service_rule (one of your rules sets a carrier or service for this order) or carrier_preference (one of your rules prefers one carrier over another). A rule that sets only a service limits the recommendation to that service on single-box and multi-box orders alike, when the service was quoted

For a single-box order, carrier, service and rate describe the rate named by singleRateId, the rates[] entry with recommended: true. In rare cases aggregatedRateKey points to a different rate. Use singleRateId. For a multi-box order, the fields describe the recommended aggregated rate.

If no rate can be recommended, both IDs are null and no rate has a token. This can happen when enforceDgCompliance excludes every rate.

Per-Box Shipment Object

FieldTypeDescription
packageIndexnumberZero-based box index
easypostShipmentIdstringShipment ID for this box (shp_...)
weightLbsnumberEstimated box weight in pounds (0 when no estimate was made)
dimensionsobjectBox length, width and height in inches
ratesarrayThis box's rates: easypostId, carrier, service, rate (the price you are charged for this box's label), deliveryDays, is_regional, plus informational fields
itemIdsstring[]Order item IDs packed in this box, listed once per unit. Can be empty when ShipWave did not allocate items to boxes, for example when it used order-level overrides

Customs Item Object

FieldTypeDescription
codestringSKU
descriptionstringCustoms description from the product, or the SKU
quantitynumberUnits
weightnumberWeight per unit in ounces
valuenumberDeclared value per unit in USD. It is derived from the order line price unless you send customsValues
hs_tariff_numberstringHS code from the product
origin_countrystringCountry of origin from the product

Dangerous Goods

dgCompliance reports ShipWave's dangerous-goods checks for the rated carriers and services.

FieldTypeDescription
checkedbooleantrue when at least one item has dangerous-goods data to check
enforcedbooleanEchoes enforceDgCompliance
hasRestrictionsbooleantrue when any rated carrier or service is restricted
messagesstring[]Unique restriction reasons
restrictionsarrayOne { carrier, service, reason } entry per restricted carrier and service

With enforceDgCompliance: true, restricted rates are still listed but cannot be recommended. Send enforceDgCompliance: true on the label purchase as well, and ShipWave rechecks the bought carrier and service before buying.

Purchase Token

A purchaseToken authorizes the purchase of one recommended rate.

  • It is an opaque string. Pass it back exactly as you received it, and don't parse, store long-term, or change it.
  • It expires after purchaseTokenTtlSeconds (900 seconds, 15 minutes). After that, request new rates.
  • It works only for the order it was issued for and the API key that fetched the rates. Using it on another of your orders, or with another of your API keys, returns 403.
  • It fixes the shipment and rate to buy, and, for partial fulfillment, the items covered.

If no rate has a token, fix the cause first: stock, warehouse, catalog data, dangerous-goods restrictions, or your automation rules.

Errors

StatusCodeCause
400VALIDATION_ERRORNo warehouse is assigned to the order
400VALIDATION_ERRORThe assigned warehouse can't fulfill the items being rated: not enough stock, or the warehouse isn't eligible for this order
400VALIDATION_ERRORA SKU has no catalog match, or its variant is missing dimensions or weight
400VALIDATION_ERRORInternational order is missing a SKU, HS code or country of origin
400VALIDATION_ERRORNeither the order's shipping address nor the warehouse address has a phone number
400VALIDATION_ERRORInvalid fulfillmentItems (empty, an item not on this order, a non-shippable item, or more than the unfulfilled quantity), packages or customsValues
402PAYMENT_REQUIREDThe account has no business billing account that can pay for labels. details.reason names the cause
403FORBIDDENThe API key lacks the write:orders scope
403FORBIDDENThe API key can't use raw fulfillment endpoints (it carries the deny:raw_fulfillment permission)
404NOT_FOUNDThe order doesn't exist or belongs to another account
409CONFLICTThe order already has an active shipment and the request has no fulfillmentItems
500INTERNAL_ERRORRates could not be fetched, for example because the warehouse address is incomplete or the carrier request failed

Authentication and rate-limit errors (401, 429) are described in Errors.


Purchase a Label (Single-Box)

POST /api/v1/orders/:id/labels

Buys the recommended single-box rate. The token decides what is bought. Any IDs you also send must match it.

Request Body

FieldTypeRequiredDescription
purchaseTokenstringyesToken from the recommended entry in rates[]
easypostShipmentIdstringnoIf sent, must equal the token's shipment (the rates response's easypostShipmentId). Otherwise 400
rateIdstringnoIf sent, must equal the token's rate (the recommended entry's easypostId). Otherwise 400
fulfillmentItemsarraynoOnly for tokens from a partial-fulfillment quote. If sent, must match the token's items. You can send itemIds (one order item ID per unit) instead
printbooleannotrue queues the label to your configured label printer. Defaults to false
enforceDgCompliancebooleannotrue rechecks dangerous-goods restrictions for the carrier and service before buying. If the check fails, the purchase fails

Example

These IDs and the token come from the recommended rate in the single-box rates response.

curl -X POST https://shipwave.app/api/v1/orders/clx1abc2d3efg/labels \
  -H "Authorization: Bearer sw_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "purchaseToken": "<purchaseToken for rate_abc456>",
    "easypostShipmentId": "shp_abc123",
    "rateId": "rate_abc456"
  }'
// rateData is the `data` object from POST /orders/:id/rates
const recommended = rateData.rates.find((rate) => rate.recommended && rate.purchaseToken);

const res = await fetch(
  "https://shipwave.app/api/v1/orders/clx1abc2d3efg/labels",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer sw_live_abc123...",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      purchaseToken: recommended.purchaseToken,
      easypostShipmentId: rateData.easypostShipmentId, // "shp_abc123"
      rateId: recommended.easypostId,                 // "rate_abc456"
    }),
  }
);
const { data } = await res.json(); // 201 Created

Response (201 Created)

{
  "data": {
    "shipment": {
      "id": "clx2ship1",
      "trackingCode": "1Z999AA10123456784",
      "labelUrl": "https://easypost-files.s3.amazonaws.com/files/postage_label/20261020/label.png",
      "carrier": "UPS",
      "service": "Ground",
      "rate": 9.75
    },
    "orderStatus": "shipped",
    "trackingPushResult": null,
    "print": {
      "requested": false,
      "jobs": [],
      "skippedReason": "print not requested"
    }
  }
}
FieldTypeDescription
shipmentobjectThe new label: ShipWave shipment id, trackingCode, labelUrl, carrier, service and rate, the price in USD your account was charged for it
orderStatusstring | nullThe order's shipping status after this label: pending, partially_shipped or shipped
trackingPushResultobject | nullFor a partial-fulfillment purchase on a Shopify store, the result of pushing the scoped fulfillment and tracking to Shopify (success, plus error on failure). Otherwise null
printobjectSee Print Object

The charge is taken from your shipping balance when the label is bought. ShipWave also sends a shipment.created webhook for the label, with the same rate.

FieldTypeDescription
requestedbooleanWhether you sent print: true
jobsarrayQueued print jobs: id, status, shipmentId, trackingCode
skippedReasonstring | nullprint not requested, printer settings not configured, or null when jobs were queued

Purchase Labels (Multi-Box)

POST /api/v1/orders/:id/labels

Buys one label per box for the recommended aggregated rate. ShipWave buys the boxes one at a time, in box order.

Request Body

FieldTypeRequiredDescription
purchaseTokenstringyesToken from the recommended entry in aggregatedRates[]
purchasesarraynoPer-box entries, used to attach itemIds to each box. If omitted, the token's boxes are bought as they are
printbooleannotrue queues every label to your configured label printer
enforceDgCompliancebooleannotrue rechecks dangerous-goods restrictions for each box before buying it

Per-box purchase object:

FieldTypeRequiredDescription
easypostShipmentIdstringyesThe box's shipment ID
rateIdstringyesThe box's rate ID
itemIdsstring[]noOrder item IDs in this box, listed once per unit. Use perBoxShipments[].itemIds from the rates response

If you send purchases, it must contain exactly the shipment and rate pairs in the token: perBoxShipmentIds[i] with perBoxRateIds[i]. If any box has itemIds, every box must. When the token comes from a partial-fulfillment quote, it already holds each box's items, and any itemIds you send must match them.

Example

These IDs and the token come from the recommended aggregated rate in the multi-box rates response.

curl -X POST https://shipwave.app/api/v1/orders/clx1abc2d3efg/labels \
  -H "Authorization: Bearer sw_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "purchaseToken": "<purchaseToken for UPS Ground, both boxes>",
    "purchases": [
      {
        "easypostShipmentId": "shp_box1",
        "rateId": "rate_a1",
        "itemIds": ["clx1item1", "clx1item2"]
      },
      {
        "easypostShipmentId": "shp_box2",
        "rateId": "rate_a2",
        "itemIds": ["clx1item1"]
      }
    ]
  }'

Response (201 Created)

{
  "data": {
    "isMultiBox": true,
    "shipments": [
      {
        "id": "clx2ship1",
        "trackingCode": "1Z999AA10123456784",
        "labelUrl": "https://easypost-files.s3.amazonaws.com/files/postage_label/20261020/box1.png",
        "carrier": "UPS",
        "service": "Ground",
        "rate": 24.1,
        "boxIndex": 0
      },
      {
        "id": "clx2ship2",
        "trackingCode": "1Z999AA10123456785",
        "labelUrl": "https://easypost-files.s3.amazonaws.com/files/postage_label/20261020/box2.png",
        "carrier": "UPS",
        "service": "Ground",
        "rate": 21.85,
        "boxIndex": 1
      }
    ],
    "orderStatus": "shipped",
    "trackingPushResults": [
      { "orderId": "clx1abc2d3efg", "orderNumber": "#1042", "success": true },
      { "orderId": "clx1abc2d3efg", "orderNumber": "#1042", "success": true }
    ],
    "print": {
      "requested": false,
      "jobs": [],
      "skippedReason": "print not requested"
    }
  }
}

When the purchase carries itemIds and the store is a Shopify store, trackingPushResults has up to one entry per box: the result of pushing that box's fulfillment and tracking to Shopify. Otherwise it is empty. ShipWave sends a shipment.created webhook for each label.

If a Box Fails

ShipWave does not buy the boxes as one unit. If a box fails, the request stops, and ShipWave voids each label it already bought in that request with the carrier, the same way POST /shipments/:id/void does. A label counts as voided only when the carrier accepts the void. The response says what happened to each one:

{
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Failed on box 2 of 2: <reason>. The label already bought in this request was voided.",
    "details": {
      "failedBoxIndex": 1,
      "rolledBack": true,
      "voidedShipmentCount": 1,
      "voidFailedShipmentCount": 0,
      "labels": [
        {
          "shipmentId": "clx2ship1",
          "boxIndex": 0,
          "trackingCode": "1Z999AA10123456784",
          "voidStatus": "voided",
          "refundStatus": "submitted"
        }
      ]
    }
  }
}

The status and code follow the failed box's cause, as for a single-box purchase: 402 PAYMENT_REQUIRED for a funding problem, 409 CONFLICT for a voided label or a missing Shopify order, 502 when the carrier rejected the box, 503 while a purchase is being reconciled, and 500 for anything else. details.reason is set for the first four.

FieldTypeDescription
failedBoxIndexnumberZero-based index of the box that failed
rolledBackbooleantrue when every label bought in this request was voided (also true when none had been bought)
voidedShipmentCountnumberLabels the carrier accepted a void for
voidFailedShipmentCountnumberLabels that were not voided and are still active
labelsarrayOne entry per label bought in this request: shipmentId, boxIndex, trackingCode, voidStatus, refundStatus, and message when the void did not go through

voidStatus is one of:

  • voided: the carrier accepted the void. refundStatus is the carrier's refund state (submitted or refunded). Any balance credit follows the void refund rules.
  • void_failed: the carrier refused the void. The label is still active and is recorded with status void_failed.
  • not_voided: the void could not be confirmed (for example the carrier could not be reached, or the label was already scanned). The label is still active.

When a label is still active, the message says so, for example 0 of 1 labels already bought in this request were voided; 1 could not be voided and is still active.

To recover:

  1. Don't retry with the same token.
  2. Void any label whose voidStatus is not voided, if you don't want it, with POST /shipments/:id/void. You can also check the order with GET /orders/:id: a shipment with voidedAt: null is still active.
  3. Request new rates and buy with the new token.

Partial Fulfillment

To ship part of an order, send fulfillmentItems when you request rates:

curl -X POST https://shipwave.app/api/v1/orders/clx1abc2d3efg/rates \
  -H "Authorization: Bearer sw_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "fulfillmentItems": [
      { "orderItemId": "clx1item1", "quantity": 1 }
    ]
  }'
  • Each quantity can't be more than the item's unfulfilled quantity, which excludes units already on an active label.
  • An order that already has active shipments can be rated this way for its remaining quantities.
  • ShipWave packs the selected items from product catalog data. Order-level weight and dimension overrides don't apply. To set exact cartons, add packages.
  • The response's fulfillmentScope lists the items being rated:
"fulfillmentScope": {
  "itemIds": ["clx1item1"],
  "items": [
    { "orderItemId": "clx1item1", "sku": "SKU-123", "name": "Widget", "quantity": 1 }
  ]
}

The purchase token covers exactly these items, so buy the label with the token alone. On a Shopify store, ShipWave then pushes a fulfillment for just those line items, and the label response reports the result in trackingPushResult (trackingPushResults for multi-box). orderStatus is partially_shipped until every shippable unit is on an active label.

With exact cartons:

{
  "fulfillmentItems": [{ "orderItemId": "clx1item1", "quantity": 2 }],
  "packages": [
    { "weightOz": 480, "length": 18, "width": 14, "height": 10, "itemIds": ["clx1item1"] },
    { "weightOz": 480, "length": 18, "width": 14, "height": 10, "itemIds": ["clx1item1"] }
  ]
}

Retries and Idempotency

Replaying a successful purchase. If you POST again with the same token, while it is still valid, after the purchase succeeded, you get 200 OK with the existing labels instead of a new purchase:

  • Single-box: { "shipment": { ... }, "print": { ... } }
  • Multi-box: { "isMultiBox": true, "shipments": [ ... ], "print": { ... } }

A replay doesn't include orderStatus or tracking push results. If the replay sends print: true, ShipWave queues another print job.

A purchase already in progress. Only one label purchase can run for an order at a time, whether it comes from the API, the dashboard or auto-ship. The same applies while ShipWave is changing the order's address or items. During that time, you get 409 CONFLICT with A label is already being bought for this order (auto-ship or another buy). Refresh the order in a few seconds before buying another label. Wait a few seconds and retry.

Timeouts, 500s and 503s (single-box). Retry the same request with the same token while it is still valid. If the first attempt bought the label, you get it back. ShipWave won't buy a second label for the same shipment.

Timeouts (multi-box). Give the first request time to finish, since each box is bought separately. Then call GET /orders/:id. If every box has an active shipment, the purchase succeeded. Otherwise, follow If a Box Fails.

After the token expires. A retry after 15 minutes returns 400 VALIDATION_ERROR with Invalid purchaseToken: Token expired. Requesting new rates won't help if the label was bought: the order now has an active shipment, so rates return 409 CONFLICT. To recover, call GET /orders/:id and read its shipments. An entry whose shipment.voidedAt is null is the active label, with its trackingCode and labelUrl.

After voiding a label. Request new rates before buying again. Reusing a still-valid token from the voided purchase returns 409 CONFLICT with details.reason: "label_refunded", because a voided label can't be bought again.


End-to-End Example

const API = "https://shipwave.app/api/v1";
const headers = {
  Authorization: `Bearer ${process.env.SHIPWAVE_API_KEY}`,
  "Content-Type": "application/json",
};

async function shipOrder(orderId: string) {
  // 1. Get rates
  const ratesRes = await fetch(`${API}/orders/${orderId}/rates`, {
    method: "POST",
    headers,
  });
  const ratesBody = await ratesRes.json();
  if (!ratesRes.ok) {
    throw new Error(`${ratesRes.status} ${ratesBody.error.code}: ${ratesBody.error.message}`);
  }
  const rateData = ratesBody.data;

  // 2. Build the purchase from the recommended rate
  let purchase: Record<string, unknown>;
  if (rateData.isMultiBox) {
    const chosen = rateData.aggregatedRates.find((r) => r.recommended && r.purchaseToken);
    if (!chosen) throw new Error("No purchasable rate. Check dgCompliance and the order setup.");

    const boxes = chosen.perBoxShipmentIds.map((shipmentId: string, i: number) => ({
      easypostShipmentId: shipmentId,
      rateId: chosen.perBoxRateIds[i],
      itemIds:
        rateData.perBoxShipments.find((b) => b.easypostShipmentId === shipmentId)?.itemIds ?? [],
    }));
    const everyBoxHasItems = boxes.every((b) => b.itemIds.length > 0);

    purchase = {
      purchaseToken: chosen.purchaseToken,
      // Optional: link each box's label to the items packed in it
      ...(everyBoxHasItems && { purchases: boxes }),
    };
  } else {
    const chosen = rateData.rates.find((r) => r.recommended && r.purchaseToken);
    if (!chosen) throw new Error("No purchasable rate. Check dgCompliance and the order setup.");

    purchase = {
      purchaseToken: chosen.purchaseToken,
      easypostShipmentId: rateData.easypostShipmentId,
      rateId: chosen.easypostId,
    };
  }

  // 3. Buy the label(s): 201 for a new purchase, 200 for a replay
  const labelRes = await fetch(`${API}/orders/${orderId}/labels`, {
    method: "POST",
    headers,
    body: JSON.stringify(purchase),
  });
  const labelBody = await labelRes.json();
  if (!labelRes.ok) {
    throw new Error(`${labelRes.status} ${labelBody.error.code}: ${labelBody.error.message}`);
  }

  const labels = labelBody.data.isMultiBox ? labelBody.data.shipments : [labelBody.data.shipment];
  for (const label of labels) {
    console.log(`${label.carrier} ${label.service}: ${label.trackingCode} ${label.labelUrl}`);
  }
}

Errors

StatusCodeCause
400VALIDATION_ERRORThe request body isn't valid JSON
400VALIDATION_ERRORThe order is blocked from fulfillment by a hold (Order … is blocked from fulfillment: …)
400VALIDATION_ERRORNo warehouse is assigned to the order
400VALIDATION_ERRORInvalid purchaseToken: …: missing, malformed, invalid signature, or Token expired
400VALIDATION_ERROReasypostShipmentId, rateId, purchases, itemIds or fulfillmentItems don't match the token. Also returned when item IDs are sent with a token that has no item scope, or include items not on this order
400VALIDATION_ERRORNot enough stock at the assigned warehouse, or the items are no longer unfulfilled
402PAYMENT_REQUIREDThe account can't pay for the label: the shipping balance is too low, funding is past due or not approved, a payment method is missing or needs confirmation, or the plan's label limit is reached. The message says what to fix, and details.reason names the cause (for example insufficient_balance)
403FORBIDDENpurchaseToken does not match this order/API key
403FORBIDDENThe API key lacks the write:orders scope, or carries the deny:raw_fulfillment permission
404NOT_FOUNDThe order doesn't exist or belongs to another account
409CONFLICTAnother label purchase for this order is in progress
409CONFLICTThe order already has an active shipment that this token didn't buy, and the purchase isn't limited to specific items
409CONFLICTThe token's label was voided (details.reason: "label_refunded"). Request new rates and buy with the new token
409CONFLICTThe linked Shopify order can't be found
502INTERNAL_ERRORThe carrier rejected the purchase (details.reason: "carrier_rejected"). When the carrier explained why, for example a missing phone or an invalid address, the message includes it. Fix the order and request new rates
503INTERNAL_ERRORThe carrier has not confirmed whether the label was bought (details.reason: "purchase_reconciliation_required"). Retry the same request with the same token in a minute
500INTERNAL_ERRORAny other failure, for example a pre-purchase check. Single-box returns Internal server error. Multi-box returns Failed on box N of M: … (see If a Box Fails)
Rates & Labels — API Documentation | ShipWave