Retrieve Shipping Label Rates & Purchase Least Expensive Rate

When to Use & Considerations

  • This endpoint will retrieve shipping rates for items in a given order and purchase the cheapest rate among them.

    • Note: media mail / library labels cannot be purchased with this structure.
  • See ShippingRate for all available parameters.

  • See 'Purchase a Shipping Label' to purchase a specific rate returned from this endpoint.

  • On success, the response status will be 200 multipart/mixed; boundary=”boundary” (where "boundary" is a unique value per response)

    • A collection of shipping rates are returned as application/json in the first part of the body

    • If PurchaseCheapestRate is specified on the request, ChannelAdvisor will also purchase a label for the lowest shipping service and return the label data as an attachment.

  • Note: ShippingLabelRequestID ensures a label purchase request is not duplicated.

Resource URL / Endpoint

POST https://api.channeladvisor.com/v1/Orders(OrderID)/ShippingRates


Important and/or Required Parameters.

PropertyFormatRequiredNote
WeightUnitstring Required Valid values are: Gram, Pound

Weight

decimal Required Total weight of the package
ItemsCollection Required An array of ShippingItems
DistributionCenterIDinteger Conditionally Required if no source address information is provided. Only used for address lookup and will not update fulfillment with the provided DistributionCenterID. 
PackageIDinteger Conditionally Required if package dimension is not provided
PurchaseCheapestRate booleanOptionalRequired if you want to purchase a label within the label rate request.
If specified, we will purchase the shipping service associated with the lowest cost (excludes purchasing media mail / library labels)
LabelFormatenum Optional Valid values are: PDF, ZPL. The default value is PDF
ShippingLabelRequestIDstring (50)Recommended

Seller supplied unique identifier for the label purchase request. Supply this value in each request to ensure duplicate labels are not purchased.

Note: once set, this value is applied on the Fulfillment and will not be returned in the response. If a future request is supplied with the same ID, the response will supply the existing label. See Purchase Shipping Label with Existing Request ID.


Example Request
POST https://api.channeladvisor.com/v1/Orders(12345678)/ShippingRates?access_token=xxxxxxxxxx
{
  "MeasurementUnit": "Inch", 
  "Height": 10,
  "Width": 12,
  "Length": 12,
  "Weight": 1000,
  "WeightUnit": "Gram",
  "SourceFirstName": "ShipperFirstName",
  "SourceLastName": "ShipperLastName",
  "SourceAddressLine1": "100 Main Ave",
  "SourceCity": "Raleigh",
  "SourceStateOrProvince": "NC",
  "SourcePostalCode": "27615",
  "SourceCountryCode": "US",
  "SourcePhoneNumber": "919-555-1234",
  "DestinationFirstName": "BuyersFirstName",
  "DestinationLastName": "BuyersLastName",
  "DestinationAddressLine1": "3025 Carrington Mill Blvd",
  "DestinationCity": "Morrisville",
  "DestinationStateOrProvince": "NC",
  "DestinationPostalCode": "27560",
  "DestinationCountryCode": "US",
  "DestinationPhoneNumber": "919-555-1234",
  "Items": [
    {
      "Quantity": 1,
      "Sku": "MyTestSku"
    }
  ],
  "PurchaseCheapestRate": true,
  "ShippingLabelPartnerAccountIDs": [500],
  "LabelFormat": "ZPL",
  "ShippingLabelRequestID": "9bagr9lmodz83l4k9dkngksoq"
}
Example Response (Success)
200 OK

--ldffp37k2vseqd50bzep5z3svkdfl1mv
Content-Type: application/json

{
  "ShippingRates": [
    {
      "ShippingLabelPartnerAccountID": 500,
      "RateID": "19090424-201b-4ae4-91a0-a960592a9045",
      "ServiceName": "First Overnight",
      "ServiceCode": "FIRST_OVERNIGHT",
      "ServiceOfferID": null,
      "CarrierID": 2,
      "ClassID": 5,
      "TransitDays": "UNKNOWN",
      "DeliveryDate": "06/09/2020 8:00:00 AM",
      "Cost": 79.15,
      "WarningMessage": null
    },
    {
      "ShippingLabelPartnerAccountID": 500,
      "RateID": "3bc3b248-93db-4492-a0d5-fba4a09ed313",
      "ServiceName": "Priority Overnight",
      "ServiceCode": "PRIORITY_OVERNIGHT",
      "ServiceOfferID": null,
      "CarrierID": 2,
      "ClassID": 23,
      "TransitDays": "UNKNOWN",
      "DeliveryDate": "06/02/2020 10:30:00 AM",
      "Cost": 46.98,
      "WarningMessage": null
    }
  ],
  "Errors": [],
  "ExpiresInSeconds": 1800
}
--ldffp37k2vseqd50bzep5z3svkdfl1mv
Content-Disposition: attachment; filename=label.ZPL
Content-Type: application/text
  
^XA^CF,0,0,0^PR12^MD30^PW800^POI^CI13^LH0,20
^FO12,124^GB755,2,2^FS
^FO12,390^GB777,2,2^FS
^FO32,3^AdN,0,0^FWN^FH^FDFROM:^FS
^FO32,19^AdN,0,0^FWN^FH^FDAmazing Shoes^FS
^FO32,37^AdN,0,0^FWN^FH^FD^FS
^FO32,55^AdN,0,0^FWN^FH^FD123 Test^FS
^FO32,73^AdN,0,0^FWN^FH^FD^FS
^FO32,109^AdN,0,0^FWN^FH^FDUS ^FS
^FO224,3^AdN,0,0^FWN^FH^FD(919) 555-1234^FS
etc...

--ldffp37k2vseqd50bzep5z3svkdfl1mv--
Content-Type: application/json

{
  "ShippingLabelUrl": "https://api.channeladvisor.com/v1/Fulfillments(456789123)/Label",
  "FulfillmentID": 456789123,
  "Cost": 46.98,
  "CarrierID": 2,
  "ClassID": 23,
  "DeliveryDate": "06/02/2020",
  "TrackingNumber": "123456789",
  "LabelFormat": "ZPL"
}
--ldffp37k2vseqd50bzep5z3svkdfl1mv--