Create a Shipment
Many ShipEngine endpoints require a shipment_id
, which is the unique identifier for a shipment object created in ShipEngine. You can think of shipment objects as the gatekeepers to more advanced functionality in ShipEngine.
Certain actions will automatically create a shipment object for you, like purchasing a label and rating multiple shipments. However, you can also create shipments independently so you can use shipment IDs for features like getting rates in bulk or batch shipping.
When you create a shipment, the response includes the shipment_id
. We also realize that you may have your own shipment identifier, which you can set using the external_shipment_id
field in the request body. The external_shipment_id
is useful with our responses to easily match them to your own records. Please note that when using the external_shipment_id
this ID must be unique. If you provide a duplicate ID, you receive an error message.
Requirements
When creating a shipment you can define multiple objects within the request body, but only a few are required.
carrier_id
service_code
ship_to
ship_from
The ship_to
and ship_from
objects have multiple required properties. Additionally, other objects may be necessary depending on what actions you plan to take. For example, cross-border shipments will need customs details, manifests will need ship_date
and warehouse_id
, and some shipments may need advanced options defined.
See the full API reference for details on the available objects and properties for the request body.
Example Request & Response
POST /v1/shipments
In this example, we create a single shipment and include an external_shipment_id
to demonstrate using this optional property, if needed.
The shipment_id
that is returned is the unique identifier inside of ShipEngine. Many of our endpoints require the use of our internal shipment_id
. The external_shipment_id
is useful with our responses to easily match them to your own records.
Response
Duplicate External Shipment ID Error
If you provide a duplicate external shipment ID, you'll receive an error message like this:
Notes about Creating Shipments
- Create multiple shipments: You can use this same method to create multiple shipments at once simply by adding more objects to the
shipments
array. The response will include the correspondingshipment_id
(and related properties) for each shipment you created. - Manifests: If you want your shipment to be included in amanifest, you'll need to provide the
warehouse_id
rather than theship_from
address in your request body. You can create a warehouse for each location that you want to create manifests for. - Getting shipment rates: You can also use the shipments endpoint to get rates. To do so, just include the
rate_options
field in the shipment payload.