Skip to content
Last updated

Rate Multiple Shipments

You can request rates for shipments in bulk using the /v1/rates/bulk endpoint. Unlike Get Shipping Rates method, this process is asynchronous.

If you subscribe to webhooks, you will receive a notification when the operation is complete. You can then retrieve the rates and create a label using the rate_id.

If you need to just rate a single shipment, see the Calculate Shipping Rates page.

Example Requests

POST /v1/rates/bulk

In this sample, we request rates for shipments that were previously created by passing the shipment_ids property.

POST /v1/rates/bulk HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json

{
  "shipment_ids": [
    "se-2127226",
    "se-2127227"
  ],
  "rate_options": {
    "carrier_ids": [
      "se-123890",
      "se-121861"
    ]
  }
}

Alternatively, you can include the shipment object in the rate request rather than referencing an existing shipment. In this case, a shipment will be created for you and include a shipment_id with each rate.

POST /v1/rates/bulk HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json

{
  "rate_options": {
    "carrier_ids": [
      "se-123890",
      "se-123890"
    ]
  },
  "shipments": [{
      "ship_to": {
        "name": "Amanda Miller",
        "phone": "555-555-5555",
        "address_line1": "525 S Winchester Blvd",
        "city_locality": "San Jose",
        "state_province": "CA",
        "postal_code": "95128",
        "country_code": "US",
        "address_residential_indicator": "yes"
      },
      "ship_from": {
        "company_name": "Example Corp.",
        "name": "John Doe",
        "phone": "111-111-1111",
        "address_line1": "4009 Marathon Blvd",
        "address_line2": "Suite 300",
        "city_locality": "Austin",
        "state_province": "TX",
        "postal_code": "78756",
        "country_code": "US",
        "address_residential_indicator": "no"
      },
      "confirmation": "none",
      "packages": [{
        "package_code": "package",
        "weight": {
          "value": 12,
          "unit": "ounce"
        }
      }]
    },
    {
      "ship_to": {
        "name": "Amanda Miller",
        "phone": "555-555-5555",
        "address_line1": "525 S Winchester Blvd",
        "city_locality": "San Jose",
        "state_province": "CA",
        "postal_code": "95128",
        "country_code": "US",
        "address_residential_indicator": "yes"
      },
      "ship_from": {
        "company_name": "Example Corp.",
        "name": "John Doe",
        "phone": "111-111-1111",
        "address_line1": "4009 Marathon Blvd",
        "address_line2": "Suite 300",
        "city_locality": "Austin",
        "state_province": "TX",
        "postal_code": "78756",
        "country_code": "US",
        "address_residential_indicator": "no"
      },
      "confirmation": "none",
      "packages": [{
        "package_code": "package",
        "weight": {
          "value": 1,
          "unit": "pound"
        }
      }]
    },
    {
      "ship_to": {
        "name": "Waffle HQ",
        "company_name": "Waffle House",
        "address_line1": "5986 Financial Drive",
        "address_line2": null,
        "address_line3": null,
        "city_locality": "Norcross",
        "state_province": "GA",
        "postal_code": "30071",
        "country_code": "US",
        "phone": "111-111-1111"
      },
      "ship_from": {
        "company_name": "Example Corp.",
        "name": "John Doe",
        "phone": "111-111-1111",
        "address_line1": "4009 Marathon Blvd",
        "address_line2": "Suite 300",
        "city_locality": "Austin",
        "state_province": "TX",
        "postal_code": "78756",
        "country_code": "US",
        "address_residential_indicator": "no"
      },
      "confirmation": "none",
      "packages": [{
        "package_code": "package",
        "weight": {
          "value": 1,
          "unit": "ounce"
        }
      }]
    },
    {
      "ship_to": {
        "name": "Jony Ive",
        "company_name": "Apple",
        "address_line1": "1 Infinite Loop",
        "address_line2": null,
        "address_line3": null,
        "city_locality": "Cupertino",
        "state_province": "CA",
        "postal_code": "95014",
        "country_code": "US",
        "phone": "408-996-1010"
      },
      "ship_from": {
        "company_name": "Example Corp.",
        "name": "John Doe",
        "phone": "111-111-1111",
        "address_line1": "4009 Marathon Blvd",
        "address_line2": "Suite 300",
        "city_locality": "Austin",
        "state_province": "TX",
        "postal_code": "78756",
        "country_code": "US",
        "address_residential_indicator": "no"
      },
      "confirmation": "none",
      "packages": [{
        "package_code": "package",
        "weight": {
          "value": 1,
          "unit": "ounce"
        }
      }]
    },
    {
      "ship_to": {
        "name": "Amanda Miller",
        "phone": "555-555-5555",
        "address_line1": "525 S Winchester Blvd",
        "city_locality": "San Jose",
        "state_province": "CA",
        "postal_code": "95128",
        "country_code": "US",
        "address_residential_indicator": "yes"
      },
      "ship_from": {
        "company_name": "Example Corp.",
        "name": "John Doe",
        "phone": "111-111-1111",
        "address_line1": "4009 Marathon Blvd",
        "address_line2": "Suite 300",
        "city_locality": "Austin",
        "state_province": "TX",
        "postal_code": "78756",
        "country_code": "US",
        "address_residential_indicator": "no"
      },
      "confirmation": "none",
      "packages": [{
        "package_code": "package",
        "weight": {
          "value": 1,
          "unit": "ounce"
        }
      }]
    }
  ]
}

Example Response

Due to the length of the response, we have truncated this example to only show a single rate. When you run this command, you will notice many more rates returned in the response.

[
  {
    "rate_request_id": 501846,
    "shipment_id": "se-2127226",
    "status": "working",
    "created_at": "2019-07-25T15:24:46.657Z"
  },
  {
    "rate_request_id": 501847,
    "shipment_id": "se-2127227",
    "status": "working",
    "created_at": "2019-07-25T15:24:46.657Z"
  }
]