Skip to main content

Your First Shipment

This guide walks through creating a shipment from start to finish: validating the address, getting rates, purchasing a label, and tracking delivery.

Time estimate

Most developers complete this guide in under 5 minutes.

Prerequisites

  • A FlexOps API key (get one from the Dashboard)
  • An SDK installed, or curl for raw API calls

Step 1: Validate the destination address

Always validate addresses before creating shipments to avoid carrier surcharges and failed deliveries.

curl -X POST https://api.flexops.io/v1/addresses/validate \
-H "X-API-Key: fxk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"street1": "456 Oak Ave",
"city": "Portland",
"state": "OR",
"zip": "97201",
"country": "US"
}'

The API returns a standardized address with any corrections applied (e.g., ZIP+4 appended, typos fixed).

Step 2: Get rates

Compare rates from all configured carriers in a single call:

curl -X POST https://api.flexops.io/v1/rates \
-H "X-API-Key: fxk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"from": { "zip": "80202", "country": "US" },
"to": { "zip": "97201", "country": "US" },
"parcel": { "weightOz": 16, "lengthIn": 10, "widthIn": 8, "heightIn": 4 }
}'

This returns rates from all configured carriers, sorted by price. A typical response:

{
"rates": [
{ "carrier": "usps", "service": "ground_advantage", "rate": 5.25, "estimatedDays": 5 },
{ "carrier": "usps", "service": "priority", "rate": 7.85, "estimatedDays": 2 },
{ "carrier": "fedex", "service": "ground", "rate": 8.42, "estimatedDays": 4 },
{ "carrier": "ups", "service": "ground", "rate": 9.10, "estimatedDays": 3 }
]
}

Step 3: Purchase a label

Pick the best rate and create the label:

curl -X POST https://api.flexops.io/v1/labels \
-H "X-API-Key: fxk_live_your_api_key" \
-H "Idempotency-Key: order-12345-label" \
-H "Content-Type: application/json" \
-d '{
"rateId": "rate_xyz789",
"from": {
"name": "FlexOps HQ",
"street1": "123 Main St",
"city": "Denver",
"state": "CO",
"zip": "80202",
"country": "US"
},
"to": {
"name": "Jane Doe",
"street1": "456 Oak Ave",
"city": "Portland",
"state": "OR",
"zip": "97201",
"country": "US"
},
"parcel": { "weightOz": 16, "lengthIn": 10, "widthIn": 8, "heightIn": 4 }
}'
Idempotency

Always include an Idempotency-Key when creating labels to prevent duplicate charges if a request is retried. Use your order ID as the key.

Step 4: Print and ship

Download the label PDF from the labelUrl in the response, print it on a 4x6" thermal label, and affix it to your package.

Label formatBest for
PDF (default)Standard printers
PNGWeb display / preview
ZPLThermal printers (Zebra, DYMO)

Step 5: Track delivery

curl -X GET https://api.flexops.io/v1/tracking/9400111899223456789012 \
-H "X-API-Key: fxk_live_your_api_key"

Or register a webhook to receive status updates automatically — no polling needed.

Next steps