labels
Purchase label with shipping rule
Purchase and print a shipping label using a Shipping Rule. The Shipping Rule automatically selects the optimal carrier and service based on the rule's configuration.
Dynamic Ordering: Service Group Rules can now use dynamic ordering (Cheapest or Fastest) to automatically rank eligible services in real time based on live rate or transit data. This feature is currently available for US sellers with USA domestic carrier services only. For more details, see the Configuring "Order Services By" guide.
The request body must NOT include carrier_id, service_code, or shipping_rule_id in the shipment object. If any of these fields are provided, the API will return a 400 Bad Request error.
post/v1/labels/shipping_rules/{shipping_rule_id}
Request body
Example request
{
"shipment": {
"external_order_id": "ext-order-123",
"items": [
{
"asin": "B00005N5PF"
}
],
"external_shipment_id": "ext-ship-123",
"shipment_number": "SHIP-001",
"ship_date": "2018-09-23T00:00:00.000Z",
"ship_to": {
"name": "John Doe",
"phone": "+1 204-253-9411 ext. 123",
"email": "example@example.com",
"company_name": "The Home Depot",
"address_line1": "1999 Bishop Grandin Blvd.",
"address_line2": "Unit 408",
"address_line3": "Building #7",
"city_locality": "Winnipeg",
"state_province": "Manitoba",
"postal_code": "78756-3717",
"country_code": "CA",
"geolocation": [
{
"type": "what3words",
"value": "cats.with.thumbs"
}
]
},
"ship_from": {
"name": "John Doe",
"phone": "+1 204-253-9411 ext. 123",
"email": "example@example.com",
"company_name": "The Home Depot",
"address_line1": "1999 Bishop Grandin Blvd.",
"address_line2": "Unit 408",
"address_line3": "Building #7",
"city_locality": "Winnipeg",
"state_province": "Manitoba",
"postal_code": "78756-3717",
"country_code": "CA",
"geolocation": [
{
"type": "what3words",
"value": "cats.with.thumbs"
}
]
},
"warehouse_id": "se-28529731",
"return_to": {
"name": "John Doe",
"phone": "+1 204-253-9411 ext. 123",
"email": "example@example.com",
"company_name": "The Home Depot",
"address_line1": "1999 Bishop Grandin Blvd.",
"address_line2": "Unit 408",
"address_line3": "Building #7",
"city_locality": "Winnipeg",
"state_province": "Manitoba",
"postal_code": "78756-3717",
"country_code": "CA",
"geolocation": [
{
"type": "what3words",
"value": "cats.with.thumbs"
}
]
},
"customs": {
"terms_of_trade_code": "ddp",
"contents": "gift",
"non_delivery": "return_to_sender"
},
"advanced_options": {
"bill_to_country_code": "CA",
"freight_class": "77.5",
"movement_indicator": "c2c",
"license_number": "514785",
"invoice_number": "IOC56888",
"certificate_number": "784515",
"fragile": true,
"delivery_as_addressed": true,
"return_after_first_attempt": true,
"netstamps_options": {
"row": 1,
"column": 1
}
},
"packages": [
{
"shipment_package_id": "se-28529731",
"package_id": "se-28529731",
"package_code": "small_flat_rate_box",
"content_description": "Hand knitted wool socks",
"products": [
{
"harmonized_tariff_code": "3926.1",
"country_of_origin": "CA",
"vat_rate": 0.2,
"manufacturer_product_id": "012345678905",
"manufacturer_ns_product_id": "MY-SKU-12345",
"cpsc_certificates": [
{
"certifier_id": "CERT-12345",
"certificate_version_id": "v1.0"
}
]
}
]
}
],
"comparison_rate_type": "retail"
},
"rma_number": "RMA-12345",
"outbound_label_id": "se-28529731",
"label_image_id": "img_DtBXupDBxREpHnwEXhTfgK"
}Response
The requested object creation was a success.
Example response
{
"label_id": "se-28529731",
"shipment_id": "se-28529731",
"shipment": {
"shipment_id": "se-28529731",
"carrier_id": "se-28529731",
"service_code": "usps_first_class_mail",
"shipping_rule_id": "se-28529731",
"items": [
{
"asin": "B00005N5PF"
}
],
"ship_date": "2018-09-23T00:00:00.000Z",
"created_at": "2018-09-23T15:00:00.000Z",
"modified_at": "2018-09-23T15:00:00.000Z",
"ship_to": {
"name": "John Doe",
"phone": "+1 204-253-9411 ext. 123",
"email": "example@example.com",
"company_name": "The Home Depot",
"address_line1": "1999 Bishop Grandin Blvd.",
"address_line2": "Unit 408",
"address_line3": "Building #7",
"city_locality": "Winnipeg",
"state_province": "Manitoba",
"postal_code": "78756-3717",
"country_code": "CA",
"geolocation": [
{
"type": "what3words",
"value": "cats.with.thumbs"
}
]
},
"ship_from": {
"name": "John Doe",
"phone": "+1 204-253-9411 ext. 123",
"email": "example@example.com",
"company_name": "The Home Depot",
"address_line1": "1999 Bishop Grandin Blvd.",
"address_line2": "Unit 408",
"address_line3": "Building #7",
"city_locality": "Winnipeg",
"state_province": "Manitoba",
"postal_code": "78756-3717",
"country_code": "CA",
"geolocation": [
{
"type": "what3words",
"value": "cats.with.thumbs"
}
]
},
"warehouse_id": "se-28529731",
"return_to": {
"name": "John Doe",
"phone": "+1 204-253-9411 ext. 123",
"email": "example@example.com",
"company_name": "The Home Depot",
"address_line1": "1999 Bishop Grandin Blvd.",
"address_line2": "Unit 408",
"address_line3": "Building #7",
"city_locality": "Winnipeg",
"state_province": "Manitoba",
"postal_code": "78756-3717",
"country_code": "CA",
"geolocation": [
{
"type": "what3words",
"value": "cats.with.thumbs"
}
]
},
"customs": {
"terms_of_trade_code": "ddp",
"contents": "gift",
"non_delivery": "return_to_sender"
},
"advanced_options": {
"bill_to_country_code": "CA",
"freight_class": "77.5",
"movement_indicator": "c2c",
"license_number": "514785",
"invoice_number": "IOC56888",
"certificate_number": "784515",
"fragile": true,
"delivery_as_addressed": true,
"return_after_first_attempt": true,
"netstamps_options": {
"row": 1,
"column": 1
}
},
"tags": [
{
"tag_id": 8712,
"name": "Fragile",
"color": "#FF0000"
}
],
"packages": [
{
"shipment_package_id": "se-28529731",
"package_id": "se-28529731",
"package_code": "small_flat_rate_box",
"content_description": "Hand knitted wool socks",
"products": [
{
"harmonized_tariff_code": "3926.1",
"country_of_origin": "CA",
"vat_rate": 0.2,
"manufacturer_product_id": "012345678905",
"manufacturer_ns_product_id": "MY-SKU-12345",
"cpsc_certificates": [
{
"certifier_id": "CERT-12345",
"certificate_version_id": "v1.0"
}
]
}
]
}
],
"comparison_rate_type": "retail",
"zone": 6
},
"ship_date": "2018-09-23T00:00:00.000Z",
"created_at": "2018-09-23T15:00:00.000Z",
"rate_details": [
{
"carrier_description": "Shipping",
"carrier_billing_code": "BaseServiceCharge",
"billing_source": "carrier"
}
],
"tracking_number": "782758401696",
"batch_id": "se-28529731",
"carrier_id": "se-28529731",
"outbound_label_id": "se-28529731",
"service_code": "usps_first_class_mail",
"package_code": "small_flat_rate_box",
"voided_at": "2018-09-23T15:00:00.000Z",
"label_image_id": "img_DtBXupDBxREpHnwEXhTfgK",
"carrier_code": "dhl_express",
"label_download": {
"href": "https://example.com/resource",
"pdf": "https://example.com/resource",
"png": "https://example.com/resource",
"zpl": "https://example.com/resource"
},
"form_download": {
"href": "https://example.com/resource"
},
"qr_code_download": {
"href": "https://example.com/resource"
},
"paperless_download": {
"href": "https://example.com/resource"
},
"insurance_claim": {
"href": "https://example.com/resource"
},
"packages": [
{
"package_code": "small_flat_rate_box",
"tracking_number": "1Z932R800392060079",
"label_download": {
"href": "https://example.com/resource",
"pdf": "https://example.com/resource",
"png": "https://example.com/resource",
"zpl": "https://example.com/resource"
},
"form_download": {
"href": "https://example.com/resource"
},
"qr_code_download": {
"href": "https://example.com/resource"
},
"paperless_download": {
"href": "https://example.com/resource"
},
"content_description": "Hand knitted wool socks",
"alternative_identifiers": [
{
"type": "last_mile_tracking_number",
"value": "12345678912345678912"
}
]
}
],
"alternative_identifiers": [
{
"type": "last_mile_tracking_number",
"value": "12345678912345678912"
}
],
"tracking_url": "https://www.fedex.com/fedextrack/?action=track&trackingnumber=1234",
"pickup_windows": [
{
"start_at": "2018-09-23T15:00:00.000Z",
"end_at": "2018-09-23T15:00:00.000Z",
"use_time_zone_iana": "Australia/Sydney"
}
],
"ship_to": {
"name": "John Doe",
"phone": "+1 204-253-9411 ext. 123",
"email": "example@example.com",
"company_name": "The Home Depot",
"address_line1": "1999 Bishop Grandin Blvd.",
"address_line2": "Unit 408",
"address_line3": "Building #7",
"city_locality": "Winnipeg",
"state_province": "Manitoba",
"postal_code": "78756-3717",
"country_code": "CA",
"geolocation": [
{
"type": "what3words",
"value": "cats.with.thumbs"
}
]
},
"void_type": "manual",
"refund_details": {
"request_date": "2018-09-23T15:00:00.000Z"
}
}