---
search:
  tags:
    - Ports
    - POST
seo:
  description: >-
    Reference for the POST /v1/sandboxes/{id}/ports endpoint in the Carton API
    reference.
sidebar:
  label: POST /v1/sandboxes/{id}/ports
  badge: POST
title: POST /v1/sandboxes/{id}/ports
type: openapi-operation
---
`POST /v1/sandboxes/{id}/ports`

**Request body** (`application/json`, required)

- `port` (PortNumber, required)
- `proto` (PortProtocol, required)

Request body example:

```json
{
  "port": 1,
  "proto": "http"
}
```

**Responses**

- `201` — Success
- `400` — Typed error; Retry-After is present when retryable
- `401` — Typed error; Retry-After is present when retryable
- `403` — Typed error; Retry-After is present when retryable
- `404` — Unknown resource
- `409` — Idempotency request in progress, expired response, or conflicting state
- `410` — Sandbox existed and is gone; details contains its reason
- `413` — Request exceeds policy body limit
- `415` — Expected application/json
- `422` — Typed error; Retry-After is present when retryable
- `429` — Typed error; Retry-After is present when retryable
- `500` — Typed error; Retry-After is present when retryable
- `503` — Typed error; Retry-After is present when retryable

Response example, 201:

```json
{
  "auth_provenance": "provider_native",
  "expires_at": "2019-08-24T14:15:22Z",
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "port": 1,
  "proto": "http",
  "url": "http://example.com"
}
```
