Skip to main content

Buy Label Batch Labels

POST 

/api/shipping-label-batches/:shippingLabelBatch/purchase

Buys labels in the background, at each item's quoted rate. Without item_ids it buys the batch's rated items and resumes those still purchasing; failed rows are bought only when named in item_ids (e.g. Retry). An item whose purchase was already started at the provider is always resumed on the same attempt, never bought twice. Returns 202 with a background job id (tracked_job_log_id); poll the job, then read the batch and its items. While the job runs the batch is purchasing. Each bought label records a shipment on its fulfillment order (sales_order_fulfillment_id); an item whose label could not be bought ends failed with a failure_code. The batch then ends completed or completed_with_failures. Items bought earlier whose shipment was not recorded are finished too.

Required scope: orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Body (optional):

  • item_ids (array of item IDs, 1-500): buy only these items, failed ones included. Omit to buy the rated items and resume the purchasing ones.

409 when the batch is already being bought or rated. 422 when nothing is buyable, or when the run would start a fresh purchase (a rated row, or a purchasing / failed row with nothing at the provider) while rates are stale (options changed after rating: rate again) or the ship date is in the past. Resuming purchases already started and recording bought labels are never refused for those reasons.

Requires the orders write scope and the fulfillment_orders.index and fulfillment_orders.ship permissions.

Request​

Responses​

Accepted

Response Headers
    Content-Type