/v1/vms/{uid}/app-portPoints the VM's own app URL (app_url) at a different port on the VM. The VM's app_port
only changes once the switch has finished, so it always shows the port being served.
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 with 200, even
after the port has switched. The same key with a different port 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
uidstringRequiredThe VM's uid.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
X-IdempotencystringOptional 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
portintegerRequiredPort on the VM that the app URL should forward to. Must differ from the current app_port.
min 1 · max 65535
Response
The port change was queued.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued operation. Poll it with Get an operation.
vm_uidstringRequiredUID of the VM.
namestringRequiredName of the VM. On a replay, the name the VM had when the operation was queued.
actionstringRequiredThe action that was queued.
One ofstartstoprebootdeleteresizeset_app_port
statusstringRequiredStatus of the operation. queued for a newly queued action.
One ofqueuedrunningsucceededfailed
vm_statusstringRequiredStatus of the VM (see VmStatus). For a new start, reboot or resize of a running VM,
provisioning; for a stop, stopped; for a delete, deleting; for a resize of a
stopped VM or an app port change, the VM's unchanged status. On a replay, the VM's
current status, or deleted once it is gone. Empty in the rare case the VM could not
be read during a replay.
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanRequiredtrue when a replayed operation has already finished. Always false for a newly queued action.
Response
Replay. The X-Idempotency key was already used for this action on this VM, so the existing operation is returned and nothing is queued. status is the operation's current status and vm_status the VM's current status (deleted once the VM is gone). For Set the app port the key is also tied to the requested port, and for Resize a VM to the requested plan; reusing it with a different one returns 409 with action: idempotency_key_reused.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued operation. Poll it with Get an operation.
vm_uidstringRequiredUID of the VM.
namestringRequiredName of the VM. On a replay, the name the VM had when the operation was queued.
actionstringRequiredThe action that was queued.
One ofstartstoprebootdeleteresizeset_app_port
statusstringRequiredStatus of the operation. queued for a newly queued action.
One ofqueuedrunningsucceededfailed
vm_statusstringRequiredStatus of the VM (see VmStatus). For a new start, reboot or resize of a running VM,
provisioning; for a stop, stopped; for a delete, deleting; for a resize of a
stopped VM or an app port change, the VM's unchanged status. On a replay, the VM's
current status, or deleted once it is gone. Empty in the rare case the VM could not
be read during a replay.
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanRequiredtrue when a replayed operation has already finished. Always false for a newly queued action.
Errors
| Status | Meaning |
|---|---|
400 | Validation failed: invalid request (missing or zero port) or port must be between 1 and 65535. |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The resource does not exist or you cannot access it. |
409 | Conflict: the app url already serves port <port>, this vm has no app url, vm is not available for this action (VM deleting or deleted), or the X-Idempotency key was used for a different operation (action: idempotency_key_reused). |
Errors use the standard error format.