- Directly Buy Label
Creates and purchases a shipment label in a single step without calling get_rates separately.
This endpoint currently supports USPS Returns service levels. See the Appendix for the full list of supported values.
To prevent duplicate purchases caused by network fluctuations or retries, the API checks ether a shipment already exists under the specified platform_uk_id.
- If a related shipment is found, the existing shipment information will be returned, and the
duplicate_labelfield in the response will be set totrue. - If no shipment exists, a new shipment will be created as normal, and the
duplicate_labelfield will befalse.
A unique identifier provided by the calling party (e.g., the caller’s order number). Each platform_uk_id must correspond to exactly one shipment and cannot be reused across multiple shipments.
Carrier code identifier.
Carrier service level. See Appendix - Carrier Service Types for the valid relationships between carrier_code, provider_id, and service_level.
Address where the package should be returned if undeliverable or returned to sender. Note: Only USPS supports printing a dedicated return address on the label.
Timestamp in ISO 8601 format, including local time and time zone offset.
Defines the label print format. Supported types vary by carrier and may also depend on the selected service level. For example, USPS and FedEx may support qrcode, while UPS may support barcode.
Indicates whether the label is for a return shipment.
curl -i -X POST \
https://x-api.shipsaving.com/api/shipment/direct_buy \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"platform_uk_id": "platformUkId175377917713",
"carrier_code": "USPS",
"service_level": "USPS_GROUND_ADVANTAGE",
"return_address_data": {
"first_name": "Alice",
"last_name": "Green",
"company_name": "ShipSaving",
"phone": "1234567890",
"email": "it@shipsaving.com",
"street": "xxxx Olive Street",
"street2": "STE XXX",
"city": "Los Angeles",
"state": "CA",
"zip_code": "021XX",
"country": "US"
},
"from_address_data": {
"first_name": "Alice",
"last_name": "Green",
"company_name": "ShipSaving",
"phone": "1234567890",
"email": "it@shipsaving.com",
"street": "xxxx Olive Street",
"street2": "STE XXX",
"city": "Los Angeles",
"state": "CA",
"zip_code": "021XX",
"country": "US"
},
"to_address_data": {
"first_name": "Alice",
"last_name": "Green",
"company_name": "ShipSaving",
"phone": "1234567890",
"email": "it@shipsaving.com",
"street": "xxxx Olive Street",
"street2": "STE XXX",
"city": "Los Angeles",
"state": "CA",
"zip_code": "021XX",
"country": "US",
"address_type": "residential"
},
"package_data": {
"type": "my_package",
"length": 10,
"width": 10,
"height": 10,
"weight": 10,
"carrier_package_code": "USPS_SMALL_FLAT_RATE_BOX",
"dimension_unit": "in",
"weight_unit": "lb"
},
"option_data": {
"signature": "signature",
"custom_text_on_label_1": "Please put the package in the locker.",
"custom_text_on_label_2": "Please put the package in the locker.",
"hazardous_materials": true,
"is_lithium_battery": false,
"additional_handling": false,
"require_saturday_delivery": false
},
"ship_date": "2025-07-31T00:00:00+08:00",
"custom_data": {
"signing_person": "Ray",
"content_type": "merchandise",
"tax_ids": [
{
"tax_id_type": "TIN",
"tax_id_number": "tin2888",
"country_code": "US"
}
],
"eel_pfc_type": "ITN",
"eel_pfc_code": "X20250719123456",
"undeliverable_option": "return_to_sender",
"item_data_list": [
{
"description": "cloth",
"quantity": 10,
"origin": "US",
"weight": 10,
"unit_cost": 19.99,
"weight_unit": "lb",
"hs_tariff_number": "xx"
}
]
},
"insurance_data": {
"rate_id": "dc288147-f7dd-494d-9353-5ce00020c7aa"
},
"label_print_type": "common",
"is_return_label": false,
"is_exchange_label": false
}'{ "code": "ok", "msg": "ok", "data": { "zone": "1", "currency": "USD", "shipment_no": "1222243159", "tracking_no": "9234690381085700XXXXX", "total_fee": 39.39, "label_fee": 39.39, "insurance_fee": null, "label_processing_fee": 0.05, "label_urls": [ … ], "qrcode_urls": [ … ], "commercial_urls": null, "duplicate_label": true, "label_print_type": "common" } }