Get started
Quickstart
Create a machine that runs a command, stream its output, and delete it.
1Set up
Install what your language needs, then create a key on the API keys page. It is shown once.
Where a response returns an id, the cURL, TypeScript and Python samples keep it in a variable for the steps after it. Each Go sample is a program of its own: it prints the id, and the later programs read it from the environment.
curl --version | head -n 1 # 7.76 or later jq --version # 1.6 or later
export NITROUS_KEY= nx_…2Create a machine
The response returns once the machine is running and its command has started. The sample keeps its id as MACHINE_ID, machineId or machine_id, for the next steps; the Go program prints it: run export MACHINE_ID=… with the value. Without a size, the machine is standard.
KEY=$(uuidgen) MACHINE_ID= $(curl -sS -X POST https:// api.nitrous.sh/ v1/ machines \ --fail-with-body \ -H "Authorization: Bearer $NITROUS_KEY" \ -H "Idempotency-Key: $KEY" \ -H "Content-Type: application/ json" \ -d '{ "image": "ubuntu-26.04", "command": ["sh", "-c", "uname -r & & nproc"] }' | jq -er '.id // error(.error)')
{ "id": "m_01m3kmnv02f4j8bdzeyt7p2fhx", "object": "machine", "image": "ubuntu-26.04", "state": "running", "size": "standard", "created_at": "2026-09-28T09:14:02.114Z", "expires_at": "2026-09-28T10:14:02.114Z", … }
3Stream the output
With follow=true, the response stays open until the command exits.
curl -N "https://api.nitrous.sh/ v1/ machines/ $MACHINE_ID/ logs? follow= true" \ --fail-with-body \ -H "Authorization: Bearer $NITROUS_KEY"
6.1.128 2
4Delete the machine
A machine whose command has exited is already destroyed, unless it was created with keep_alive. DELETE returns the final state in either case.
curl -X DELETE "https://api.nitrous.sh/ v1/ machines/ $MACHINE_ID" \ --fail-with-body \ -H "Authorization: Bearer $NITROUS_KEY"
{ "id": "m_01m3kmnv02f4j8bdzeyt7p2fhx", "object": "machine", "state": "destroyed", "command": { "status": "exited", "exit_code": 0, "exit_signal": null, "exited_at": "2026-09-28T09:14:02.905Z" }, "destroyed_at": "2026-09-28T09:14:03.188Z", "destroy_reason": "command_exited", … }
Next
- Run commands in a kept machine.
- Build a custom image from a Dockerfile.
- Retry a create: which failures to retry, and how to reconcile the rest.