Buy a shipping label (costs money)
shipcloud_create_shipment_with_labelWRITE, COSTS MONEY: create a shipment AND buy its shipping label at the carrier (create_shipping_label=true). With a LIVE key this charges the shipcloud account (price in EUR excl. VAT; get it first from shipcloud_get_shipment_quote) and creates a real label; with the sandbox key it is free and fake. A label can only be cancelled before the carrier's cut-off (about 17:00-20:00) with shipcloud_delete_shipment. The request is sent ONCE and never retried: if it times out or fails with a server error, the label may still exist, so check shipcloud_list_shipments with the same reference_number before trying again. An existing-label lookup and same-instance guard reduce duplicates but are not atomic or global: simultaneous requests across Worker instances can buy duplicate labels. Serialize purchases for each reference and check shipcloud after an uncertain result. Requires confirm=true after the user agreed to the purchase; give a unique reference_number. Shipments needing customs papers are not supported here. POST /shipments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient full address (company or last_name needed). Read a saved address first to copy its fields. | |
| from | No | Sender full address. If omitted, shipcloud uses the default sender address of the account. | |
| carrier | Yes | Carrier acronym (shipcloud_list_carriers shows the ones this account can use). | |
| confirm | Yes | Must be exactly true. Set it ONLY after the user has explicitly agreed to buy this label and be charged for it. Ask first; do not assume. | |
| service | No | Service (default standard). Which services a carrier offers: shipcloud_list_carriers. | |
| packages | Yes | The packages (one entry for a single parcel). Several packages: only UPS supports them. | |
| description | No | Contents. Mandatory for UPS international/non-standard and DHL Express. Shipments that need a customs declaration (outside the EU) are not supported here: create them in the shipcloud backoffice. | |
| label_format | No | Label format, e.g. pdf_a6 or zpl2_4x6in_203dpi; carriers support different ones (shipcloud_list_carriers shows them per service). | |
| reference_number | Yes | Your own unique reference (max 30 characters). Required: it is how a possible duplicate is found after a timeout. | |
| notification_email | No | shipcloud emails this address on tracking updates. |