Skip to main content
Vers exposes a standard JSON REST API at 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_KEY from your Vers dashboard.
  • Python: Python 3.10+ with pip install httpx.
  • TypeScript: Node 20+, Bun, or Deno (uses built-in fetch and node: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.
vers_client.py

Streaming operation progress instead of polling

Instead of polling GET /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.

Practical tips for production callers

  • Pass keep_background: true for daemons: By default, POST /exec reaps background processes when the command exits. Set keep_background: true when starting dev servers or background workers so they remain alive across subsequent exec and checkpoint calls.
  • Reuse the same Idempotency-Key on 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 /exec executes command directly 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.