Sign Up

Previews

List sandbox ports

GET
/sandboxes/{sandbox_id}/ports

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: read:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

Query Parameters

limit?integer

Maximum number of items to return, 1–200 (default 100)

Formatint64
Range1 <= value <= 200
Default100
cursor?string

Opaque continuation token returned as next_cursor by a previous request

Response Body

The page of sandbox ports

application/json
  1. response

A keyset page of exposed sandbox ports.

next_cursor?|

Opaque continuation token, or null on the last page.

ports*array<>

Exposed sandbox ports in this page.

curl -X GET 'https://example.com/sandboxes/string/ports'
{  "next_cursor": "string",  "ports": [    {      "created_at": "2019-08-24T14:15:22Z",      "port": 0,      "public": true,      "url": "string"    }  ]}

Get a sandbox port

GET
/sandboxes/{sandbox_id}/ports/{port}

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: read:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

port*integer

The port number

Formatint32

Response Body

The sandbox port

application/json
  1. response

One exposed sandbox port on the wire (with the computed URL).

created_at*string

When the port was first exposed.

Formatdate-time
port*integer

TCP port exposed from the sandbox.

Formatint32
public*boolean

Whether the port is publicly accessible.

url*string

Host-based preview URL, <scheme>://<port>-<sandbox_id>.<domain>/.

curl -X GET 'https://example.com/sandboxes/string/ports/0'
{  "created_at": "2019-08-24T14:15:22Z",  "port": 0,  "public": true,  "url": "string"}

Delete a sandbox port

DELETE
/sandboxes/{sandbox_id}/ports/{port}

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: write:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

port*integer

The port number

Formatint32

Response Body

Sandbox port deleted

curl -X DELETE 'https://example.com/sandboxes/string/ports/0'
Empty

Set a sandbox port

PUT
/sandboxes/{sandbox_id}/ports/{port}

Replaces the port configuration.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: write:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

port*integer

The port number

Formatint32

Request Body

application/json
  1. body
public*boolean

Whether the port is accessible without a credential.

Response Body

The sandbox port, updated

application/json
  1. response

One exposed sandbox port on the wire (with the computed URL).

created_at*string

When the port was first exposed.

Formatdate-time
port*integer

TCP port exposed from the sandbox.

Formatint32
public*boolean

Whether the port is publicly accessible.

url*string

Host-based preview URL, <scheme>://<port>-<sandbox_id>.<domain>/.

curl -X PUT 'https://example.com/sandboxes/string/ports/0' \  -H 'Content-Type: application/json' \  -d '{  "public": true}'
{  "created_at": "2019-08-24T14:15:22Z",  "port": 0,  "public": true,  "url": "string"}
POST
/sandboxes/{sandbox_id}/ports/{port}/preview-url

Returns the port's preview URL, exposing the port as private first when it is not already exposed.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: write:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

port*integer

The port number

Formatint32

Response Body

The created preview URL

application/json
  1. response

A preview URL and its access token.

token*string

Secret value sent in the x-daytona-preview-token header.

url*string

Host-based preview URL, <scheme>://<port>-<sandbox_id>.<domain>/.

curl -X POST 'https://example.com/sandboxes/string/ports/0/preview-url'
{  "token": "string",  "url": "string"}
POST
/sandboxes/{sandbox_id}/ports/{port}/signed-preview-urls

Creates a short-lived preview link for one port. Each link can be revoked independently.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: write:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

port*integer

The port number

Formatint32

Request Body

application/json
  1. body

Response Body

The created signed preview URL

application/json
  1. response

A signed preview link.

expires_at*string

When the link stops resolving (natural expiry).

Formatdate-time
token*string

The plaintext signed token (s + 32 hex). Returned exactly once, here; only its hash is stored. Needed separately from url for the revoke route.

url*string

Host-based preview URL, <scheme>://<port>-<token>.<domain>/ — the token replaces the sandbox id in the hostname, so the link reveals no sandbox identity.

curl -X POST 'https://example.com/sandboxes/string/ports/0/signed-preview-urls'
{  "expires_at": "2019-08-24T14:15:22Z",  "token": "string",  "url": "string"}
POST
/sandboxes/{sandbox_id}/ports/{port}/signed-preview-urls/revoke

Revokes one signed preview link. An unknown or expired token is accepted without revealing whether it existed.

Authorization

headerAuthorizationBearer <token>

Bearer project API key.

Scope: write:sandboxes

Path Parameters

sandbox_id*string

The sandbox ID

port*integer

The port number

Formatint32

Request Body

application/json
  1. body
token*string

The plaintext signed token returned by the mint operation.

Response Body

Signed preview URL revoked

curl -X POST 'https://example.com/sandboxes/string/ports/0/signed-preview-urls/revoke' \  -H 'Content-Type: application/json' \  -d '{  "token": "string"}'
Empty