Ship From a Warehouse

You likely have one or more warehouse locations that you frequently ship from, in which case it would be annoying to have to specify the ship_from and return_to addresses on every shipment. The solution is to Create a Warehouse, then you can simply pass the warehouse_id instead.

Using warehouses also allows you to Create Manifests of everything you're shipping from each warehouse.

Example

POST /v1/shipments/

The following example demonstrates how to create a shipment using a warehouse_id instead of a ship_from address. Other than that, it's the same as the normal Create a Shipment workflow.

Example Request

curl -iX POST https://api.shipengine.com/v1/shipments \
-H 'Content-Type: application/json' \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-d '
{
  "shipments": [
    {
      "service_code": "usps_priority_mail",
      "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"
      },
      "warehouse_id": "se-277331",
      "packages": [
        {
          "weight": {
            "value": 1.0,
            "unit": "ounce"
          }
        }
      ]
    }
  ]
}'
POST /v1/shipments HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
Content-Length: 1054

{
  "shipments": [
    {
      "service_code": "usps_priority_mail",
      "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"
      },
      "warehouse_id": "se-277331",
      "packages": [
        {
          "weight": {
            "value": 1.0,
            "unit": "ounce"
          }
        }
      ]
    }
  ]
}
  • curl
  • http

Example Response

{
  "has_errors": false,
  "shipments": [
    {
      "errors": null,
      "address_validation": {
        "status": "verified",
        "original_address": {
          "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"
        },
        "matched_address": {
          "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"
        },
        "messages": []
      },
      "shipment_id": "se-202927168",
      "carrier_id": "se-123890",
      "service_code": "usps_priority_mail",
      "external_shipment_id": null,
      "ship_date": "2018-02-12T00:00:00Z",
      "created_at": "2018-02-13T02:17:28.5734844Z",
      "modified_at": "2018-02-13T02:17:28.5734844Z",
      "shipment_status": "pending",
      "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"
      },
      "warehouse_id": "se-277331",
      "return_to": {
        "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",
      "customs": null,
      "advanced_options": {
        "bill_to_account": null,
        "bill_to_country_code": null,
        "bill_to_party": null,
        "bill_to_postal_code": null,
        "contains_alcohol": false,
        "delivered_duty_paid": false,
        "non_machinable": false,
        "saturday_delivery": false,
        "freight_class": null,
        "custom_field1": null,
        "custom_field2": null,
        "custom_field3": null
      },
      "insurance_provider": "none",
      "tags": [],
      "packages": [
        {
          "package_code": "package",
          "weight": {
            "value": 1.0,
            "unit": "ounce"
          },
          "dimensions": {
            "unit": "inch",
            "length": 0.0,
            "width": 0.0,
            "height": 0.0
          },
          "insured_value": {
            "currency": "usd",
            "amount": 0.0
          },
          "label_messages": {
            "reference1": null,
            "reference2": null,
            "reference3": null
          }
        }
      ],
      "total_weight": {
        "value": 1.0,
        "unit": "ounce"
      }
    }
  ]
}

Overriding the Return Address

By default, specifying a warehouse_id will automatically set ship_from and return_to addresses of the shipment. But there are some scenarios where you may want to override the return address that's printed on the shipping label. ShipEngine allows you to do that by specifying a return_to address in addition to the warehouse_id.

This feature is currently only supported for Stamps.com, Endicia, FedEx, UPS, and DHL E-Commerce. Please let us know if you need support for additional carriers.

Example HTTP Request
POST /v1/shipments HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
Content-Length: 1054

{
  "shipments": [
    {
      "service_code": "usps_priority_mail",
      "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"
      },
      "return_to": {
        "name": "Example Corp. Returns",
        "phone": "222-222-2222",
        "company_name": "Example Corp.",
        "address_line1": "345 Chambers Street",
        "address_line2": "Suite 100",
        "address_line3": null,
        "city_locality": "New York City",
        "state_province": "NY",
        "postal_code": "10282",
        "country_code": "US",
        "address_residential_indicator": "unknown"
      },
      "warehouse_id": "se-277331",
      "packages": [
        {
          "weight": {
            "value": 1.0,
            "unit": "ounce"
          }
        }
      ]
    }
  ]
}
  • http
Example CURL Request
curl -iX POST https://api.shipengine.com/v1/shipments \
-H 'Content-Type: application/json' \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-d '
{
  "shipments": [
    {
      "service_code": "usps_priority_mail",
      "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"
      },
      "return_to": {
        "name": "Example Corp. Returns",
        "phone": "222-222-2222",
        "company_name": "Example Corp.",
        "address_line1": "345 Chambers Street",
        "address_line2": "Suite 100",
        "address_line3": null,
        "city_locality": "New York City",
        "state_province": "NY",
        "postal_code": "10282",
        "country_code": "US",
        "address_residential_indicator": "unknown"
      },
      "warehouse_id": "se-277331",
      "packages": [
        {
          "weight": {
            "value": 1.0,
            "unit": "ounce"
          }
        }
      ]
    }
  ]
}'
  • curl