Skip to content

Read and write files, run programs and open terminals on an SVM.

Resource, request and plan limits are listed on Limits.

Run programs, read and write files, and open a terminal on one SVM. Each SVM has a host at https://<id>.slashinfra.dev. Send an API key with each request. The first request starts the SVM. A request also wakes an SVM that is stopped or paused. A preview host is https://<port>-<id>.slashinfra.dev. It sends requests to the TCP port in the SVM. The app keeps its own Authorization header, so send the API key in X-Si-Authorization. A closed port accepts organization members. An authenticated port also accepts an expiring preview link. A public port accepts anyone. Requests to a preview host go to the app on that port. Use the control API to create, list or delete an SVM and run its start, stop or pause action: Create an SVM, Delete an SVM.

Authentication

Send the key as Authorization: Bearer si_... on an SVM host. On a preview host, send it as X-Si-Authorization: Bearer si_....

si login saves a device key. The dashboard creates an organization key and shows its secret once. A key starts with si_ and has 43 base64url characters after the prefix.

API responses

  • 401: no key, an invalid key, or a deleted key. The body is unauthorized, and the reply carries WWW-Authenticate: Bearer.
  • 404: the host label is not an SVM id, no such SVM, an SVM that is being deleted, or an SVM of another organization. The body is not_found in each case.
  • 503: the SVM could not be reached. The body is the SVM could not be reached.

Deletion and key revocation follow the credential propagation period.

Bodies

Request bodies are raw bytes. POST uses the body as the program's standard input; PUT writes it as a file. Replies use text/plain; charset=utf-8 by default. File replies use the type from the file extension. Arguments and settings go in the query string; the API does not accept JSON request bodies. Send Accept: application/json for JSON directory listings and errors. A directory is an array of {name, type, size, mode, mtime}. An error is {error, code}; see Errors. A file GET returns a weak ETag and Last-Modified. If-None-Match can return 304; a PUT with If-Match returns 412 if the file changed. Every response includes Cache-Control: private and Referrer-Policy: no-referrer.

Download OpenAPI specification · Version 0.1.0

Files

Files and directories of one SVM.

Read a path

GET
/{path}

Returns a file or a directory listing, and wakes the SVM if it sleeps. A file above the file listing limit gets 413 when the API reads it as a listing; read a part with Range, or copy it with si cp.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key on an SVM host: si_ and 43 base64url characters, sent as Authorization: Bearer si_...; the dashboard shows an organization key once, and a deleted key stops working after the credential propagation period.

Path Parameters

path*string

The path in the SVM, without the first / (/ is the root); the API percent-decodes it, resolves . and .., and a trailing / names a directory.

Query Parameters

watch?boolean

?watch streams the changes of this path as Server-Sent Events for up to the plan's stream limit, each with path and kind (created, modified, deleted or moved); a directory watches its whole tree, changes to one path within 100 ms coalesce, and the stream keeps the SVM awake.

Header Parameters

Range?string

One byte range of a file: bytes=10-19 (bytes 10 to 19), bytes=90- (byte 90 to the end) or bytes=-5 (the last 5 bytes); any other form returns the whole file, and a range on a directory is ignored.

If-None-Match?string

A weak ETag from an earlier GET; when the file did not change, the answer is 304 with the same ETag and no content, and * matches any file.

Accept?"application/json"

application/json makes a directory listing a JSON array and an error a {error, code} body; any other value keeps the text listing.

Value in"application/json"

Response Body

The file, or the listing of a directory as ls -la does it, or a JSON array with Accept: application/json.

response?string
Example Request
curl -X GET 'https://6f1c0f0e8a.slashinfra.dev/string'
Example Response
[  {    "name": "string",    "type": "file",    "size": 0,    "mode": 0,    "mtime": 0  }]

Upload a file

PUT
/{path}

Writes the request body to a file atomically, within the file transfer limit. The parent directory must exist and a replaced file keeps its mode and owner; see files and programs for new-file modes and the executable bit.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key on an SVM host: si_ and 43 base64url characters, sent as Authorization: Bearer si_...; the dashboard shows an organization key once, and a deleted key stops working after the credential propagation period.

Path Parameters

path*string

The path of the file; its parent directory must exist.

Header Parameters

If-None-Match?"*"

* creates the file only if it does not exist, and an existing file gets 412.

Value in"*"
If-Match?string

A weak ETag from an earlier GET; if the file changed, the API returns 412 and does not write, and * requires the file to exist.

Content-Length?integer

The size of the body in bytes; without it the API reads until the body ends, and a value above the file transfer limit gets 413 before the body is read.

Range0 <= value <= 99614720

Request Body

The raw bytes of the file. The Content-Type of the request is ignored.

body*stringapplication/octet-stream

Response Body

The file did not exist and is now written. The body is empty.

