universe docs source
browse docs
docs /api-reference /instances

Instances API

Deploy, control, inspect, and stop instances across the cluster. Instance state lives in the Master Hazelcast IMap; these endpoints read it directly and dispatch control actions to the owning Wrapper. Every route on this page requires a key with ALL permission.

An instance is a single running process managed by a Wrapper node. Its record, an InstanceInfo object, is stored in the Master’s distributed instances map and shared across the cluster. These endpoints expose that record and the control actions that mutate it.

!
warning

Every endpoint on this page requires a token with ALL permission. There are no public instance reads. A request without a valid admin token returns 401 Unauthorized.

The InstanceInfo object

FieldTypeDescription
idstringUnique 6-character instance ID.
configurationNamestringName of the configuration this instance was deployed from.
wrapperNodeIdstringID of the node hosting this instance.
hostAddressstringHost address clients should connect to.
allocatedPortintegerPort allocated for this instance.
stateenumOne of CREATING, ONLINE, OFFLINE, STOPPED.
lastHeartbeatint64Unix timestamp of the last heartbeat.
processPidint64, nullableProcess ID; null for container runtimes.
allocatedRamMBintegerAllocated RAM in MB.
allocatedCpuintegerAllocated CPU units (100 = 1 core).
runtimestringRuntime provider used (screen, tmux, process, docker, k8s).

Instance states

StateMeaning
CREATINGInstance is being deployed; the record exists but the process is not yet running.
ONLINEInstance is running and reporting heartbeats.
OFFLINEInstance has missed heartbeats, typically because its Wrapper left the cluster.
STOPPEDInstance has been deliberately stopped.

List instances

GET /api/instances

Returns every instance across the cluster, active and stopped, as a JSON array.

curl http://<master>:7000/api/instances \
  -H "Authorization: Bearer YOUR_TOKEN"

Get an instance

GET /api/instances/{id}

Returns a single InstanceInfo by ID.

ParameterInDescription
idpath6-character instance ID. Required.
curl http://<master>:7000/api/instances/a1b2c3 \
  -H "Authorization: Bearer YOUR_TOKEN"

Create an instance

POST /api/instances

Deploys a new instance from an existing configuration. The Master selects an eligible Wrapper, allocates a port, writes the record with state: CREATING, and dispatches the deploy task. The response returns immediately with the new record; the state advances to ONLINE once the Wrapper finishes starting the process.

Body fieldTypeDescription
configurationNamestringName of the configuration to deploy. Required.
curl -X POST http://<master>:7000/api/instances \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"configurationName": "lobby"}'
i
note

An unknown configurationName returns 400 Bad Request. List the available names with GET /api/configurations.

Stop and delete an instance

DELETE /api/instances/{id}

Stops the instance and removes it from the cluster. The Master dispatches a stop task to the owning Wrapper, which terminates the process and cleans up the working directory unless the configuration is static.

curl -X DELETE http://<master>:7000/api/instances/a1b2c3 \
  -H "Authorization: Bearer YOUR_TOKEN"

Control the lifecycle

PATCH /api/instances/{id}/lifecycle?target=<start|stop|restart>

Changes the lifecycle of an existing instance without deleting its record. Use this to stop a running instance, start a stopped one, or restart in place.

ParameterInDescription
idpathInstance ID. Required.
targetqueryOne of start, stop, restart. Required.
curl -X PATCH "http://<master>:7000/api/instances/a1b2c3/lifecycle?target=restart" \
  -H "Authorization: Bearer YOUR_TOKEN"
i
note

An unknown target value or a missing instance returns 400 Bad Request.

Update instance state

PUT /api/instances/{id}/state

Updates the state and optional lastHeartbeat of an instance record directly. This is primarily used by Wrappers and tooling to report heartbeats; most operators should prefer the lifecycle endpoint above.

Body fieldTypeDescription
stateenumNew state: CREATING, ONLINE, OFFLINE, or STOPPED. Required.
lastHeartbeatint64Unix timestamp. Optional; reset if omitted.
curl -X PUT http://<master>:7000/api/instances/a1b2c3/state \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"state": "ONLINE", "lastHeartbeat": 1718000123456}'

Returns the updated InstanceInfo with status 200 OK.

Execute a command on an instance

POST /api/instances/{id}/execute

Sends a command to the instance’s stdin. The command is piped directly into the running process (for example a Minecraft server console), so the syntax is whatever the process expects.

Body fieldTypeDescription
commandstringCommand to write to the process stdin. Required.
curl -X POST http://<master>:7000/api/instances/a1b2c3/execute \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"command": "op andyreckt"}'
tip

The response confirms the command was dispatched, not its result. To watch the effect, stream output from the live-log WebSocket while you send commands.

Fetch logs

GET /api/instances/{id}/logs?lines=<1-1000>

Returns the most recent log lines for an instance. Works with every runtime, including Docker, Kubernetes, screen, tmux, and bare processes.

ParameterInDescription
idpathInstance ID. Required.
linesqueryNumber of lines to return. Default 100, minimum 1, maximum 1000.
curl "http://<master>:7000/api/instances/a1b2c3/logs?lines=100" \
  -H "Authorization: Bearer YOUR_TOKEN"
i
note

For continuous output rather than a one-time tail, open the live-log WebSocket at /api/instances/{id}/live-log. See the WebSockets page.