Core concepts
This page explains the key concepts behind the Flex Forward API — how resources relate to each other, how labels progress through their lifecycle, and how tracking data is normalized across couriers.Resources
The API manages three related resources, all linked by the label ID (a UUID):| Resource | Endpoint | Description |
|---|---|---|
| Label | POST /labels | A shipping label request submitted to a courier |
| Label Document | GET /labels/{id} | The printable airway bill (PDF or PNG) for a label |
| Tracking | GET /tracking/{id} | Real-time shipment tracking data for a label |
POST /labels is the primary key used across all operations. There is no separate tracking ID — tracking is always accessed by label ID.
Label lifecycle
A label progresses through the following states:Created
The label request was accepted by the courier. The response includes
courierOrderNumber, courierTrackingNumber, and the label id. The label document is available for retrieval.Document available
The airway bill PDF or PNG can be downloaded via
GET /labels/{id}. Print and attach it to the shipment. The document URL is permanent and does not expire. Supported formats are PDF and PNG.Tracking active
Once the courier scans the package, tracking data becomes available via
GET /tracking/{id}. Tracking data is fetched from the courier in near-real-time. The tracking status progresses through stages like InfoReceived, InTransit, and Delivered. Normalized status tags may evolve as additional courier data becomes available.status: failed and includes the courier error details. See Error Handling for details.
Tracking status model
Tracking data uses a unified status model inspired by industry standards. Each tracking response includes a top-leveltag and subtag, plus an array of checkpoints representing individual tracking events.
Status tags
| Tag | Meaning |
|---|---|
Pending | Label created but not yet received by the courier |
InfoReceived | Courier has received shipment information |
InTransit | Shipment is in transit |
Delivered | Shipment has been delivered |
Exception | An issue occurred during transit (e.g., failed delivery attempt, customs hold) |
Cancelled | Shipment has been cancelled |
Unknown | Status could not be determined |
subtag field provides finer granularity (e.g., InTransit_001, Exception_002). Use the tag for high-level status logic and the subtag for detailed status display.
Checkpoints
Each checkpoint represents a single tracking event:Carrier normalization
Each courier has its own API format, status codes, and error conventions. Flex Forward normalizes these differences:- One request format — submit the same JSON structure regardless of courier. Courier-specific details are handled internally.
- One response format — receive a consistent label response with
id,status,courierOrderNumber,courierTrackingNumber, and (if failed)error. - Unified tracking — tracking events from different couriers are mapped to the same status tag taxonomy and checkpoint format.
Couriers and product codes
Each label request requires acourier slug and a productCode. Available couriers and product codes are configured during account onboarding.
| Courier | Slug | Product Code | Description |
|---|---|---|---|
| YunExpress | yunexpress | YEXP01 | Standard cross-border e-commerce |
serviceCode field is optional and enables specific service levels when available. Contact the Flex Forward team for the product codes and service options available for your shipping lanes.
Address reference data
Address fields require standardized codes:countryCode— ISO 3166-1 alpha-2 country code (e.g.,US,JP,CN,GB,DE)state— State or province code, required for countries with state-level addressing (e.g.,CA,NY,TXfor the United States)
A full reference listing supported country codes and US state codes is planned for a future release.
Integration flow
The typical integration sequence:id returned from the initial POST /labels call. There is no need to manage separate identifiers for documents and tracking.
Tracking data is fetched from the courier in real time. For shipments that have not yet been scanned by the courier, the tracking response may return a
Pending or InfoReceived status with no checkpoints.