Home → Blog

Qingdao congestion data can be easy to misread as a live estimate of ships waiting at anchor. By the end of this guide, you can request the CNQDG record, read its activity-based congestion label and baseline ratio, and use its reporting date without treating it as an AIS wait-time feed.

What the Qingdao congestion fields mean

The port-congestion endpoint reports data derived from IMF PortWatch. It compares the average number of port calls over the last seven days with a 90-day baseline for the same port. The data is lagged, typically by about six to seven days, rather than a live view of vessel movements.

Illustration: How to Track Congestion at Qingdao

For Qingdao, the request uses CNQDG. The example response identifies the port as Qingdao Port and displays its UN/LOCODE as CN QDG. Keep the request code and the returned display value distinct when matching records.

The three fields most relevant to an integration are:

A lower call count can have different causes, including a closure or ships waiting offshore. The ratio alone cannot distinguish those causes, and neither the ratio nor the categorical label measures anchorage time. Treat the result as an activity indicator, not proof of a particular operational condition.

Request the Qingdao record

Send a GET request to the port-congestion endpoint with port=CNQDG. To authenticate, provide your key in the X-API-Key header:

curl -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/port-congestion?port=CNQDG"

Replace YOUR_API_KEY locally with your own key. Guest requests without a key are limited to 100 requests per day per IP. Keep a key out of browser-delivered code and shared logs; the server making the request is a suitable place to supply it.

Successful responses use a success and data envelope. The Qingdao record in the sample is inside data.results, so an integration should read the result array rather than assume that the port fields are directly under data.

Read the response and check its date

The following is the supplied Qingdao response example. Its values describe that observation, not a promise that a new request will return the same label, ratio, or date.

{
    "success": true,
    "data": {
        "results": [
            {
                "port": "Qingdao Port",
                "locode": "CN QDG",
                "country": "China",
                "activity": "moderate",
                "congestion": "moderate",
                "as_of": "2026-11-20",
                "metrics": {
                    "recent_avg_portcalls_per_day": 28.1,
                    "baseline_avg_portcalls_per_day": 28.4,
                    "ratio_vs_baseline": 0.99
                }
            }
        ],
        "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": "99a11387-a1eb-4c8e-b57e-10dd43a379d9"
    }
}

In this example, congestion and activity both say moderate. The recent average is 28.1 port calls per day, compared with a baseline of 28.4 calls per day; the reported ratio is 0.99. Those are port-call activity figures, not hours of delay.

The sample’s as_of value is a date, not a timestamp with a stated timezone. Preserve it as returned rather than adding a time or timezone. The response metadata describes a possible lag of four to eleven days and says PortWatch republishes the daily series weekly, so the actual date is more useful than assuming a fixed lag.

The global_summary provides counts by category, while data.meta describes the source and methodology. The outer meta.request_id is a request identifier; retain it when investigating a problematic response, but do not treat it as the observation date.

Call the endpoint from Python

This example uses the Python standard library. It checks the success envelope, handles an empty results list, and reads the Qingdao fields from the returned record. Supply your own key before running it.

import json
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

url = "https://freightpulsehq.com/api/v1/port-congestion?port=CNQDG"
request = Request(url, headers=dict([("X-API-Key", "YOUR_API_KEY")]))

try:
with urlopen(request) as response:
payload = json.load(response)
except HTTPError as exc:
raise SystemExit("HTTP request failed: " + str(exc)) from exc
except URLError as exc:
raise SystemExit("Could not reach the API: " + str(exc)) from exc
except ValueError as exc:
raise SystemExit("Response was not valid JSON") from exc

if not isinstance(payload, dict) or payload.get("success") is not True:
raise SystemExit("API response did not indicate success")

data = payload.get("data")
if not isinstance(data, dict):
raise SystemExit("Response has no usable data object")

results = data.get("results")
if not isinstance(results, list) or not results:
raise SystemExit("No Qingdao result returned")

record = results[0]
if not isinstance(record, dict):
raise SystemExit("Qingdao result is not an object")

metrics = record.get("metrics")
if not isinstance(metrics, dict):
metrics = dict()

print("Port:", record.get("port"))
print("LOCODE:", record.get("locode"))
print("Activity:", record.get("activity"))
print("Congestion alias:", record.get("congestion"))
print("Ratio vs baseline:", metrics.get("ratio_vs_baseline"))
print("As of:", record.get("as_of"))

The sample request is scoped to Qingdao, and its response contains one result. For production use, validate the returned port identity before associating the record with stored Qingdao data. A missing field should be treated as unavailable, not converted into a zero or an invented congestion state.

When storing or caching the result, keep as_of with the values and distinguish it from the time your application fetched them. Repeated requests can return the same observation because the underlying series is lagged and republished periodically. Choose a refresh policy appropriate to that cadence and your request allowance rather than polling as though this were a live vessel-position feed.

FAQ

Is Qingdao congestion a live AIS wait-time estimate?

No. The indicator is based on lagged PortWatch port-call activity. The supplied methodology explicitly says it does not measure vessel wait or anchorage time.

Should I use activity or congestion?

The response describes congestion as a deprecated alias of activity. If an existing integration needs the congestion field, preserve its activity-based meaning; for new displays, the activity label is less likely to suggest a direct wait-time measurement.

What does a ratio close to one tell me?

It means the recent average port-call rate is close to the baseline rate. It does not establish that operations are normal in every respect, and it cannot tell you how long a vessel will wait.

How should I handle an old as_of date?

Show the date with the result and evaluate it against your application’s freshness requirements. A lag is inherent in this dataset; an older observation should not be presented as a current live reading. Consult the Documentation when integrating or troubleshooting the endpoint.

To make authenticated requests and begin integrating Qingdao’s activity indicator, Register, then use your key with the request above.