# Retrieve aggregated congestion data for a port

> Congestion API, GET /congestion/{portCode}: Returns congestion, time-in-port statistics, and vessel counts for a given port.

`GET /congestion/{portCode}` on the Congestion API. Base URL: `https://api.sinay.ai/congestion/api/v1`.

Returns congestion, time-in-port statistics, and vessel counts for a given port.

## Path parameters

::api-parameters{location="path"}
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `portCode` | string | Yes | The port code (unlocode) of the port. |
::

## Responses

::api-response
---
status: "200"
description: The congestion aggregate
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `portCode` | string | Yes | The port code (unlocode). |
| `rateOccupation` | object | Yes | — |
| `rateOccupation.commercialVessels` | object, nullable | No | — |
| `rateOccupation.commercialVessels.rateOccupationPercentage` | number (double), nullable | No | — |
| `rateOccupation.commercialVessels.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `rateOccupation.cargo` | object, nullable | No | — |
| `rateOccupation.cargo.rateOccupationPercentage` | number (double), nullable | No | — |
| `rateOccupation.cargo.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `rateOccupation.tanker` | object, nullable | No | — |
| `rateOccupation.tanker.rateOccupationPercentage` | number (double), nullable | No | — |
| `rateOccupation.tanker.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `rateOccupation.roro` | object, nullable | No | — |
| `rateOccupation.roro.rateOccupationPercentage` | number (double), nullable | No | — |
| `rateOccupation.roro.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `time` | object | Yes | — |
| `time.timeInPortStatistics` | object, nullable | No | — |
| `time.timeInPortStatistics.max` | number (double), nullable | No | — |
| `time.timeInPortStatistics.median` | number (double), nullable | No | — |
| `time.timeInPortStatistics.min` | number (double), nullable | No | — |
| `vesselsInPortCount` | object | Yes | — |
| `vesselsInPortCount.commercialVessels` | integer, nullable | No | — |
| `vesselsInPortCount.cargo` | integer, nullable | No | — |
| `vesselsInPortCount.tanker` | integer, nullable | No | — |
| `vesselsInPortCount.roro` | integer, nullable | No | — |

Response headers:

| Name | Type | Description |
| --- | --- | --- |
| `X-Request-Id` | string | An unique id to trace request accross system |
| `X-Resource-Type` | string | The type of resource returned |
| `X-Requested-Count` | integer | Number of ports requested |
| `X-Found-Count` | integer | Number of ports for which data was found |

Example response body:

```json
{
  "portCode": "FRLEH",
  "rateOccupation": {
    "commercialVessels": {
      "rateOccupationPercentage": 28.57,
      "rateOccupationGapWithMean": -25
    },
    "cargo": {
      "rateOccupationPercentage": 32.92,
      "rateOccupationGapWithMean": -1.69
    },
    "tanker": null,
    "roro": null
  },
  "time": {
    "timeInPortStatistics": {
      "max": 89.02,
      "median": 56.39,
      "min": 23.76
    }
  },
  "vesselsInPortCount": {
    "commercialVessels": 8,
    "cargo": 8,
    "tanker": 0,
    "roro": 0
  }
}
```

::

::api-response
---
status: "401"
description: The authentication failed
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `errorCode` | integer (int32) | Yes | — |
| `message` | string | Yes | — |
| `details` | array of string | Yes | — |
| `time` | string (date-time) | Yes | — |

::

::api-response
---
status: "404"
description: The resource has not been found
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `errorCode` | integer (int32) | Yes | — |
| `message` | string | Yes | — |
| `details` | array of string | Yes | — |
| `time` | string (date-time) | Yes | — |

::

::api-response
---
status: "500"
description: An error occurend on server side
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `errorCode` | integer (int32) | Yes | — |
| `message` | string | Yes | — |
| `details` | array of string | Yes | — |
| `time` | string (date-time) | Yes | — |

::

::api-response
---
status: default
description: default
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `errorCode` | integer (int32) | Yes | — |
| `message` | string | Yes | — |
| `details` | array of string | Yes | — |
| `time` | string (date-time) | Yes | — |

::
