API Introduction
The Vers API provides programmatic access to VM management functionality. While most users interact with Vers through the CLI, the API enables direct integration into scripts, applications, and custom tooling.Base URL
Authentication
All API endpoints require authentication using a Bearer token, except for the health check:Health Check (Public)
The health endpoint is available without authentication at the root path:Core Concepts
VMs
Virtual machines are the primary resource in Vers. Each VM:- Has a unique VM ID (UUID format)
- Has a state:
running,paused, ornot_started - Can be branched, committed, paused, resumed, and deleted
- Provides SSH access for interactive use
Commits
Commits are snapshots of a VM’s complete state (filesystem + memory). You can:- Create commits from running VMs
- Restore VMs from existing commits
- Branch from commits to create new VMs
Rootfs Images
Base filesystem images that define the operating system and initial software.API Endpoints
VM Operations
| Method | Endpoint | Description |
|---|---|---|
GET | /vms | List all VMs |
POST | /vm/new_root | Create a new root VM |
GET | /vm/{vm_id}/status | Get VM status and details |
DELETE | /vm/{vm_id} | Delete a VM |
PATCH | /vm/{vm_id}/state | Update VM state (pause/resume) |
POST | /vm/{vm_id}/branch | Branch from a VM |
POST | /vm/{vm_id}/commit | Commit VM state |
POST | /vm/from_commit | Create VM from a commit |
GET | /vm/{vm_id}/ssh_key | Get SSH credentials |
Branch Operations
The branch endpoint auto-detects whether you’re branching from a VM or commit:- Briefly pauses the parent VM for a consistent snapshot
- Creates a commit of the VM’s current state
- Spawns a new VM from that commit
- Resumes the parent VM
- Both VMs end up running simultaneously
Rootfs Management
| Method | Endpoint | Description |
|---|---|---|
GET | /api/rootfs | List available rootfs images |
PUT | /api/rootfs/{name} | Upload a rootfs image |
DELETE | /api/rootfs/{name} | Delete a rootfs image |
SSH Access
The API provides SSH credentials for connecting to VMs programmatically.Getting SSH Credentials
SSH-over-TLS Connection
Vers uses SSH tunneled over TLS on port 443:- Host:
{vm_id}.vm.vers.sh - Port: 443 (TLS)
- Username:
root - Auth: Private key from the API
Programmatic SSH Example
Response Format
Successful responses return the data directly:Request Bodies
Create Root VM
Update VM State
"Paused", "Running"
Create from Commit
CLI to API Mapping
The Vers CLI uses this API. CLI commands map to API endpoints:| CLI Command | API Endpoint |
|---|---|
vers run | POST /vm/new_root |
vers status | GET /vms |
vers branch | POST /vm/{id}/branch |
vers commit | POST /vm/{id}/commit |
vers run-commit | POST /vm/from_commit |
vers delete / vers kill | DELETE /vm/{id} |
vers pause | PATCH /vm/{id}/state (state: Paused) |
vers resume | PATCH /vm/{id}/state (state: Running) |
Rate Limits
The API enforces rate limits to ensure fair usage. If you exceed limits, you’ll receive a429 Too Many Requests response.
See Also
- VM Access Guide - SSH connections and SDK usage
- CLI Reference - Command-line interface documentation
- API Playground (below) - Interactive endpoint testing