Jasmine

Build

HTTP API

JSON over HTTP on port 7171, except file bodies, which are raw bytes. If the daemon has an API key, send it as a bearer token on every /v1 request.

shell
export JASMINE_URL=http://127.0.0.1:7171
export AUTH="authorization: Bearer $JASMINE_API_KEY"

ID=$(curl -fsS -X POST $JASMINE_URL/v1/sandboxes -H "$AUTH" | jq -r .id)
curl -fsS -X POST $JASMINE_URL/v1/sandboxes/$ID/exec -H "$AUTH" \
  -H 'content-type: application/json' -d '{"cmd":"uname -a"}'
curl -fsS -X PUT "$JASMINE_URL/v1/sandboxes/$ID/files?path=/tmp/a.txt" -H "$AUTH" --data-binary 'hello'
curl -fsS -X DELETE $JASMINE_URL/v1/sandboxes/$ID -H "$AUTH"

Routes

MethodPathNotes
POST/v1/sandboxesCreate. Body (all optional): template, env, labels, key, cpu, memory_mib. 201 with id and timings.
GET/v1/sandboxesList. Filter with ?key= and ?label.name=value.
GET/v1/sandboxes/{id}One sandbox, with state running or paused.
DELETE/v1/sandboxes/{id}Delete.
POST/v1/sandboxes/{id}/execRun a command. Body: cmd (string or array), env, cwd, timeout_ms, stdin.
GET/v1/sandboxes/{id}/files?path=Read a file. Raw bytes.
PUT/v1/sandboxes/{id}/files?path=&mode=Write a file. Raw bytes in the body; mode in octal.
POST/v1/sandboxes/{id}/pausePause. 204.
POST/v1/sandboxes/{id}/resumeResume. Any other call also resumes.
POST/v1/sandboxes/{id}/snapshotSave as a new template. 201 with the template.
ANY/v1/sandboxes/{id}/ports/{port}/{path}Preview: proxies to a port inside the sandbox, WebSocket upgrades included.
POST/v1/sandboxes/{id}/mountsMount an S3 bucket. Body: bucket, path, prefix, endpoint, region, access_key_id, secret_access_key, session_token, read_only. 201 with path.
DELETE/v1/sandboxes/{id}/mounts?path=Unmount. 204.
GET/v1/templatesList templates.
POST/v1/templatesBuild. Body: name, image, vcpus (2), mem_mib (1024), prewarm_mib (256), setup, start, ready_port.
GET / DELETE/v1/templates/{name}Get or delete a template.
GET/healthzLiveness. Never needs auth.

Exec response

json
{
  "exit_code": 0, "signal": null, "timed_out": false,
  "stdout": "42\n", "stderr": "", "truncated": false,
  "duration_ms": 4.1
}

Errors

Errors are {"error": "message"} with a matching status: 401 for a missing or wrong key, 404 for an unknown sandbox or template, 409 when a name already exists, and 502 when a preview port has nothing listening.

Machine sizes

Pass both cpu and memory_mib on create to get a sandbox of that size. Jasmine looks for a template named{template}-{cpu}x{memory_mib} (for example default-4x8192), or uses the template itself if it was built at that size. If neither exists, the error tells you the exact jasmined build command to run.