# Retrieve aggregated congestion data for multiple ports

> Congestion API, POST /congestion/batch: Returns congestion, time-in-port statistics, and vessel counts for a list of ports.

`POST /congestion/batch` on the Congestion API. Base URL: `https://api.sinay.ai/congestion/api/v1`.

Returns congestion, time-in-port statistics, and vessel counts for a list of ports.

Maximum 10 ports per request.

## Request body

`application/json`, required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `portCodes` | array of string | Yes | List of port codes (unlocode), maximum 10. |

::api-request-body
Example request body:

```json
{
  "portCodes": [
    "FRMRS",
    "FRLEH"
  ]
}
```
::

## Responses

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

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `results` | array of object | No | — |
| `results[].portCode` | string | Yes | The port code (unlocode). |
| `results[].rateOccupation` | object | Yes | — |
| `results[].rateOccupation.commercialVessels` | object, nullable | No | — |
| `results[].rateOccupation.commercialVessels.rateOccupationPercentage` | number (double), nullable | No | — |
| `results[].rateOccupation.commercialVessels.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `results[].rateOccupation.cargo` | object, nullable | No | — |
| `results[].rateOccupation.cargo.rateOccupationPercentage` | number (double), nullable | No | — |
| `results[].rateOccupation.cargo.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `results[].rateOccupation.tanker` | object, nullable | No | — |
| `results[].rateOccupation.tanker.rateOccupationPercentage` | number (double), nullable | No | — |
| `results[].rateOccupation.tanker.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `results[].rateOccupation.roro` | object, nullable | No | — |
| `results[].rateOccupation.roro.rateOccupationPercentage` | number (double), nullable | No | — |
| `results[].rateOccupation.roro.rateOccupationGapWithMean` | number (double), nullable | No | — |
| `results[].time` | object | Yes | — |
| `results[].time.timeInPortStatistics` | object, nullable | No | — |
| `results[].time.timeInPortStatistics.max` | number (double), nullable | No | — |
| `results[].time.timeInPortStatistics.median` | number (double), nullable | No | — |
| `results[].time.timeInPortStatistics.min` | number (double), nullable | No | — |
| `results[].vesselsInPortCount` | object | Yes | — |
| `results[].vesselsInPortCount.commercialVessels` | integer, nullable | No | — |
| `results[].vesselsInPortCount.cargo` | integer, nullable | No | — |
| `results[].vesselsInPortCount.tanker` | integer, nullable | No | — |
| `results[].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 |

::

::api-response
---
status: "400"
description: The body in the request is not correct
---

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: "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: "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 | — |

::
