Creates and pays for a shipment label using the rate_id obtained from a prior get_rates call. This endpoint also allows purchasing shipment insurance in the same request (insurance cannot be purchased separately).
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.
The unique identifier of a shipping rate returned by the get_rates endpoint. Use this value to reference a specific rate when purchasing a label.
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.
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/create_and_pay \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"rate_id": "dc288147-f7dd-494d-9353-5ce00020c7aa",
"platform_uk_id": "platformUkId175377917713",
"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" } }