Skip to content

Expose a VM app

POST/v1/vms/{uid}/apps

Publishes a port on the VM at its own HTTPS URL, https://<port>-<vm-host-label>.<domain>. The app starts as pending and becomes ready once the route is live.

Each VM can expose a given port once, and app names (after slugging) must be unique per VM.

This is asynchronous. It returns 202 Accepted with an operation_id. See Get an operation. Send an X-Idempotency key to make retries safe: a retry with the same key returns the original operation and its app with 200, instead of 409 for the name or port that the first request already took.

The key is tied to the VM and the app name (or port-<port> when no name is given). Reusing it on another VM or for another name returns 409 with action: idempotency_key_reused.

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Path parameters

uidstringRequired

The VM's uid.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

X-Idempotencystring

Optional unique key for this request, such as a UUID. Leading and trailing spaces are ignored. If you send a key you already used for the same action on the same resource, the original operation is returned with 200 OK and X-Idempotency-Replay: true, and nothing new is queued. The replay check runs before the resource is loaded or its state is checked, so a retry gets the original result even after the action has finished. Reusing a key for a different action, resource type or resource returns 409 with action: idempotency_key_reused. Keys are shared across the workspace. Without a key, every request is treated as new.

Request body

portintegerRequired

Port on the VM that the app listens on.

min 1 · max 65535

namestring

Name for the exposure. It is converted to a slug (lowercase letters, digits and hyphens), which must be 40 characters or fewer. Defaults to port-<port>.

max length 40

protocolstring

Backend protocol. Use grpc for gRPC (HTTP/2) services.

Default httpOne ofhttpgrpc

Response

202

The expose operation was queued.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued operation. Poll it with Get an operation.

vm_uidstringRequired

UID of the VM.

vm_namestringRequired

Name of the VM.

appobjectRequired

The app exposure. On a replay, its current state, or only uid, vm_uid and name if it has been removed.

Show attributes
uidstringRequired

Unique identifier of the app exposure.

vm_uidstringRequired

UID of the VM.

namestringRequired

Name of the exposure (stored in slug form).

slugstringRequired

Identifier used in the unexpose path.

statusstringRequired

pending while the route is being created, ready when live, deleting while being removed, failed if provisioning failed.

One ofpendingreadydeletingfailed

portintegerRequired

Port on the VM that the URL forwards to.

protocolstringRequired

Backend protocol.

One ofhttpgrpc

hostnamestringRequired

Public hostname of the exposure.

urlstringRequired

Public HTTPS URL of the exposure.

last_failurestring

Reason for the last failure. Omitted when there is none.

created_atstring (date-time)Required

When the exposure was created.

statusstringRequired

Status of the operation.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key or an in-flight removal.

is_completedbooleanRequired

true when a returned existing operation has already finished.

Response

200

Replay. The X-Idempotency key was already used to expose an app, so that operation is returned and nothing is queued. app is the app's current state. If the app has since been removed, app holds only its uid, vm_uid and name.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued operation. Poll it with Get an operation.

vm_uidstringRequired

UID of the VM.

vm_namestringRequired

Name of the VM.

appobjectRequired

The app exposure. On a replay, its current state, or only uid, vm_uid and name if it has been removed.

Show attributes
uidstringRequired

Unique identifier of the app exposure.

vm_uidstringRequired

UID of the VM.

namestringRequired

Name of the exposure (stored in slug form).

slugstringRequired

Identifier used in the unexpose path.

statusstringRequired

pending while the route is being created, ready when live, deleting while being removed, failed if provisioning failed.

One ofpendingreadydeletingfailed

portintegerRequired

Port on the VM that the URL forwards to.

protocolstringRequired

Backend protocol.

One ofhttpgrpc

hostnamestringRequired

Public hostname of the exposure.

urlstringRequired

Public HTTPS URL of the exposure.

last_failurestring

Reason for the last failure. Omitted when there is none.

created_atstring (date-time)Required

When the exposure was created.

statusstringRequired

Status of the operation.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key or an in-flight removal.

is_completedbooleanRequired

true when a returned existing operation has already finished.

Errors

StatusMeaning
400Validation failed: invalid request (missing or zero port), port must be between 1 and 65535, protocol must be http or grpc, name is invalid, or name must be 40 characters or fewer.
401The API key is missing, invalid, expired or revoked.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
404The resource does not exist or you cannot access it.
409Conflict: app exposure name already exists for this vm, app exposure port already exists for this vm, vm is not available for app exposure (VM deleting or deleted), http access is not configured, or the X-Idempotency key was used for a different operation (action: idempotency_key_reused).

Errors use the standard error format.