← Back to articles

June 3, 2026

9 min read

Shipping Automation via API: Quoting, Label Generation, and Tracking

How to integrate a shipping aggregator like Skydropx or Pakke to automate the full shipping flow in an ecommerce backend.

Leer en espanol

The full flow: quote → label → tracking

Automating shipping in an ecommerce system involves three distinct operations: quoting the available options for an address and package dimensions, generating the label once the customer selects a service, and tracking the delivery status. Each operation can fail independently and requires its own error handling.

The right moment to quote is not always at checkout. It depends on the product type: if weight and dimensions are known, quoting in the cart is fine. If they vary — custom products, bundles — it is better to quote when preparing the package before generating the label. Getting this right avoids price differences between what the customer paid and the actual label cost.

Real-time quoting: what the API needs

To quote with an aggregator like Skydropx or Pakke, four minimum data points are required: origin zip code, destination zip code, package weight, and dimensions (height, width, length). With those, the API returns the available options from each carrier with price, estimated delivery time, and availability.

The origin zip code is fixed per warehouse. If the business has multiple locations, it makes sense to quote from the one closest to the destination or from the one with available inventory. That logic lives in the backend, not in the frontend or the carrier.

Real-time quoting with the Skydropx API.

async function getShippingRates(params: {
  zipFrom: string;
  zipTo: string;
  weight: number;
  height: number;
  width: number;
  length: number;
}) {
  const response = await fetch(
    'https://api.skydropx.com/v1/quotations',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Token token=${process.env.SKYDROPX_API_KEY}`,
      },
      body: JSON.stringify({
        zip_from: params.zipFrom,
        zip_to: params.zipTo,
        parcel: {
          weight: params.weight,
          height: params.height,
          width: params.width,
          length: params.length,
        },
      }),
    },
  );

  if (!response.ok) throw new Error('Quotation failed');

  const { data } = await response.json();

  return (data as ShippingRate[]).filter((r) => r.available);
}

Label generation: the moment a cost is incurred

A label is generated with complete recipient data: name, address, neighborhood, municipality, state, zip code, and phone number. You also need the `rate_id` from the selected quotation, which identifies the specific carrier and service. A generated label has a cost even if the package is never delivered, so do not generate it before the order is ready to fulfill.

The response includes the PDF URL for the label and the tracking number. Both must be saved to the order immediately. The PDF can be served directly from the aggregator URL or downloaded and stored in your own storage to avoid dependency on provider availability.

  • Generate the label only when the order is confirmed and ready to pack.
  • Save the tracking number and PDF to the order before responding.
  • Implement retries with exponential backoff if generation fails.

Tracking: webhooks vs polling

Skydropx and Pakke offer webhooks for shipment status updates. When a package is picked up, in transit, or delivered, the aggregator posts to your endpoint with the new status. That is the correct mechanism for production systems: it consumes no resources constantly and the update arrives in real time.

If the aggregator does not offer reliable webhooks or the system needs to check status on demand, polling is the alternative. The recommended practice is decreasing-frequency polling: every hour during the first day, every four hours from day two to five, and once a day after that. Polling every five minutes for weeks consumes resources without meaningful benefit.

More articles

Back to articles