Quickstart: Linux

Start a Linux sandbox, see its screen, act on it and run a command

Not available yet Seeing and acting on a sandbox's screen is not offered yet. Commands, files and ports work today.

This guide starts a Linux sandbox, takes a screenshot, sends one action and runs a command, with your API key and nothing else. The cURL steps need curl, jq and uuidgen.

Make a key

Sign in to the dashboard, open Keys and make a test key. It starts pod_test_, and a test key sees only test sandboxes. The key is shown once: keep it in your environment.

export POD_API_KEY=pod_test_…

Start a sandbox

Ask for a Linux sandbox. The call waits until it is running, then answers it; with a snapshot ready it takes seconds.

SANDBOX=$(curl -s -X POST "https://api.pod.mapier.ai/v1/sandboxes" \
  -H "Authorization: Bearer $POD_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"system":"linux"}' | jq -r .id)
echo $SANDBOX

It prints the sandbox's id, such as sbx_3ahrz6dmv29gqy5ckt18fpx4b. Building for your own users? Add "end_user" to label the sandbox with one of them; Your users shows how. See Create a sandbox for every option.

See its screen

Take a screenshot. It answers the Linux desktop as a PNG, base64 in JSON, the way model APIs take an image.

curl -s "https://api.pod.mapier.ai/v1/sandboxes/$SANDBOX/screen/screenshot" \
  -H "Authorization: Bearer $POD_API_KEY" | jq -r .image | base64 -d > screen.png

Act on it

Send one action. This one clicks the middle of the desktop, at (640, 400) in screen pixels. Take another screenshot to see what changed.

curl -X POST "https://api.pod.mapier.ai/v1/sandboxes/$SANDBOX/screen/actions" \
  -H "Authorization: Bearer $POD_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"actions":[{"type":"click","x":640,"y":400}]}'

An agent works in this loop: look at the screen, choose an action, send it, look again. A model's own computer-use actions (OpenAI's, Anthropic's, Gemini's) go through screen.actAs (act_as in Python), which converts them.

Run a command

Commands run in /bin/sh. Their output streams back over a WebSocket, which the SDKs and mpod open for you.

const { stdout } = await sandbox.run("uname -a && cat /etc/os-release");
console.log(stdout);

With plain HTTP, Run a command in a sandbox answers the stream's address; that page covers standard input and commands that keep running.

Delete it

A sandbox is billed by the second while it runs. Delete it when you are done, or let it sleep: it sleeps by itself after 15 minutes with no activity.

curl -X DELETE "https://api.pod.mapier.ai/v1/sandboxes/$SANDBOX" \
  -H "Authorization: Bearer $POD_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Next