Example Request
curl -X PUT 'https://6f1c0f0e8a.slashinfra.dev/string' \  -H 'Content-Type: application/octet-stream' \  -d 'string'
Example Response
Empty

Write at an offset

PATCH
/{path}

Writes the request body at a byte offset instead of replacing the file, and an append starts at the current size. Concurrent PATCH and PUT requests in one directory do not interleave, and an offset past the end of the file or the file transfer limit returns 416; PATCH never leaves a hole.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key on an SVM host: si_ and 43 base64url characters, sent as Authorization: Bearer si_...; the dashboard shows an organization key once, and a deleted key stops working after the credential propagation period.

Path Parameters

path*string

The file to write; it must exist, and a missing file gets 404.

Header Parameters

Content-Range*string

bytes <start>-*/*, the byte offset of the first body byte; only this form is accepted, and a bounded range or a suffix gets 400.

Content-Length?integer

The size of the body in bytes.

Range0 <= value <= 99614720

Request Body

The bytes to write at the offset.

body*stringapplication/octet-stream

Response Body

The bytes are written. The body is empty.

Example Request
curl -X PATCH 'https://6f1c0f0e8a.slashinfra.dev/string' \  -H 'Content-Range: string' \  -H 'Content-Type: application/octet-stream' \  -d 'string'
Example Response
Empty

Exec

Run a program in one SVM.

Run a program

POST
/{path}

Runs the executable at path as a new process of user: the request body is its standard input, and the reply is its standard output and error together. A non-zero X-Exit-Code still answers 200, the command limits set the timeouts and stream sizes, and background work covers longer jobs.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key on an SVM host: si_ and 43 base64url characters, sent as Authorization: Bearer si_...; the dashboard shows an organization key once, and a deleted key stops working after the credential propagation period.

Path Parameters

path*string

The executable file, where a directory gets 405 and /usr/bin/env finds the program in PATH.

Query Parameters

arg?array<string>

One argument of the program, repeated for each in order; the query is form-encoded (+ is a space and %2B a plus), with at most 512 KiB of arguments together and 400 for a NUL byte.

cwd?string

The working directory, an absolute path that exists and that user may enter, else 404 or 403; the default is /home/user.

Default"/home/user"
env?array<string>

One environment variable of this process as KEY=value, repeated for each; the value is split at its first =. A name may appear once per request and follows the environment rules of the SVM (400 otherwise, and for a NUL byte). It overrides the stored environment of the SVM for this process only and never changes it.

timeout?integer

The timeout of the program in seconds, from 1 to 30 with a default of 30: a value outside the range gets 400, and at the timeout the API ends the process group and returns the output so far.

Range1 <= value <= 30
Default30

Request Body

The standard input of the program, within the command input and output limits. Without Content-Length the API reads until the body ends. With Accept: text/event-stream the body streams under the transfer rates and has no 1 MiB cap.

body?stringapplication/octet-stream

Response Body

The output of the program. A non-zero X-Exit-Code is a failed program, not a failed request. A timeout sets X-Timeout: 1 and X-Exit-Code: 124.

response?string
Example Request
curl -X POST 'https://6f1c0f0e8a.slashinfra.dev/string' \  -H 'Content-Type: application/octet-stream' \  -d 'string'
Example Response
{  "exit": 0,  "stdout": "string",  "stderr": "string",  "truncated": true,  "timed_out": true}

Terminal

The interactive terminals of one SVM.

Open a terminal

GET
/bin/{program}

Opens a terminal of the SVM as user in /home/user over a WebSocket upgrade; the path picks the program, such as bash or an agent. Closing the connection ends the program unless it is an hc terminal, and a presence message counts as a person for the sleep policy, and the shell tool covers the protocol.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key on an SVM host: si_ and 43 base64url characters, sent as Authorization: Bearer si_...; the dashboard shows an organization key once, and a deleted key stops working after the credential propagation period.

Path Parameters

program*string

The terminal program. bash is a login shell. zellij, tmux and herdr are multiplexers and hc is the herdr-core API. claude, codex and opencode are coding agents that take their arguments from arg.

Value in"bash""zellij""tmux""herdr""hc""claude""codex""opencode"

Query Parameters

arg?array<string>

One argument of an agent program (claude, codex or opencode), repeated in order for up to 16 values; arg holds only the agent's own options and prompt, and each value is passed as one argument with the quoting that the agent's own parser needs.

Itemsitems <= 16

Header Parameters

Upgrade?"websocket"

websocket opens the interactive terminal, and without this header the request returns the terminal page or the program file.

Value in"websocket"

Response Body

The protocol switches to WebSocket. Binary frames carry terminal input and output; a text frame with {"cols":80,"rows":24} resizes the terminal.

Example Request
curl -X GET 'https://6f1c0f0e8a.slashinfra.dev/bin/bash'
Example Response
Empty