Integrate
Use the REST API
Make your first requests and handle pagination, retries, and lifecycle state.
On this page
These walkthroughs show complete integration patterns. They are the starting point for application work; the REST API reference remains available for exact endpoint fields and permissions.
Make your first REST API requests
Authenticate, find a template, create a sandbox, and follow its status with curl.
Use the REST API when you need direct control from a language or service without an SDK. The base URL is https://api.zei.sh/api/v1. Every request below runs from a trusted server or terminal and reads the API key from an environment variable.
First list templates and choose an ID visible to your organization. Then create a sandbox with that template. Creation returns before the machine is necessarily ready, so copy the returned sandbox ID into SANDBOX_ID and poll its detail endpoint until its status is running before requesting runtime access.
The control API manages the sandbox but does not carry command input or output. To run commands, request the short-lived exec-access credential and use the data-plane client or SDK. Do not print that credential in logs. The SDK Quickstart is the shortest route if you want to run a command without implementing the data-plane protocol yourself.
Use one Idempotency-Key per logical create operation and reuse it only when retrying that same request after an uncertain network result. When the task is finished, stop the sandbox to keep it for later or delete it to remove it permanently.
1printf 'Zeish API key: '2IFS= read -r -s ZEISH_API_KEY3export ZEISH_API_KEY45# 1. Find a template. Choose one ID from the returned data array.6curl -sS https://api.zei.sh/api/v1/public/templates \7 -H "X-API-Key: $ZEISH_API_KEY"89# 2. Create a sandbox. Save the returned sandbox ID for the next requests.10curl -sS -X POST https://api.zei.sh/api/v1/public/sandboxes \11 -H "X-API-Key: $ZEISH_API_KEY" \12 -H "Idempotency-Key: task-123-create" \13 -H "Content-Type: application/json" \14 -d '{"name":"task-123","templateId":"TEMPLATE_ID"}'1516# Copy the returned id into this variable before continuing.17export SANDBOX_ID="sandbox-id-from-create-response"1819# 3. Check status until it is running.20curl -sS "https://api.zei.sh/api/v1/public/sandboxes/$SANDBOX_ID" \21 -H "X-API-Key: $ZEISH_API_KEY"2223# 4. When finished, delete the sandbox if you no longer need it.24curl -sS -X DELETE "https://api.zei.sh/api/v1/public/sandboxes/$SANDBOX_ID" \25 -H "X-API-Key: $ZEISH_API_KEY"Handle pagination and safe retries
Page through collections and retry requests without creating duplicate work.
List responses include a data array and nextCursor. Start with the first page, process its data, then send the returned cursor as the next request's cursor. Stop when nextCursor is absent or empty. Do not assume that one response contains every resource.
A timeout does not tell you whether a create request reached Zeish. Send an Idempotency-Key with create requests and reuse it for retries of that same operation. Use a new key for a new sandbox or job. For read requests and transient 429 or 5xx errors, use bounded exponential backoff and respect Retry-After when it is returned.
Do not automatically replay every mutation: a lifecycle action or delete may already have completed. Read the sandbox state or events to discover the result before deciding whether to try again. See Errors and limits for common HTTP status codes and SDK error fields. The REST API reference lists the exact routes and permissions.
1printf 'Zeish API key: '2IFS= read -r -s ZEISH_API_KEY3export ZEISH_API_KEY45curl -sS "https://api.zei.sh/api/v1/public/sandboxes?limit=20" \6 -H "X-API-Key: $ZEISH_API_KEY"78# If the response has a nextCursor, request the next page:9curl -sS "https://api.zei.sh/api/v1/public/sandboxes?limit=20&cursor=CURSOR" \10 -H "X-API-Key: $ZEISH_API_KEY"