# Organization API: Customer Portal: Port forwards

> The 3 Organization API operations for port forwards.

Source: https://www.coritan.com/docs/api/reference/organizations/customer-portal/vps-port-forwards/

Part of [Customer Portal](/docs/api/reference/organizations/customer-portal/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/portal/vps/{uuid}/port-forwards`](#op-get-api-v1-orgs-org-slug-portal-vps-uuid-port-forwards) | The ports of the shared address that reach one of the customer's instances |
| POST | [`/api/v1/orgs/{org_slug}/portal/vps/{uuid}/port-forwards`](#op-post-api-v1-orgs-org-slug-portal-vps-uuid-port-forwards) | Forward a port of the shared address to a port of one of the customer's instances |
| DELETE | [`/api/v1/orgs/{org_slug}/portal/vps/{uuid}/port-forwards/{forward_uuid}`](#op-delete-api-v1-orgs-org-slug-portal-vps-uuid-port-forwards-forward-uuid) | Remove a port forward of one of the customer's instances |

### The ports of the shared address that reach one of the customer's instances {#op-get-api-v1-orgs-org-slug-portal-vps-uuid-port-forwards}

`GET /api/v1/orgs/{org_slug}/portal/vps/{uuid}/port-forwards`

The ports of the shared address that reach one of the customer's instances.

Answers ``{items, limit, used, available, reason, address}``. Each item is
``{uuid, label, kind, protocol, public_port, private_port, address,
endpoint, active, created_at}``: connections to ``public_port`` of the
shared address the instance's host gives it reach ``private_port`` of the
instance. ``protocol`` is ``tcp``, ``udp`` or ``both``. ``kind`` is
``ssh`` or ``rdp`` for the forward the instance got by itself (port 22 on
a Linux or BSD image, Remote Desktop on Windows) and ``custom`` for one
that was added. ``active`` is true while the forward reaches the
instance, and ``address`` and ``endpoint`` (``address:public_port``) are
null while it does not.

``available`` is true while the instance is behind a shared address
(``outbound.mode`` is ``nat``), and ``address`` is that address. Otherwise
``reason`` is ``public_ipv4`` (the instance has an address of its own, so
its forwards rest until that address is detached) or
``no_shared_address``. ``limit`` is how many forwards an instance holds
and ``used`` how many it has.

An instance that is not the customer's answers 404.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Forward a port of the shared address to a port of one of the customer's instances {#op-post-api-v1-orgs-org-slug-portal-vps-uuid-port-forwards}

`POST /api/v1/orgs/{org_slug}/portal/vps/{uuid}/port-forwards`

Forward a port of the shared address to a port of one of the customer's instances.

Send ``private_port`` (1 to 65535), ``protocol`` (``tcp``, ``udp`` or
``both``; ``tcp`` when left out) and an optional ``label`` of up to 64
characters. The public port is given, never chosen: the lowest free port
of the shared address, from 10000 to 40000. Answers the new forward, as
the list does. The host forwards the port within a minute or two.

Answers 409 when the instance has a public IPv4 address or no shared
address, holds five forwards already, already forwards that port with
that protocol, or is migrating; 403 when it is suspended; 422 for a port
or a protocol that is not one; 404 when the instance is not the customer's; 429
when asked too often.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required |
| --- | --- | --- |
| `private_port` | integer | yes |
| `protocol` | string, one of `tcp`, `udp`, `both` | no |
| `label` | string or null | no |

#### Responses

| Status | Meaning |
| --- | --- |
| `201` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Remove a port forward of one of the customer's instances {#op-delete-api-v1-orgs-org-slug-portal-vps-uuid-port-forwards-forward-uuid}

`DELETE /api/v1/orgs/{org_slug}/portal/vps/{uuid}/port-forwards/{forward_uuid}`

Remove a port forward of one of the customer's instances.

Answers ``{removed, public_port}`` and frees the port. 404 when the
forward or the instance is not the customer's; 409 while the instance is
migrating; 429 when asked too often.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `forward_uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
