Backend API
A shipment represents physical fulfillment of a number of items after an order is placed. Shipments contain information about items being fulfilled, and shipping details such as address and tracking number.
Fields
id
objectIdUnique identifier for the shipment.
items
array of objectrequiredList of line items describing the products shipped.
id
objectIdautoUnique identifier for the shipment item.
order_item_id
objectIdID of the order item shipped.
product_id
objectIdrequiredID of the item product.
bundle_item_id
objectIdID of the order bundle item shipped, if applicable.
options
array of objectOptions from the order item shipped, if applicable.
id
stringUnique identifier for the object.
name
stringName of the product option.
value
stringName value of the product option.
product
productExpandable link to the item product.
quantity
intQuantity of the item shipped. Defaults to 1.
variant_id
objectIdID of the item variant, if applicable.
variant
variantExpandable link to the item variant, if applicable.
order_id
objectIdrequiredThe id of the order this shipment was created for.
canceled
booleanIndicates the shipment was canceled.
carrier
stringThe id of a third-party carrier offering the service, if applicable.
carrier_name
stringName of a third-party carrier offering the service, if applicable.
date_created
dateautoDate and time the shipment was created.
date_estimated
dateDate the expected shipment is meant to arrive at the destination, if applicable.
date_updated
daterequiredautoDate and time the shipment was last updated.
destination
objectThe customer's shipping address.
destination.name
stringrequiredDestination customer name.
destination.address1
stringrequiredDestination address line 1: street address/PO box/company name.
destination.address2
stringDestination address line 2: apartment/suite/unit/building.
destination.country
stringrequiredTwo-letter ISO code country code.
destination.city
stringDestination city/district/suburb/town/village.
destination.state
stringDestination state/county/province/region.
destination.zip
stringDestination zip/postal code.
destination.phone
stringDestination phone number.
notes
stringInternal admin notes, not visible to the customer.
notifications
NotificationExpandable list of notifications sent on behalf of the shipment.
number
stringautoUnique incremental shipment number, assigned automatically.
order
OrderExpandable link to the order.
origin
objectThe shipment origin location.
origin.location
stringID of the origin location, if applicable.
packages
array of objectList of packages included in this shipment.
height
floatHeight of the package in centimeters or inches.
length
floatLength of the package in centimeters or inches.
type
stringType of package. This value can be enumerated, representing the types of packages used by the fulfillment provider.
weight
floatWeight of the package in the unit of the store's default (lb, oz, lb).
width
floatWidth of the package in centimeters or inches.
service
stringThe id of a shipping service as configured in shipment settings.
service_name
stringName of the shipping service.
tracking_code
stringTracking code used to identify the shipment, if applicable.
label
objectThe order’s shipping label.
label.date_created
dateautoDate and time the label was created.
label.purchase
booleanWhen set to true, a shipment label will be purchased on-demand from the carrier. The carrier is set in label purchase settings.
label.image
objectAn image of the shipment label, if present.
image.id
objectIdrequiredUnique identifier for the image.
image.date_uploaded
dateDate the image was uploaded.
image.length
intSize of the image in bytes.
image.md5
stringAn MD5 hash of the image contents. This can be used to identify the image for caching purposes.
image.filename
stringOptional image name.
image.content_type
stringMIME content type of the image.
image.metadata
objectArbitrary image data, typically used to store custom values. See Frontend API for more details.
image.data
filedatarequiredA reference to the raw image data.
image.private
booleanIndicates the image is not visible to customers.
image.url
stringrequiredA public URL to reference the image. Updated automatically if image content changes.
image.width
intImage width in pixels, if applicable.
image.height
intImage height in pixels, if applicable.
label.date_purchased
dateThe shipment model
{
"id": "60f199509111e70000000089",
"items": [
{
"id": "5ca537326a0ec32a521139dd",
"order_item_id": null,
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2
}
],
"order_id": "60f199509111e7000000008b",
"date_created": "2021-07-16T14:36:00.413Z",
"date_updated": "2021-07-16T14:36:00.413Z",
"destination": {
"name": "Hieronymus Lex",
"address1": "South Watch Tower, Captain's Quarters",
"city": "Imperial City",
"state": "NY",
"zip": 11201,
"country": "US",
"phone": "(555) 555-5555"
},
"service": "imperial_express",
"tracking_code": "T192000000XYZ"
}
Create a new shipment. If you wish to generate your own unique ID for the record, it must use BSON ObjectID format for compatibility.
When fulfilling bundle items within a shipment, each item within the bundle will need to have shipment information added individually.
Arguments
items
array of objectrequiredList of line items describing the products shipped.
order_item_id
objectIdID of the order item shipped.
product_id
objectIdrequiredID of the item product.
product
productExpandable link to the product item.
bundle_item_id
objectIdID of the order bundle item shipped, if applicable.
options
array of objectOptions from the order item shipped, if applicable.
id
stringUnique identifier for the object.
name
stringName of the product option.
value
stringName value of the product option.
quantity
intQuantity of the item shipped. Defaults to 1.
variant_id
objectIdID of the item variant, if applicable.
variant
variantExpandable link to the item variant, if applicable.
id
objectIdautoUnique identifier for the shipment item.
order_id
objectIdrequiredID of the order this shipment was created for.
tracking_code
stringTracking code used to identify the shipment, if applicable.
order
OrderExpandable link to the order.
canceled
booleanIndicates the shipment was canceled.
carrier
stringID of a 3rd party carrier offering the service, if applicable.
carrier_name
stringName of a 3rd party carrier offering the service, if applicable.
date_estimated
dateDate the expected shipment is meant to arrive at the destination, if applicable.
destination
objectThe customer's shipping address.
destination.name
stringDestination customer name.
destination.address1
stringDestination address line 1: street address/PO box/company name.
destination.address2
stringDestination address line 2: apartment/suite/unit/building.
destination.city
stringDestination city/district/suburb/town/village.
destination.country
stringTwo-letter ISO code country code.
destination.phone
stringDestination phone number.
destination.state
stringDestination state/county/province/region.
destination.zip
stringDestination zip/postal code.
notes
stringInternal admin notes, not visible to the customer.
origin
objectThe shipment origin location.
origin.location
stringID of the origin location, if applicable.
packages
array of objectList of packages included in this shipment.
height
floatHeight of the package in centimeters or inches.
length
floatLength of the package in centimeters or inches.
type
stringType of package. This value can be enumerated, representing the types of packages used by the fulfillment provider.
weight
floatWeight of the package in the unit of the store's default (lb, oz, lb).
width
floatWidth of the package in centimeters or inches.
service
stringID of a shipping service as configured in shipment settings.
service_name
stringName of the shipping service.
notifications
NotificationExpandable list of notifications sent on behalf of the shipment.
number
stringautoUnique incremental shipment number, assigned automatically.
label
objectThe order’s shipping label.
label.purchase
booleanWhen set to true, a shipment label will be purchased on-demand from the carrier. The carrier is set in label purchase settings.
label.image
objectAn image of the shipment label, if present.
image.date_uploaded
dateDate the image was uploaded.
image.length
intSize of the image in bytes.
image.md5
stringAn MD5 hash of the image contents. This can be used to identify the image for caching purposes.
image.filename
stringOptional image name.
image.content_type
stringMIME content type of the image.
image.metadata
objectArbitrary image data, typically used to store custom values. See Frontend API for more details.
image.data
filedataA reference to the raw image data.
image.private
booleanIndicates the image is not visible to customers.
image.url
stringA public URL to reference the image. Updated automatically if image content changes.
image.width
intImage width in pixels, if applicable.
image.height
intImage height in pixels, if applicable.
label.date_purchased
dateconst swell = require('swell-node').init('store-id', 'secret-key');
await swell.post('/shipments', {
order_id: '5a9ea7ba3f95740a914267f1',
items: [
{
order_item_id: '5a9ea7ba3f95740a914267f2',
product_id: '5cad15bc9b14d1990724663a',
quantity: 2,
}
],
tracking_code: 'T192000000XYZ',
});
Response
{
"id": "5cad15bc9b14d1990724663a",
"number": "S10001",
"order_id": "5a9ea7ba3f95740a914267f1",
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"order_item_id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
...
}
],
"tracking_code": "T192000000XYZ",
...
}
Update an existing shipment using the ID that was obtained when it was created.
Arguments
id
objectIdrequiredUnique identifier for the shipment.
items
array of objectrequiredList of line items describing the products shipped.
order_item_id
objectIdID of the order item shipped.
product_id
objectIdrequiredID of the item product.
product
productExpandable link to the product item.
bundle_item_id
objectIdID of the order bundle item shipped, if applicable.
options
array of objectOptions from the order item shipped, if applicable.
id
stringUnique identifier for the object.
name
stringName of the product option.
value
stringName value of the product option.
quantity
intQuantity of the item shipped. Defaults to 1.
variant_id
objectIdID of the item variant, if applicable.
variant
variantExpandable link to the item variant, if applicable.
id
objectIdautoUnique identifier for the shipment item.
order_id
objectIdrequiredID of the order this shipment was created for.
tracking_code
stringTracking code used to identify the shipment, if applicable.
order
OrderExpandable link to the order.
canceled
booleanIndicates the shipment was canceled.
carrier
stringID of a 3rd party carrier offering the service, if applicable.
carrier_name
stringName of a 3rd party carrier offering the service, if applicable.
date_estimated
dateDate the expected shipment is meant to arrive at the destination, if applicable.
destination
objectThe customer's shipping address.
destination.name
stringDestination customer name.
destination.address1
stringDestination address line 1: street address/PO box/company name.
destination.address2
stringDestination address line 2: apartment/suite/unit/building.
destination.city
stringDestination city/district/suburb/town/village.
destination.country
stringTwo-letter ISO code country code.
destination.phone
stringDestination phone number.
destination.state
stringDestination state/county/province/region.
destination.zip
stringDestination zip/postal code.
notes
stringInternal admin notes, not visible to the customer.
origin
objectThe shipment origin location.
origin.location
stringID of the origin location, if applicable.
packages
array of objectList of packages included in this shipment.
height
floatHeight of the package in centimeters or inches.
length
floatLength of the package in centimeters or inches.
type
stringType of package. This value can be enumerated, representing the types of packages used by the fulfillment provider.
weight
floatWeight of the package in the unit of the store's default (lb, oz, lb).
width
floatWidth of the package in centimeters or inches.
service
stringID of a shipping service as configured in shipment settings.
service_name
stringName of the shipping service.
notifications
NotificationExpandable list of notifications sent on behalf of the shipment.
number
stringautoUnique incremental shipment number, assigned automatically.
label
objectThe order’s shipping label.
label.purchase
booleanWhen set to true, a shipment label will be purchased on-demand from the carrier. The carrier is set in label purchase settings.
label.image
objectAn image of the shipment label, if present.
image.id
objectIdrequiredUnique identifier for the image.
image.date_uploaded
dateDate the image was uploaded.
image.length
intSize of the image in bytes.
image.md5
stringAn MD5 hash of the image contents. This can be used to identify the image for caching purposes.
image.filename
stringOptional image name.
image.content_type
stringMIME content type of the image.
image.metadata
objectArbitrary image data, typically used to store custom values. See Frontend API for more details.
image.data
filedataA reference to the raw image data.
image.private
booleanIndicates the image is not visible to customers.
image.url
stringA public URL to reference the image. Updated automatically if image content changes.
image.width
intImage width in pixels, if applicable.
image.height
intImage height in pixels, if applicable.
label.date_purchased
dateconst swell = require('swell-node').init('store-id', 'secret-key');
await swell.put('/shipments/{id}', {
id: '60f199509111e70000000089',
tracking_code: 'T192000000XYZ'
});
Response
{
"id": "60f199509111e70000000089",
"items": [
{
"id": "5ca537326a0ec32a521139dd",
"order_item_id": null,
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2
}
],
"order_id": "60f199509111e7000000008e",
"date_created": "2021-07-16T14:36:00.413Z",
"date_updated": "2021-07-16T14:36:00.413Z",
"destination": {
"name": "Jon Snow",
"address1": "1 Main Street",
"city": "Brooklyn",
"state": "NY",
"zip": 11201,
"country": "US",
"phone": "(555) 555-5555"
},
"service": "fedex_ground",
"tracking_code": "T192000000XYZ"
}
Arguments
id
objectIdrequiredThe id of the shipment to retrieve.
expand
stringExpanding link fields and child collections is performed using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
fields
stringReturn only the specified fields in the result. For example fields=name,slug would return only the fields name and slug in the response. Supports nested object and array fields using dot-notation, for example, items.product_id. The category id is always returned.
include
stringInclude one or more arbitrary queries in the response, possibly related to the main query.
See including for more details.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/shipments/{id}', {
id: '60f199509111e70000000090'
});
Response
{
"id": "60f199509111e70000000094",
"items": [
{
"id": "5ca537326a0ec32a521139dd",
"order_item_id": null,
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2
}
],
"order_id": "60f199509111e70000000095",
"date_created": "2021-07-16T14:36:00.413Z",
"date_updated": "2021-07-16T14:36:00.413Z",
"destination": {
"name": "Jon Snow",
"address1": "1 Main Street",
"city": "Brooklyn",
"state": "NY",
"zip": 11201,
"country": "US",
"phone": "(555) 555-5555"
},
"service": "fedex_ground",
"tracking_code": "T192000000XYZ"
}
Return a list of shipments.
Arguments
expand
stringExpand link fields and child collections by using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
fields
stringReturns only the specified fields in the result.
- For example fields=name,slug would return only the fields name and slug in the response.
Supports nested object and array fields using dot-notation.
- For example, items.product_id. The product id is always returned.
include
objectInclude one or more arbitrary queries in the response which are potentially related to the main query.
See including for more details.
limit
intLimit the number of records returned, ranging between 1 and 1000. Defaults to 15.
page
intThe page number of results to return given the specified or default limit.
search
stringA text search is performed using the search argument. Searchable fields are defined by the model.
- For example, search=red would return records containing the word "red" anywhere in the defined text fields.
See searching for more details.
sort
stringExpression to sort results by using a format similar to a SQL sort statement.
- For example, sort=name asc would return records sorted by name ascending.
See sorting for more details.
where
objectAn object with criteria to filter the result.
- For example, active=true would return records containing a field active with the value true.
It's also possible to use query operators, for example, $eq, $ne, $gt, and more.
See querying for more details.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/shipments', {
limit: 25,
page: 1
});
Response
{
"count": 51,
"results": [
{
"id": "60f199509111e70000000089",
"items": [
{
"id": "5ca537326a0ec32a521139dd",
"order_item_id": null,
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2
}
],
"order_id": "60f199509111e70000000099",
"date_created": "2021-07-16T14:36:00.413Z",
"date_updated": "2021-07-16T14:36:00.413Z",
"destination": {
"name": "Jon Snow",
"address1": "1 Main Street",
"city": "Brooklyn",
"state": "NY",
"zip": 11201,
"country": "US",
"phone": "(555) 555-5555"
},
"service": "fedex_ground",
"tracking_code": "T192000000XYZ"
},
{...},
{...}
],
"page": 1,
"pages": {
"1": {
"start": 1,
"end": 25
},
"2": {
"start": 26,
"end": 50
},
"2": {
"start": 51,
"end": 51
}
}
}