Flexport Logistics API provides access to the Flexport logistics network that powers all of our e-commerce operations, such as order fulfillment, order returns, freight, and parcel. With the Logistics API, you can create custom applications and integrations to access your Flexport account, or authorize Flexport-approved partner applications for that purpose.
The Logistics API is a REST API with the OpenAPI3 specification available at: https://logistics-api.flexport.com/logistics/api/2023-10/documentation/raw
To start using the Logistics API, you must have an active Flexport Portal account. To inbound physical inventory, ship orders, process returns or buy parcel labels, you'll also need to set up a billing account.
There are two primary user categories for the Logistics API:
User type | Meaning within the API reference |
---|---|
You are a merchant if | you use the API to develop an integration for your own business or shop. |
You are a partner if | you use the API to develop an application to serve Flexport merchants or your own customers. |
Create a free Flexport Portal account. Complete the questions to create your account, and don't forget to add your business name. When asked to create a catalog, you can select "I'm not selling online yet".
Account type | Purpose |
---|---|
Production | Used for fulfilling real orders with physical inventory. |
Sandbox | Used for testing fulfillment with simulated inventory and orders. Returns and Parcels do not support Sandbox at this time. |
Production and Sandbox are completely isolated and separate Seller Portal accounts. Production account holds physical inventory and incurs costs when orders ship to customers.
Sandbox is an API test environment where you can test your application prior to running it against your production account. Inventory inbounded to the Sandbox account is simulated and auto-received, and orders may be placed against it that are also automatically shipped. Refer to Testing in Sandbox for more information.
To use the API, you will need an access token. Each access token carries permission scopes with it. This allows you to create one access token to access products, and another one to access orders, for example.
There are two ways to request an access token:
You must be an Administrator of your organization to manage access tokens.
Once issued, access tokens do not expire unless revoked by the Administrator.
Sandbox allows Flexport customers and partners using the Logistics API to test their applications without moving physical goods around.
To request a Sandbox account:
After you have created the Sandbox account using the steps above, you can test your application against it.
Sandbox uses the same API endpoint as production. The API token serves as a pointer that allows the backend system to find the account you are accessing. Use the API token from the Sandbox account to work with Sandbox data. Sandbox and Production accounts are completely isolated from one another, as if they were accounts from separate customers.
As an example, you can use this workflow to go from production creation to inbounding inventory and order placement in Sandbox:
At this time, our sandbox environment only supports the happy-path use cases. We currently cannot test:
Logistics API may be used by Merchants and by Partners. Either a Merchant or a Partner may develop a software application that uses the Logistics API.
Key difference between a Merchant and a Partner is that:
Currently partner registration is manual but may be self-served in the future.
If you wish to develop an application for use by one or more merchants, reach out to us to request a unique application ID and secret. Your software application must include a public API server that receives callbacks with the authorization code whenever a merchant authorizes it using the OAuth authorization_code flow. In response to callback, your application would exchange the one-time OAuth code for an API token.
Provide the following:
You will receive your application ID and secret. You must use the application ID and secret as client credentials when when exchanging OAuth authorization code for an API token during OAuth token exchange.
In order for your application to receive Merchant consent and the API token, you would direct the merchant to the OAuth authorization_code flow that has your application ID, as well as the scopes that your application requires. You do not need to include the callback URI, because it is known to us since your application is registered.
For example, if your application requires read access to products and orders and the application ID is 01HKBBNEVYKM0D84E63MMYN022 the URI is: https://logistics-api.flexport.com/logistics/api/2023-10/oauth/authorize?response_type=code&scope=read_logistics_products+read_logistics_orders&client_id=01HKBBNEVYKM0D84E63MMYN022
When Merchant visits this URL they'll be shown a Consent page displaying your application name and required access (scopes). If they click through to agree to use your application, your application server will receive the OAuth code on the callback URI that you registered with your application.
Your application would then exchange the OAuth authorization code for an API token during OAuth token exchange. For client credentials, you would submit your application ID 01HKBBNEVYKM0D84E63MMYN022 and the secret you received. In addition to the API token, the response will include the logisticsAccountId of the merchant.
Your application must treat each API token with utmost care and store in a secure encrypted location and encrypt and protect it while in transit.
This section will guide you through migration from the Deliverr API V1.
Here are the key differences between the two APIs at a high level:
Difference | Logistics API version 2023-04 | Deliverr API version 1.0.0 |
---|---|---|
OAuth 2.0, RFC6749 compliant | Yes | No |
Release schedule | Every 3 months | Ad-hoc |
A handful of identifiers have been renamed or added in the Logistics API. Refer to the tables, like the one below, in each of the following guides.
Changes in | Deliverr API | Logistics API |
---|---|---|
All resources | productId (DSKU) | logisticsSku |
You must request new access tokens as described here when migrating from Deliverr API.
Changes in | Deliverr API | Logistics API |
---|---|---|
All resources | productId | logisticsSku |
Inbounds | shippingPlan | shipment |
Inbounds | externalShippingPlanId | N/A |
Inbounds | destination | N/A |
Inbounds | caseQuantity | N/A |
In the Logistics API, inventory inbounding has been simplified and a number of new endpoints have been added. Refer to the Inbounds reference for additional details.
Key differences between the API are highlighted below:
id
of the shipment or as a list by specifying a list of ids via the shipmentIds
query parameterlogisticsSku
replaces productId
as the identifier for the product being inboundedexternalShippingPlanId
, destination
and caseQuantity
are no longer supportedshippingId
.Changes in | Deliverr API | Logistics API |
---|---|---|
All resources | productId | logisticsSku |
Product | msku | merchantSku |
Product | externalProductId | N/A |
Inventory | availableUnits | available |
Inventory | N/A | onHand |
Inventory | N/A | unavailable |
A few fundamental changes:
logisticsSku
instead of externalProductId
in the list of lineItemsexternalProductId
mapping under the aliases section of a Product Detail page as "Deliverr API" will not be used in the Logistics API and will remain unchangedheight
, length
, width
, weight
), units (lb/kg, in/cm), or category via the APIThe retrieve inventoryretrieve inventory endpoint response contains a few new fields.
The retrieve warehouse details endpoint is a POST request instead of a GET. Instead of passing a list of productId
in the productIds
query parameter, you will now send a body in the following JSON format:
{
"logisticsSKUs": [
"DSKU1",
"DSKU2",
"DSKU3"
]
}
The bundle endpoints remain semantically similar between the Deliverr API and the Logistics API. However, the bundle creation flow has changed between the APIs. The order endpoints in the Logistics API do not support fulfilling orders by bundleId
. Merchants who wish to fulfill bundle orders in the logistics API have two options:
{ logisticsSku, quantity }
.In both cases, you must use the logisticsSku
and its total quantity when creating an order.
The following operations no longer exist in the Logistics API.
Deprecated Endpoints |
---|
PATCH LinkAliasToBundle |
PATCH UnlinkAliasFromBundles |
GET GetBundleByExternalBundleId |
Changes in endpoint | Deliverr API | Logistics API |
---|---|---|
Create order | externalProductId | logisticsSku |
Create order | orderShipmentTime | promisedShipByTime |
Create order | orderDeliverTime | promisedDeliveryByTime |
Create order | shipToAddress | address |
Create order | deliverDays | deliveryDays |
Create order | N/A | packingSlipUrl |
Create order | N/A | duties |
Create order | createdAt | N/A |
Create order | updatedAt | N/A |
Create order | orderCreationTime | N/A |
The response payload for getting an order’s information has now changed. See the retrieve order response.
Beyond changes to the URIs, the report endpoints are a one-to-one mapping between the Deliverr API and the Logistics API.
Your webhook subscriptions must be recreated using the create webhook endpoint.
Besides following the OpenAPI 3.0 specification, below is a list of common resources and standards shared across the APIs.
The Logistics API makes use of the following custom HTTP headers.
Header field name | in request | in response | description |
---|---|---|---|
x-correlation-id |
no | yes | UUID v4 tied to a request |
idempotency-key |
yes | no | Can be any string, use for making POST or PATCH requests fault tolerant |
idempotent-replayed |
no | yes | If included in the response, indicates a stored value was used to replay the request |
The Logistics API uses date based versioning for releases. Versions are declared explicitly in the Logistics API URI with a format of /logistics/api/{api_version}/{endpoint}
. Stable releases follow the format of yyyy-mm
. Experimental releases have an API version of unstable
. For example:
/logistics/api/2023-04/orders
/logistics/api/unstable/orders
createOrder
: Update API to allow drop ship ordersgetOrder
: Update API to get drop ship details for ordersgetBulkParcelJob
: This API retrieves details about a bulk parcel creation job.createBulkParcelJob
: Use this API to submit a bulk parcel creation job.getParcel
, getParcelTracking
, getParcelTrackingByTrackingCode
and createParcel
to return an option field carrierBarcode
.flexportTrackingUrl
datatype from string
to URL
source
marketplace.Outbounds API
allows you to create outbound orders from reserve storage warehouses to fulfilment centres. The APIs also allow you to track the status of the reserve storage outbound orders and cancel them.Create a shipment
API to accept a shippingPlanName
. This is the name that will appear in the Flexport Portal.Get a shipment
and Get a list of shipments
APIs to support reading direct shipments that were created in Seller Portal.InboundReceivedEvent
documentation was updated to include DAMAGED
state.GetProductAliases
API to list all aliases by logisticsSku
.GetProductsByMerchantSku
API to get a paginated list of products by merchantSku
.CreateProductBarcode
API to validate and assign a new barcode to a product by logisticsSku
.CreateOrder
API to accept Flexport bundle SKUs.CreateOrder
API to take packingSlipUrl that overrides the default packing slip.CreateOrder
API.Shipment.Shipped
and Order.Shipped
.customsInformation
to create a parcel. You can now send parcels to international addresses and specify the relevant customs information.customLabelFooterFields
to create a parcel. This field lets you define a string to be placed on the footer of the shipping label.flexportTrackingUrl
field when creating a parcel, retrieving a parcel, or retrieving parcel tracking events. This field can be used to track a package end-to-end through Flexport and final mile partner networks.shippingPlanName
to create an inbounding shipment. This is the name that will appear in the Flexport Portal.shippingPlanExternalId
to create an inbounding shipment. This field is an external ID that can be used to link to/from other systems.shippingPlanName
and shippingPlanExternalId
in getting an inbound shipment, or getting a list of inbound shipments.GetAllInventory
. Get a paginated list of available inventory information for products.GetProducts
. Return a paginated list of products.The "unstable" version contains code experimental changes, developer previews, and new features. However, endpoints can always change and may update with breaking changes without notice.
When an API error occurs, the HTTP response includes a three-digit HTTP status code with additional information returned as a problem+json object, for example:
HTTP/1.1 404 Not Found
Content-Type: application/problem+json
Content-Language: en
{
"type": "https://logistics-api.flexport.com/logistics/api/2023-04/documentation/spec#section/Errors/404-Not-Found",
"title": "Not Found",
"detail": "Cannot find order 49201824029",
"instance": "92e04577-c56b-47b9-b075-62096165a0ce",
}
In addition to the three-digit HTTP status code, some errors carry a six-digit error code
that provides additional detail about the specific error condition. For example 405004
error code
refers to Invalid scopes
and is documented here.
Bad Request.
Access token does not have permission to perform the requested operation.
The requested object cannot be found.
The object with the same identifier already exists.
The request is malformed.
Too many requests in a given amount of time ("rate limiting").
Retry-After
header for the number of seconds to wait before retrying the request.Access to the Logistics API is locked and denied.
An internal error has occurred while processing the request (these are uncommon).
The redirect URI specified as a callback for OAuth authorization is invalid.
https://deliverr.com
if identity
is used as the client ID.Invalid client_id.
identity
or a valid client ID registered with Flexport.Scopes were not provided.
Some of the scopes provided are invalid. For all available scopes see OAuth.
The one-time authorization code provided is invalid, expired, or has already been used.
Operation cannot proceed, because order is in a state that does not allow it.
Canceled
.