Approach A: Record a tracking number from your own carrier integration
If you generate labels outside Base (for example, through your own UPS, FedEx, or similar integration in your WMS), you simply write the finished tracking number into Base usingcreatePackageManual.
courier_code still matters here: it tells Base which carrier was used so it can pass that information along to the marketplace correctly.Approach B: Use Base’s built-in carrier integration
Most commonly used for marketplace-specific shipping such as Amazon’s Buy Shipping or Ship with Walmart. You need the relevant shipping integration connected and configured in Base first. From there, three methods work in sequence:createPackage: generates the label with the carrier.getOrderPackages: fetches label IDs for an order. Only needed for multi-package shipments; for a single package the ID is already returned in thecreatePackageresponse.getLabel: downloads the label itself (base64-encoded, format depends on carrier settings: PDF, ZPL, EPL, DPL, HTML, or GIF).
createPackage parameters
The
packages field contract is metric (centimeters and kilograms). Don’t assume US accounts universally receive or send imperial units here. That said, some individual courier integrations have their own account-level settings that affect how these values are interpreted: for example, USPS has a use_imperial_units option that can change whether raw values are treated as inches/pounds or converted from cm/kg. Use getCourierFields and the courier’s settings in the Base panel as the authoritative source for a specific integration rather than assuming metric end-to-end.If your carrier or marketplace supports cash-on-delivery, add
{"id": "cod", "value": "123.40"} to fields. Use a decimal dot, not a comma.package_id, package_number (the tracking number), and courier_inner_number.
getOrderPackages and getLabel
CallgetOrderPackages to retrieve label IDs when you have multiple packages on an order:
getLabel with either package_id or package_number; one is sufficient:
extension (one of pdf, html, gif, png, epl, zpl, dpl) and label as a base64-encoded string.
How the tracking number gets back to the order source
Depending on the integration’s settings in Base, the tracking number is forwarded to the order source either:- Immediately after it is added, or
- When the order is set to a specific status. Note that this is not instant: Base runs this on a scheduled backend job rather than in response to your API call, and the exact schedule and timezone aren’t publicly documented. Design for an asynchronous delay of up to a few hours rather than assuming a fixed time of day.
Deleting a shipment
A created shipment can be deleted withdeleteCourierPackage.
In practice, both approaches are often combined: your own integration for standard carriers (UPS, FedEx, etc.) and Base’s built-in integration for marketplace-specific shipping (Amazon, Walmart).