HTTP API
All three SDKs call this HTTP API. Use this page to call it directly; it
lists only the routes the SDKs use. Rust types live in
dvm-api, and every JSON field below matches
them.
Request conventions
Section titled “Request conventions”- Base URL:
https://sandbox.dvm.run/apiplus the route. - API key: every route except login requires
Authorization: Bearer <key>(Getting in). - Bodies: JSON (
Content-Type: application/json), except input requests and output/file responses, which are raw bytes. - Errors: an HTTP error status and a JSON body with
message(Errors). - Numbers: IDs, offsets, versions, and seeds are integers below 253.
Sandboxes
Section titled “Sandboxes”POST /sandboxes
Section titled “POST /sandboxes”Creates a sandbox and returns 201 with it. Request body fields:
| Field | Type | Left out |
|---|---|---|
image |
an image reference, as docker run takes it |
needed |
command |
argv | none |
entrypoint |
a string | the image’s |
cpus |
integer | 1 |
memory_mib |
integer | 1024 |
seed |
integer | 0 |
name |
string | from the image |
environment |
[{"name": …, "value": …}] |
the image’s alone |
network |
{"mode": "public"}, {"mode": "none"}, or {"mode": "allowlist", "allow": […]} |
public |
Omitting both command and entrypoint creates a
session (a sandbox that accepts commands). See
One-program sandboxes for parameter ranges.
Every sandbox route returns a sandbox object with these fields:
| Field | |
|---|---|
id |
its id |
spec |
the fields above, as the sandbox has them now |
run.state |
{"kind": …}: queued, running, paused, exited with code, stopped, or failed with reason |
run.version |
grows with every change to the run |
run.inspectable |
whether its run can be inspected now |
GET /sandboxes/{id}
Section titled “GET /sandboxes/{id}”Returns the sandbox. With ?newer_than=<version>, waits until the run’s
version passes that value or about 30 seconds elapse (how the SDKs wait for
state changes). Returns 404 if missing or not yours.
POST /sandboxes/{id}/pause, /resume, /stop
Section titled “POST /sandboxes/{id}/pause, /resume, /stop”Pauses, resumes, or stops the run and returns its run. Returns 409 if
invalid in the current state (such as after ending).
PUT /sandboxes/{id}/network
Section titled “PUT /sandboxes/{id}/network”Updates where outbound connections may go and returns the sandbox. Body is a
network object as above. Returns 409 once ended.
Session input and output
Section titled “Session input and output”Sessions run over byte streams: append frames (a JSON header line plus raw payload bytes) to input and read response frames from output (The sandbox protocol).
POST /sandboxes/{id}/input?offset=<n>&end=<true|false>
Section titled “POST /sandboxes/{id}/input?offset=<n>&end=<true|false>”Appends the raw body (application/octet-stream, max 64 KiB) at byte
offset from the start of input. Returns {"length": <n>, "ended": <bool>}.
- An
offsetbelow the current length skips already-received bytes (safe to retry); past the length is rejected. end=truecloses input after this chunk; the session server reads up to there and exits.- Waits while the sandbox has not consumed earlier input.
- Returns
409for a one-program sandbox (this sandbox runs a program and takes no input), unstarted or ended sandboxes, or already-ended input.
GET /sandboxes/{id}/output?offset=<n>&stderr_offset=<m>
Section titled “GET /sandboxes/{id}/output?offset=<n>&stderr_offset=<m>”Returns bytes written by the first process after stdout offset and
stderr_offset as one frame
(Output frames). With offset, waits up
to about 30 seconds for new bytes; without, returns immediately from the
start. For a session, stdout holds session server response frames; for a
one-program sandbox, its own output.
Inspection
Section titled “Inspection”Available once a sandbox exits (Inspecting a finished run).
POST /sandboxes/{id}/points/seek
Section titled “POST /sandboxes/{id}/points/seek”Body takes target and optional watch_points (events to stop on):
target:{"kind": "end"},{"kind": "at_ns", "ns": …}, or{"kind": "event", "thread": …, "event": …}.watch_points: up to 32 objects, each{"kind": …}:syscall,named_syscallwithname,page_fault,processes,file_syscalls, orsocket_syscalls.
Returns the point reached:
| Field | |
|---|---|
thread, process, event |
the thread it stopped in, its process, and the thread’s event count |
recording_ns |
about when, in the recording’s time, if known |
at |
one of {"syscall": {number, name, args, decoded}}, {"page_fault": {address, write, present}}, {"arrival": {rip}} |
operations, stats |
counts up to there |
POST /sandboxes/{id}/points/step
Section titled “POST /sandboxes/{id}/points/step”Send {"thread": …, "event": …, "watch_points": […]} to advance from that
point to the next watched event. Returns the new point, or null when no
more watched events remain.
GET /sandboxes/{id}/fs/stat, /fs/list, /fs/read
Section titled “GET /sandboxes/{id}/fs/stat, /fs/list, /fs/read”Query parameters: thread, event, and an absolute path; /fs/stat
also accepts follow_symlinks=true|false. At that point in the run:
/fs/statreturns the file’s metadata:type,mode,uid,gid,size,links,mtimeandctimeas[seconds, nanoseconds], a symlink’stargetas hex bytes, and itsmount./fs/listreturns the directory’s entries:name,raw_nameas hex bytes, andtype./fs/readreturns the raw file bytes.
If the sandbox is not currently held at the named point, it seeks there again first.
dvm-run login calls these endpoints without an API key:
POST /cli-loginswith{"machine": "<name>"}returnsapprove_url,code,collect_token, andexpires_at.POST /cli-logins/keywith{"collect_token": "…"}waits up to 30 seconds and returnsnulluntil approved, then returns the new key once assecret.
The CLI then calls GET /me with the new key to display who you are signed
in as.