To create and ship a shipment all at once, you will need to use the Shipment Creation endpoint to buy and generate a label. Here’s how to structure the request, including the headers, parameters, and body data:
Key Elements
shipment: The main object containing the shipment details.
to_location and from_location: The addresses of the sender and recipient.
parcels: The details of the parcel(s), including dimensions, weight, and type.
service_id: The ID of the shipping service you wish to use (can be retrieved via a rates request).
label_format: The format for the label (e.g., "png", "zpl").
label_size: The size of the shipping label (e.g., "4x6").
Once you send this request, the API will return a response with the tracking number and the label, which you can use to ship the package.