https://api.vers.sh/api/v2 with
Bearer token auth and durable, idempotent operations. You don’t need a heavy
client library to integrate it — the complete lifecycle fits in ~80 lines of
standard httpx (Python) or native fetch (TypeScript / Node 20+ / Bun).
Lifecycle mutations (create, checkpoint, restore, delete, image import) take a
UUID
Idempotency-Key header and return 202 Accepted with a durable operation
to poll or stream. Calls like branch, exec, sleep, and wake return directly.
See Durable operations.Prerequisites
- Export
VERS_API_KEYfrom your Vers dashboard. - Python: Python 3.10+ with
pip install httpx. - TypeScript: Node 20+, Bun, or Deno (uses built-in
fetchandnode:crypto).
End-to-end lifecycle example
This script imports an OCI image once, starts a KVM computer, writes and reads a file, executes a direct-argv command, captures a full-state checkpoint, fans out 4 parallel branches ($0 per branch), sleeps and wakes the computer, and cleans up.
- Python (httpx)
- TypeScript (fetch)
vers_client.py
Streaming operation progress instead of polling
Instead of pollingGET /api/v2/operations/{operation_id}, you can stream
newline-delimited JSON (application/x-ndjson) events from
GET /api/v2/operations/{operation_id}/events?cursor=0&follow=true. If your
client disconnects, reconnect with the last seen operation.cursor.
- Python (httpx)
- TypeScript (fetch)
Practical tips for production callers
- Pass
keep_background: truefor daemons: By default,POST /execreaps background processes when the command exits. Setkeep_background: truewhen starting dev servers or background workers so they remain alive across subsequentexecandcheckpointcalls. - Reuse the same
Idempotency-Keyon network retries: If a create or checkpoint call times out before you read the response, replaying the exact same request with the same UUID converges on the original operation instead of creating duplicate computers. - Avoid shell parsing when possible:
POST /execexecutescommanddirectly as argv (["pytest", "-q"]). Wrap explicitly in["bash", "-lc", "..."]only when you need shell pipes or redirects.
Next steps
Multi-VM project networks
Put app + Postgres computers on an isolated private network and branch the whole stack.
REST API reference
Browse all 89 generated
/api/v2 endpoints and try them interactively.