When a shipment is moving through Guangzhou (Nansha), a congestion signal can help you identify changes in port-call activity—but it cannot tell you a vessel’s current waiting time. This guide shows how to request the CNGGZ signal, read the relevant response fields, and handle the data’s publication lag in an integration.
What the congestion endpoint measures
The port-congestion endpoint uses IMF PortWatch data derived from AIS port calls. It compares the average daily port calls over the latest seven-day period with a 90-day baseline for the same port. The data is typically lagged by about six to seven days; the sample response also notes that the lag can vary from four to eleven days.
This is not a live AIS feed or a measurement of anchorage and vessel waiting time. The response describes congestion as a deprecated alias of activity, so treat it as an activity classification rather than a direct measure of congestion. Fewer calls than usual could reflect a closure or ships waiting offshore; the ratio alone cannot distinguish those causes.
The request uses CNGGZ as the port parameter. In the supplied response, the same location is identified by the name Guangzhou (Nansha) and the spaced location code CN GGZ.
Request Guangzhou (Nansha) data
Send a GET request to the port-congestion endpoint with port=CNGGZ. For authenticated access, put your key in the X-API-Key header:
curl -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/port-congestion?port=CNGGZ"
Replace YOUR_API_KEY locally before running the command; do not commit the key to a repository or include it in client-side code. Guest requests without a key are limited to 100 requests per day per IP address.
The response uses a top-level success indicator and a data object. Check success before consuming the port result, and check that results contains an entry rather than assuming every request returns one. The Documentation is the place to verify current access and endpoint details.
Read the response
The following supplied response is a snapshot, not a current reading. Its as_of date is the date to use when assessing the age of the underlying observation:
{
"success": true,
"data": {
"results": [
{
"port": "Guangzhou (Nansha)",
"locode": "CN GGZ",
"country": "China",
"activity": "moderate",
"congestion": "moderate",
"as_of": "2026-11-20",
"metrics": {
"recent_avg_portcalls_per_day": 26,
"baseline_avg_portcalls_per_day": 27.1,
"ratio_vs_baseline": 0.96
}
}
],
"global_summary": {
"ports_high_activity": 0,
"ports_moderate_activity": 1,
"ports_low_activity": 0,
"ports_high_congestion": 0,
"ports_moderate": 1,
"ports_low": 0
},
"meta": {
"source": "IMF PortWatch (portwatch.imf.org) - UN Global Platform AIS data",
"data_lag_days": "4-11 (PortWatch republishes the daily series once a week; check as_of)",
"methodology": "activity is port-call volume, not congestion: last 7 days' avg calls vs a 90-day baseline for the same port. low means fewer calls than usual, which can be a closure or ships waiting offshore. It does not measure vessel wait or anchorage time. congestion is a deprecated alias of activity."
}
},
"meta": {
"request_id": "7c6831c7-e92c-498a-9f7f-b217fed64df0"
}
}
The fields most useful for a port-specific integration are:
activityandcongestion: the activity classification and its deprecated congestion alias. The sample reportsmoderatefor both.as_of: the source observation date. It is a date in the sample, not a timestamp with a specified timezone.metrics.recent_avg_portcalls_per_day: the recent average number of port calls per day.metrics.baseline_avg_portcalls_per_day: the corresponding baseline average, also in port calls per day.metrics.ratio_vs_baseline: the recent average relative to the baseline. It is dimensionless; in this snapshot, the reported ratio is0.96.
The sample’s recent average is 26 port calls per day against a baseline of 27.1. Those values describe activity in the published observation, not the number of vessels waiting or an estimated delay. The global_summary provides counts by classification, but use the entry in results for the Guangzhou (Nansha) reading.
The two metadata objects serve different purposes. data.meta describes the source, lag and methodology, while the top-level meta.request_id identifies the request in the sample. Retaining the request ID alongside an error report can help you investigate a particular response without logging the API key.
Call the endpoint from Python
This example uses Python’s standard library. Set FREIGHTPULSE_API_KEY in the process environment, then run the script; it reads the same CNGGZ endpoint and prints the fields needed to display the observation.
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
url = "https://freightpulsehq.com/api/v1/port-congestion?port=CNGGZ"
api_key = os.environ.get("FREIGHTPULSE_API_KEY")
if not api_key:
sys.exit("Set FREIGHTPULSE_API_KEY before running this script.")
request = Request(url, headers=dict([("X-API-Key", api_key)]))
try:
with urlopen(request, timeout=30) as response:
payload = json.load(response)
except HTTPError as exc:
sys.exit("HTTP request failed: " + str(exc.code))
except URLError as exc:
sys.exit("Network request failed: " + str(exc.reason))
except (ValueError, UnicodeDecodeError):
sys.exit("The response was not valid JSON.")
if not isinstance(payload, dict) or payload.get("success") is not True:
sys.exit("The API did not return a successful response.")
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("No port result was returned.")
port = results[0]
if not isinstance(port, dict):
sys.exit("The port result was not an object.")
metrics = port.get("metrics")
if not isinstance(metrics, dict):
metrics = dict()
print("Port:", port.get("port"))
print("Activity:", port.get("activity"))
print("Congestion alias:", port.get("congestion"))
print("As of:", port.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 treats an empty result as a condition to investigate, not as evidence of low activity. Missing individual fields print as None; in a production display, mark those values unavailable rather than substituting zero. The timeout is a client-side setting for this example, not an API service guarantee.
Use the signal safely in an integration
Store the source’s as_of date with the reading and show it wherever the classification or ratio appears. Separately record when your application fetched the response: fetching it again does not make an older source observation current. Since the example supplies a date without a timezone, do not infer an exact observation time or timezone from it.
Cache the result according to your application’s freshness needs and the published source lag. PortWatch republishes the daily series once a week according to the response metadata, so frequent requests can return an unchanged observation. Compare as_of on subsequent responses, and avoid presenting an unchanged date as a new measurement merely because a fetch succeeded.
Handle network failures, unsuccessful responses and missing results separately from a valid activity classification. If you retain a previously fetched result during a failure, label it with its original as_of date and indicate that the latest fetch failed. Avoid converting missing metrics into a numerical ratio or a low-congestion status.
For operational decisions, pair this lagged port-call signal with whatever current shipment and vessel information is available to your team. A movement in ratio_vs_baseline can prompt investigation, but neither the ratio nor the deprecated congestion alias establishes how long a particular vessel will wait.
FAQ
Is this a live congestion or vessel-wait API?
No. It reports a lagged IMF PortWatch port-call activity signal. The response methodology explicitly says it does not measure vessel wait or anchorage time.
Which port code should I send?
Use CNGGZ in the request’s port parameter. The supplied result identifies Guangzhou (Nansha) with the spaced location code CN GGZ.
What does a ratio below the baseline mean?
It means the recent average port-call volume is below the baseline average. It does not, by itself, explain why activity changed or establish whether vessels are waiting offshore.
Can I call the endpoint without an API key?
Yes. Guest access without a key is limited to 100 requests per day per IP. For authenticated requests, send your key in X-API-Key.
Register to obtain an API key, then run the CNGGZ request and keep as_of visible alongside the returned activity signal.