Flexport APIflexport.com ↗
Access Flexport air freight rates, route search, and popular shipping routes via API. Get price-per-kg, transit times, and location slugs for any origin-destination pair.
What is the Flexport API?
This API exposes 3 endpoints covering Flexport's freight rate data, including deferred air pricing, location search, and popular route discovery. The get_deferred_air_rates endpoint returns rate objects with price_per_kg, transit_time, total_price, and discounted_price fields for any airport or city pair — defaulting to a 1000 kg / 6 cbm benchmark shipment. Use it to compare lane pricing, build freight cost calculators, or monitor rate trends on key trade corridors.
curl -X GET 'https://api.parse.bot/scraper/ce53604a-d2b3-462d-908b-b8eb23138ff4/get_deferred_air_rates?origin=pvg&destination=jfk' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace flexport-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Flexport Freight API — search locations, browse popular routes, get air rates."""
from parse_apis.flexport_freight_api import Flexport, ServiceLevel, RouteNotFound
client = Flexport()
# Search locations to find airport/port slugs for rate queries.
for loc in client.locations.search(query="Shanghai", limit=3):
print(loc.display_name, loc.slug, loc.types)
# Browse popular shipping routes and inspect their offerings.
route = client.routes.popular(limit=1).first()
if route:
print(route.origin_name, "→", route.destination_name)
for offering in route.offerings:
print(offering.service_level, offering.pricing.price, offering.transit_time.min_days)
# Fetch deferred air freight rates for a specific origin-destination pair.
try:
quote = client.ratequotes.get_deferred(origin="pvg", destination="jfk")
for rate in quote.rates:
print(rate.transit_time, rate.price_per_kg, rate.discounted_price)
except RouteNotFound as exc:
print(f"Route not found: {exc.origin} → {exc.destination}")
print("exercised: locations.search / routes.popular / ratequotes.get_deferred")
Fetch unique 'Deferred' air freight rates for a given origin-destination pair. Returns pricing based on a default 1000kg/6cbm shipment. Origin and destination are airport code slugs (e.g., 'pvg', 'jfk') or city slugs resolved from search_routes. If a city name is provided, it is resolved to a slug via autocomplete before querying rates. Returns an empty rates array when no deferred air service exists for the route.
| Param | Type | Description |
|---|---|---|
| originrequired | string | Origin airport code slug or city name (e.g., 'pvg' for Shanghai Pudong, or 'Shanghai' which resolves via autocomplete). |
| destinationrequired | string | Destination airport code slug or city name (e.g., 'jfk' for JFK Airport, or 'New York' which resolves via autocomplete). |
{
"type": "object",
"fields": {
"rates": "array of DeferredRate objects with transit_time, valid_until, price_per_kg, cbm, total_weight, total_price, discounted_price",
"origin": "string, origin slug used in the query",
"destination": "string, destination slug used in the query"
},
"sample": {
"data": {
"rates": [
{
"cbm": 6,
"total_price": 9560,
"valid_until": 1781222400000,
"price_per_kg": 9.56,
"total_weight": 1000,
"transit_time": "8-8",
"discounted_price": 9088.5
}
],
"origin": "pvg",
"destination": "jfk"
},
"status": "success"
}
}About the Flexport API
Air Freight Rate Data
The get_deferred_air_rates endpoint accepts an origin and destination — either lowercase airport code slugs (e.g., pvg, jfk) or city names that resolve via autocomplete. It returns an array of rate objects, each containing transit_time, valid_until, price_per_kg, cbm, total_weight, total_price, and discounted_price. All rates are benchmarked against a standard 1000 kg / 6 cbm shipment, which makes lane-to-lane comparison straightforward without normalizing weights yourself.
Location Search
The search_routes endpoint resolves airport, seaport, and city names from a free-text query string. Each result node includes displayName, slug, iataCode, locCode, shortName, lat, lng, fid, and a types array indicating whether the location is an airport, seaport, or city. This is the intended way to resolve human-readable place names into the slugs required by the rate endpoint.
Popular Routes
The get_popular_routes endpoint requires no inputs and returns the routes Flexport treats as high-volume lanes. Each route object includes origin, destination, originName, destinationName, and an offerings array that may contain air, ocean FCL, and ocean LCL pricing. This is useful for seeding a UI with common trade lanes or identifying which corridors have multi-modal rate coverage.
The Flexport API is a managed, monitored endpoint for flexport.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when flexport.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official flexport.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a freight cost estimator that pulls live
price_per_kgandtotal_pricefor user-specified origin-destination pairs - Monitor deferred air rate trends on key corridors like PVG–JFK by polling
get_deferred_air_ratesover time - Populate a lane selector UI using
search_routesto resolve city names to valid slugs before fetching rates - Compare air, ocean FCL, and ocean LCL availability on popular trade lanes using
get_popular_routesofferings data - Identify
valid_untilwindows across multiple lanes to flag expiring rate quotes before they roll over - Cross-reference
transit_timeagainstdiscounted_priceto surface the best time-value tradeoff on a given route - Seed a logistics dashboard with high-volume corridors from
get_popular_routeswithout maintaining a static route list
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Flexport have an official developer API?+
What does `get_deferred_air_rates` return and how is pricing structured?+
transit_time, valid_until, price_per_kg, cbm, total_weight, total_price, and discounted_price. All rates assume a benchmark shipment of 1000 kg and 6 cbm, so the pricing reflects that weight class rather than an arbitrary shipment size you specify.Does the API return ocean freight rates for arbitrary origin-destination pairs?+
offerings array on get_popular_routes, which covers Flexport's curated high-volume lanes rather than user-specified pairs. You can fork this API on Parse and revise it to add an endpoint targeting additional ocean rate lanes.Can I look up real-time shipment tracking or booking status through this API?+
get_deferred_air_rates, search_routes, and get_popular_routes. Shipment tracking and booking data are not exposed. You can fork this API on Parse and revise it to add endpoints targeting those data surfaces.How fresh are the rate quotes returned by `get_deferred_air_rates`?+
valid_until field that indicates the expiry date for that specific quote. Rates are current as of the time of the API call, but valid_until varies by lane and carrier offering, so always check that field before using a quote in downstream pricing logic.