Skip to main content

Shipping API

Create, retrieve, and manage shipments.

Create shipment

POST /v1/shipments

Creates a new shipment with a label.

Request body

FieldTypeRequiredDescription
carrierstringYesCarrier code (e.g., usps, fedex)
servicestringYesService code (e.g., priority, ground)
fromAddressYesSender address
toAddressYesRecipient address
parcelParcelYesPackage dimensions and weight
referencestringNoYour internal reference (e.g., order ID)
isReturnbooleanNoWhether this is a return label
customsCustomsNoRequired for international shipments

Address object

FieldTypeRequiredDescription
namestringYesFull name
companystringNoCompany name
street1stringYesStreet address line 1
street2stringNoStreet address line 2
citystringYesCity
statestringYes*State/province (*US/CA/AU)
zipstringYesPostal code
countrystringYesISO 3166-1 alpha-2 country code
phonestringNoPhone number
emailstringNoEmail address

Parcel object

FieldTypeRequiredDescription
weightOznumberYesWeight in ounces
lengthInnumberNoLength in inches
widthInnumberNoWidth in inches
heightInnumberNoHeight in inches

Example

curl -X POST https://api.flexops.io/v1/shipments \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"carrier": "usps",
"service": "priority",
"from": { "name": "Warehouse", "street1": "100 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 }
}'

Get shipment

GET /v1/shipments/:id

List shipments

GET /v1/shipments

Query parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
pageSizeintegerItems per page (default: 25, max: 100)
carrierstringFilter by carrier code
statusstringFilter by status
createdAfterdatetimeFilter by creation date

Cancel shipment

POST /v1/shipments/:id/cancel

Cancels the shipment and voids the label if within the carrier's void window.