Home → Blog

When a shipment depends on New York-New Jersey, a congestion label alone cannot tell you whether vessels are waiting or whether port-call activity has changed. This guide shows you how to request the port’s FreightPulse data, extract its activity indicators, and present their date and limitations in an integration.

What the congestion data measures

The port-congestion endpoint uses IMF PortWatch data. It compares the average number of port calls per day over the latest seven-day period with a 90-day baseline for the same port. The result is an activity indicator, not a direct measurement of vessel waiting or anchorage time.

Illustration: New York-New Jersey (New York) Congestion

The congestion field is a deprecated alias of activity. A low activity label means fewer calls than usual; it could reflect a closure or ships waiting offshore, but the field does not establish which explanation applies. Treat the label as a signal for investigation rather than a verified operational cause.

The data is lagged, typically by roughly six to seven days, and is not live AIS wait-time data. The sample metadata describes a four-to-eleven-day lag because PortWatch republishes the daily series once a week. Use the returned as_of date to assess the age of each observation rather than assuming that a successful request returned today’s conditions.

Request New York-New Jersey data

Use the supplied New York query value with the port-congestion endpoint. The official result identifies the port as New York-New Jersey and returns a null locode, so this request uses the documented port name rather than an inferred location code.

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

Replace YOUR_API_KEY with your key when running the request. Authentication uses the X-API-Key header. Guest access without a key is limited to 100 requests per day per IP.

This is an HTTP GET request. The encoded space in New%20York is part of the query value shown in the supplied request; keep the endpoint and parameter as shown when reproducing the example. Consult the Documentation for integration details beyond this example.

Read the response

The following is the supplied response for the New York request. Its date and measurements are an example observation, not a claim about current conditions.

{
    "success": true,
    "data": {
        "results": [
            {
                "port": "New York-New Jersey",
                "locode": null,
                "country": "United States",
                "activity": "moderate",
                "congestion": "moderate",
                "as_of": "2026-11-20",
                "metrics": {
                    "recent_avg_portcalls_per_day": 10,
                    "baseline_avg_portcalls_per_day": 9.5,
                    "ratio_vs_baseline": 1.06
                }
            }
        ],
        "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": "268f176d-cf3a-48b5-a515-a2cc095e1c4a"
    }
}

The top-level success flag indicates the result of the request, and data.results contains the port records. For the port display, read port, activity, congestion, as_of, and metrics.ratio_vs_baseline. The sample also supplies the recent and baseline averages in port calls per day.

The ratio compares recent activity with the baseline; it is not a duration or a percentage of vessels delayed. Preserve the returned ratio instead of deriving a replacement from displayed averages, which may be rounded. Use activity as the primary label in new integrations and retain congestion only where compatibility requires it.

The example’s as_of is a date, not a timestamp with a timezone. Display it as returned rather than assigning an hour or timezone. The response also contains source and methodology information under data.meta; the separate top-level meta.request_id can help identify a particular response when investigating an issue.

Fetch and extract the fields in Python

This example uses the Python standard library, calls the same endpoint, and prints the fields relevant to a port activity display. It handles a failed HTTP request, invalid JSON, an unsuccessful envelope, and an empty results list without substituting invented values.

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

url = "https://freightpulsehq.com/api/v1/port-congestion?port=New%20York"
request = Request(
url,
headers={"X-API-Key": "YOUR_API_KEY"},
method="GET",
)

try:
with urlopen(request, timeout=30) 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 endpoint: " + str(exc)) from exc
except json.JSONDecodeError as exc:
raise SystemExit("The response was not valid JSON.") from exc

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

data = payload.get("data")
if not isinstance(data, dict):
raise SystemExit("The response did not contain a data object.")

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

for port in results:
if not isinstance(port, dict):
continue

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("Ratio vs baseline:", metrics.get("ratio_vs_baseline"))
print("Recent calls per day:", metrics.get("recent_avg_portcalls_per_day"))
print("Baseline calls per day:", metrics.get("baseline_avg_portcalls_per_day"))

Replace YOUR_API_KEY before running the script. For a deployed service, supply the key through your application’s secret-management mechanism rather than committing it with source code. The timeout in the example is a client-side setting, not a statement about the API’s response-time guarantees.

The script reads the ratio returned by the API and does not calculate one when it is missing. In an application, represent missing fields as unavailable rather than turning them into zero: zero would be a measurement with a different meaning. Likewise, an empty results list should not be displayed as low activity.

Make the indicator useful in operations

Show the port name, activity label, ratio, and as_of together. A user who sees “moderate” without the observation date may mistake a lagged activity classification for a current queue status. A concise description beside the value should say that it compares port-call activity against a baseline and does not measure wait time.

Cache responses if repeated requests would otherwise retrieve the same observation for multiple users. Keep the source’s as_of date with the cached data and distinguish it from the time your application fetched the response. A newly fetched or newly cached record can still describe an older observation.

Choose your cache policy around the source’s weekly republication and the needs of your application, while checking the returned date each time. Do not assume that a new request necessarily produces a newer observation. This matters for guest integrations because requests without a key share the stated per-IP daily allowance.

If you use the indicator to trigger an operational review, include the underlying averages and source date in the review context. Validate time-sensitive decisions with an appropriate operational source: this response does not provide vessel-specific waits, anchorage duration, or a freight-rate price.

FAQ

Is this a live New York vessel-wait API?

No. The endpoint reports lagged PortWatch port-call activity relative to a baseline. It does not measure vessel wait or anchorage time.

Which field should a new integration use: activity or congestion?

Use activity for the primary classification. The supplied methodology describes congestion as a deprecated alias of that field.

Why does the example have a null locode?

The supplied New York-New Jersey result returns locode as null. The documented request uses port=New%20York; do not treat the null value as a code to insert into a request.

How current is the returned observation?

The data is typically lagged by about six to seven days, while the sample metadata describes a four-to-eleven-day lag. Check as_of on the returned port record instead of using the request time as the observation date.

What does the ratio measure?

ratio_vs_baseline compares recent port-call activity with the port’s 90-day baseline. It is not a vessel wait time, and its value should be read from the response rather than guessed.

To integrate the New York-New Jersey indicator with authenticated requests, Register, then use the request and field-handling example above to display the observation with its source date.