When you need to assess congestion at Los Angeles-Long Beach, a port-call indicator can help you compare recent activity with its historical baseline. This guide shows you how to request the USLAX data, read the response, and integrate the result without mistaking a lagged indicator for a live vessel wait time.
What the congestion endpoint measures
Use GET /api/v1/port-congestion?port=USLAX to retrieve congestion data for Los Angeles-Long Beach. The source is IMF PortWatch, and the data typically lags by approximately 6–7 days. It is not a live AIS feed or a current estimate of how long a vessel will wait.
The indicator compares the recent 7-day average of port calls per day with a 90-day baseline. The response provides both averages, their ratio, a congestion label, and an as_of date. Together, these fields support a historical activity comparison rather than a real-time queue measurement.
Keep the request and response identifiers distinct: the query uses USLAX, while the documented response displays the locode as US LAX. Use the query code in the request and retain the returned locode for display or recordkeeping.
Request the Los Angeles-Long Beach data
Send your API key in the X-API-Key header. Replace YOUR_API_KEY with your own key before running the request; the command uses the documented URL and port parameter.
curl -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/port-congestion?port=USLAX"
Guest requests without a key are limited to 100 requests per day per IP. For an authenticated integration, keep the key in server-side configuration rather than exposing it in browser code or committing it to a repository.
The Documentation is the appropriate place to check for additional API behavior before relying on assumptions about errors, limits, or response handling.
Read the response and interpret the metrics
The following documented response is dated 2026-08-14; it is not a live reading for today. The top-level envelope contains success and data, with the port record inside data.results.
{
"success": true,
"data": {
"results": [
{
"port": "Los Angeles-Long Beach",
"locode": "US LAX",
"country": "United States",
"congestion": "moderate",
"as_of": "2026-08-14",
"metrics": {
"recent_avg_portcalls_per_day": 8.7,
"baseline_avg_portcalls_per_day": 10.2,
"ratio_vs_baseline": 0.85
}
}
]
}
}
For a user-facing display, the important fields are port, congestion, and as_of. For a more informative comparison, also display the three values in metrics:
recent_avg_portcalls_per_dayis the recent average number of port calls per day over the 7-day window.baseline_avg_portcalls_per_dayis the average number of port calls per day in the 90-day baseline.ratio_vs_baselineis a unitless comparison of the recent average with the baseline. In this response,0.85indicates that the recent average is approximately 85% of the baseline.
The two averages are rates of port calls per day, not counts of vessels waiting or estimates of waiting hours. Their displayed precision can affect a calculation made from the shown values, so use the supplied ratio rather than expecting a calculation from rounded averages to reproduce it exactly.
The congestion value is the returned classification. The response does not provide a wait time or explain the classification thresholds, so do not turn the label or ratio into a claimed delay. Show the source date alongside the classification to make its age visible.
Call the endpoint from Python
This example uses Python’s standard library, so it does not require an additional HTTP package. Set FREIGHTPULSE_API_KEY in the process environment, then run the script; the request sends that value as X-API-Key.
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
api_key = os.environ.get("FREIGHTPULSE_API_KEY")
if not api_key:
sys.exit("Set FREIGHTPULSE_API_KEY before running this script.")
url = "https://freightpulsehq.com/api/v1/port-congestion?port=USLAX"
request = Request(url, headers={"X-API-Key": api_key}, method="GET")
try:
with urlopen(request) as response:
payload = json.load(response)
except HTTPError as exc:
sys.exit("Port congestion request failed with HTTP status: " + str(exc.code))
except URLError as exc:
sys.exit("Could not reach the port congestion endpoint: " + str(exc.reason))
except (ValueError, UnicodeDecodeError):
sys.exit("The endpoint did not return readable JSON.")
if not isinstance(payload, dict) or payload.get("success") is not True:
sys.exit("The API response did not report success.")
data = payload.get("data")
if not isinstance(data, dict):
sys.exit("The response did not contain a data object.")
results = data.get("results")
if not isinstance(results, list) or not results:
sys.exit("The response did not contain any port results.")
for result in results:
if not isinstance(result, dict):
continue
metrics = result.get("metrics")
if not isinstance(metrics, dict):
metrics = {}
print("Port:", result.get("port"))
print("Locode:", result.get("locode"))
print("Congestion:", result.get("congestion"))
print("As of:", result.get("as_of"))
print("Recent port calls per day:", metrics.get("recent_avg_portcalls_per_day"))
print("Baseline port calls per day:", metrics.get("baseline_avg_portcalls_per_day"))
print("Ratio vs baseline:", metrics.get("ratio_vs_baseline"))
The script checks the success envelope before reading data.results. It also handles an empty results list without assuming that a port record is always present. The printed fields come from each returned record; missing fields display as None rather than being silently replaced with invented values.
For an application, treat transport failures, an unsuccessful envelope, and missing data as states to report separately from the congestion label. Do not present a failed request as evidence that the port has no congestion.
Use the data safely in an integration
Store the returned as_of value with the metrics and label. It is a date in the documented response, not a timestamp with an explicitly provided timezone. Do not interpret it as the precise time at which a vessel’s status was observed.
It can also be useful to record when your own application fetched the response. Keep that retrieval time separate from as_of: a recent fetch can still return an indicator based on lagged source data. In a dashboard, label the source date and the retrieval time distinctly.
Caching can reduce repeated requests, especially because the source is not live. Choose a refresh policy that fits your application, retain the source date with the cached record, and avoid presenting a cached response as current vessel movement. A new request does not necessarily mean the underlying observation date has changed.
The documented response contains a results array. Iterate over returned records and handle an empty array, as the example does; do not assume additional pagination parameters or response fields that are not documented here. If an integration needs broader retrieval behavior, check the documentation rather than constructing an undocumented request.
Finally, use this indicator for context in a transportation workflow, not as a standalone promise about a shipment’s arrival or a vessel’s berth availability. The recent port-call rate can differ from its baseline for reasons that the response itself does not identify.
FAQ
Is this a live congestion or vessel-wait API?
No. The data comes from IMF PortWatch and typically lags by approximately 6–7 days. It compares port-call averages; it does not provide live AIS positions or a live wait time.
Which port code should I send?
Use USLAX in the port query parameter. The documented result identifies Los Angeles-Long Beach and displays its locode as US LAX.
Can I call the endpoint without an API key?
Yes. Guest access without a key is limited to 100 requests per day per IP. The authenticated example sends the key in the X-API-Key header.
What should I display with the congestion label?
Display as_of and, where useful, the recent and baseline port-call averages and their ratio. Label the averages as port calls per day and explain that the source is lagged; do not label the date as a live observation timestamp.
Register to obtain an API key, then use the USLAX request above to integrate the dated congestion indicator into your transportation workflow.