Skip to content

HTTP API reference

This page gives each route of the HTTP API of the daemon: the request, the answer, the status codes and the errors. The page is for a person who writes a client or who reads the code of a client.

The CLI, the Python SDK and the MCP server use this API. No other interface to the daemon exists.

Source:

Method and path Function
GET /v1/health Tell if the daemon answers.
GET /v1/info Describe the daemon.
POST /v1/sandboxes Create a sandbox.
GET /v1/sandboxes List the sandboxes.
GET /v1/sandboxes/{id} Get one sandbox.
DELETE /v1/sandboxes/{id} Kill a sandbox.
POST /v1/sandboxes/{id}/pause Pause a sandbox.
POST /v1/sandboxes/{id}/resume Resume a sandbox.
POST /v1/sandboxes/{id}/timeout Set a new timeout.
POST /v1/sandboxes/{id}/exec Run a command.
GET /v1/sandboxes/{id}/files Download a file.
PUT /v1/sandboxes/{id}/files Upload a file.
DELETE /v1/sandboxes/{id}/files Remove a file or a directory.
GET /v1/sandboxes/{id}/files/stat Describe one path.
GET /v1/sandboxes/{id}/files/list List a directory.
POST /v1/sandboxes/{id}/files/mkdir Make a directory.
POST /v1/sandboxes/{id}/files/rename Move a file or a directory.
POST /v1/sandboxes/{id}/snapshot Create a snapshot.
POST /v1/sandboxes/{id}/fork Fork a sandbox.
GET /v1/snapshots List the snapshots.
GET /v1/snapshots/{id} Get one snapshot.
DELETE /v1/snapshots/{id} Delete a snapshot.
POST /v1/pools Create a pool, or change the size of a pool.
GET /v1/pools List the pools.
GET /v1/pools/{id} Get one pool.
PATCH /v1/pools/{id} Change the size of a pool.
DELETE /v1/pools/{id} Delete a pool.
POST /v1/volumes Create a volume.
GET /v1/volumes List the volumes.
DELETE /v1/volumes/{name} Delete a volume.
GET /v1/gpus List the GPUs of the host.
GET /v1/tools List the tools for a model.
POST /v1/tools/{name} Do one tool call.

The daemon listens on 127.0.0.1:7070 unless boxfork serve --listen gives a different address. The examples on this page use http://127.0.0.1:7070 and the environment variable BOXFORK_API_KEY.

  • A request body is JSON. An empty body is the same as {}.
  • The maximum size of a JSON body is 8 MiB.
  • A field that the API does not know is an error. The daemon does not ignore a field with a wrong name.
  • A body that contains more than one JSON value is an error.
  • An answer is JSON with the header Content-Type: application/json. The file download and the streamed command are the exceptions.
  • A time is in RFC 3339 format, in UTC.
  • A duration is a JSON number of seconds. A fraction is permitted.
  • The daemon changes a positive duration smaller than 1 millisecond to 1 millisecond.
  • The daemon changes a duration larger than 100 years to 100 years.
  • The daemon does not send a redirect.

The identifiers have these forms:

Object Form Example
sandbox sbx_ and 16 characters sbx_k3v7q2mzj5xw4n6a
snapshot snap_ and 16 characters snap_p4c6w2yzr7mq3b5d
pool pool_ and 16 characters pool_h5n2x7tva3kq6m4c
volume The name that the client gives data

The 16 characters are lower-case letters and the digits 2 to 7.

Each route needs the API key. GET /v1/health is the only exception. Send the key in one of these two headers:

Authorization: Bearer <key>
X-API-Key: <key>

If a request has an Authorization header with the Bearer scheme, the daemon uses that header and ignores X-API-Key. The daemon reads the word Bearer in upper case or in lower case.

A request without the correct key gets status 401 and the error code unauthorized. The answer has the header WWW-Authenticate: Bearer realm="boxfork".

Terminal window
curl -i http://127.0.0.1:7070/v1/info
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Www-Authenticate: Bearer realm="boxfork"
{"error":{"code":"unauthorized","message":"send the API key as \"Authorization: Bearer <key>\""}}

The daemon has one API key. A client that has the key can see and change all sandboxes. configuration.md tells you where the daemon keeps the key.

An error answer has a status code of 400 or more and this body:

{"error": {"code": "sandbox_not_found", "message": "no sandbox with that id; it may have timed out or been killed"}}

code is a stable name for a program. message is text for a person.

Code Status Meaning
unauthorized 401 The API key is missing or wrong.
invalid_request 400 The request is wrong. The message tells you which field.
not_found 404 The method and the path are not a route. Also: a file or a directory does not exist in the sandbox.
sandbox_not_found 404 No sandbox has that identifier. Possibly its timeout ended, or a client killed it.
snapshot_not_found 404 No snapshot has that identifier.
pool_not_found 404 No pool has that identifier.
volume_not_found 404 No volume has that name.
unknown_tool 404 No tool has that name.
sandbox_paused 409 The sandbox is paused. Resume it first.
sandbox_stuck 409 The sandbox is suspended and the daemon cannot wake it. The message tells you what to change.
already_exists 409 A volume with that name exists.
in_use 409 A sandbox or a pool uses the snapshot or the volume.
gpu_unavailable 409 The host cannot give the GPUs that the request asks for. The message tells you why.
limit_reached 429 The host is at a limit: sandboxes, snapshots, volumes or waiting sandboxes.
unsupported 501 This host cannot do the operation. For example, snapshots do not work on the host.
too_large 413 The request body is larger than the limit.
too_large 422 The answer of the helper is larger than 32 MiB. This occurs for a directory with very many entries.
permission_denied 403 A file operation got a permission error in the sandbox.
is_directory 400 The path of a file operation is a directory.
not_directory 400 A part of the path of a file operation is not a directory.
invalid_argument 400 The helper refused a file operation. For example, the path is not a regular file.
io_error 500 A file operation failed in the sandbox for a different reason.
internal 500 The daemon or the engine failed. The message has the cause.

Notes:

  • A request for a method and a path that are not a route gets status 404. The daemon does not send status 405.
  • The daemon answers 404 for an unknown path also when the request has no API key.
  • If the client closes the connection before the answer, the daemon sends nothing.
  • When the answer is internal, the daemon writes the error to its log.

This route tells you that the daemon answers. It does not need the API key.

Terminal window
curl http://127.0.0.1:7070/v1/health
{"status":"ok"}

This route describes the daemon. Status: 200.

Field Type Meaning
version string The version of the daemon. A build without a version gives dev.
isolation string gvisor or container. With container, sandboxes share the kernel of the host.
network_isolated boolean true if the engine blocks traffic between sandboxes that have networking.
metadata_blocked boolean true if the firewall of the machine keeps sandboxes from the metadata service of the cloud. The daemon reads this value again for each request.
snapshots boolean true if snapshot and fork work on this host. The daemon does a test at start.
engine string The type of the engine: docker or podman.
engine_version string The version of the engine.
gpus integer The number of GPUs on the host.
sandboxes integer The number of sandboxes that the list shows.
Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" http://127.0.0.1:7070/v1/info
{
"version": "0.1.0",
"isolation": "gvisor",
"network_isolated": true,
"metadata_blocked": true,
"snapshots": true,
"engine": "docker",
"engine_version": "29.1.0",
"gpus": 0,
"sandboxes": 2
}

Many routes answer with a sandbox object.

Field Type Meaning
id string The identifier of the sandbox.
image string The image of the sandbox. For a sandbox from a snapshot, this is the image of the original sandbox.
state string running, paused or suspended.
isolation string gvisor or container.
cpus number The CPU limit, in cores.
memory_mb integer The memory limit, in MiB.
gpus array The GPUs of the sandbox. Each item has index, uuid, name and memory_mb. Absent when the sandbox has no GPU.
network boolean true if the sandbox has networking.
metadata object The metadata that the client gave. Absent when empty.
created_at time The time of creation. For a sandbox from a pool, the time when the daemon handed it out.
gpu_verified boolean true if the sandbox reported exactly its own GPUs. Absent when false.
suspend_after_seconds integer The idle time before the daemon suspends the sandbox. Absent when the daemon never suspends it.
unsaved_paths array of strings The directories that the image keeps in its own volumes. A snapshot does not contain them. The daemon does not suspend a sandbox that has such a directory. Absent when empty.
volumes array The mounted volumes: those of the request and the default volumes of the daemon. Each item has name, path and, if read-only, read_only. Absent when empty.
snapshot string The snapshot from which the daemon created the sandbox. Absent for a sandbox from an image.
expires_at time The time when the daemon kills the sandbox. Absent for a sandbox without a timeout and for a paused sandbox.

This route creates a sandbox and starts it. All fields are optional.

Field Type Default Meaning and limits
image string The default image of the daemon (ubuntu:24.04 unless --default-image gives a different one) The image to start from. The first character is a letter or a digit. The other permitted characters are letters, digits and ._:/@-. The text .. is not permitted.
snapshot string none The identifier of a snapshot to start from. Do not give image and snapshot together.
cpus number 2 CPU cores. 0 gives the default. A negative number is an error.
memory_mb integer 1024, or 8192 for a sandbox with a GPU Memory in MiB. 0 gives the default. A negative number is an error.
gpu integer, boolean or object no GPU The GPUs to attach. See the table below.
timeout_seconds number The default timeout of the daemon (300 unless --default-timeout gives a different one) The life of the sandbox. 0 means that the sandbox never ends. A negative number is an error.
env object of strings none Environment variables for the sandbox. A name must not be empty and must not contain =. The name NVIDIA_VISIBLE_DEVICES is not permitted.
metadata object of strings none Labels for the client. The daemon stores them and returns them.
network boolean true false gives a sandbox without networking.
suspend_after_seconds number The --gpu-idle-suspend value for a sandbox with a GPU; never for other sandboxes The idle time before the daemon suspends the sandbox. 0 means never. A value other than 0 must be 10 or more. The daemon rounds the value up to a full second.
volumes array of objects none The volumes to mount. See the table below.

The gpu field has these forms:

Value Meaning
0, false or null No GPU.
true One GPU.
a positive integer That number of full GPUs.
an object count (integer, default 1), model (string) and min_memory_mb (integer). model must be a part of the name of the device; upper case and lower case are equal. min_memory_mb is the minimum memory of each device. A count of 0 means no GPU.

Each item of volumes has these fields:

Field Type Default Meaning and limits
name string necessary The name of a volume that exists.
path string necessary The absolute path in the sandbox. No .., no slash at the end, no : and no ,. Not /. Not at or below /.boxfork, /proc, /sys or /dev.
read_only boolean false true mounts the volume read-only.

More limits and rules:

  • A sandbox mounts a maximum of 16 volumes. The default volumes of the daemon are in that number.
  • Two volumes cannot have the same path.
  • A volume in the request at the path of a default volume replaces the default volume in this sandbox.
  • If --max-timeout is set, a timeout_seconds of 0 or a larger value than the maximum is an error.
  • An image that holds the files of a snapshot (boxfork-snapshot:...) is not permitted in image. Use snapshot.
  • The daemon refuses suspend_after_seconds larger than 0 if the image keeps a directory in its own volume.
  • The daemon does not write env to the state file.

Status codes:

Status Code Cause
201 The sandbox runs. The body is the sandbox object.
400 invalid_request A field is wrong, or the engine did not find the image.
404 snapshot_not_found The snapshot does not exist.
404 volume_not_found A volume in volumes does not exist.
409 gpu_unavailable The host has no GPU, or not sufficient free GPUs.
429 limit_reached The host is at its --max-sandboxes limit.
501 unsupported The request has suspend_after_seconds larger than 0, and the host cannot save the files of a sandbox.
Terminal window
curl -X POST http://127.0.0.1:7070/v1/sandboxes \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"image": "python:3.12", "timeout_seconds": 600, "metadata": {"job": "tests"}}'
{
"id": "sbx_k3v7q2mzj5xw4n6a",
"image": "python:3.12",
"state": "running",
"isolation": "gvisor",
"cpus": 2,
"memory_mb": 1024,
"network": true,
"metadata": {"job": "tests"},
"created_at": "2026-12-05T10:15:30.412683Z",
"expires_at": "2026-12-05T10:25:30.412683Z"
}

Notes:

  • If a pool has a waiting sandbox for the same request, the daemon hands out that sandbox. See Pools.
  • If the client closes the connection before the answer, the daemon kills the new sandbox.
  • The daemon pulls the image if the engine does not have it. The first sandbox of an image can take a long time.
  • Before the daemon answers, it makes sure that the helper in the sandbox answers.

This route lists the sandboxes, the oldest first. Status: 200. The list does not show a waiting sandbox of a pool. It does not show a fork that is not complete.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" http://127.0.0.1:7070/v1/sandboxes
{
"sandboxes": [
{
"id": "sbx_k3v7q2mzj5xw4n6a",
"image": "python:3.12",
"state": "running",
"isolation": "gvisor",
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:15:30.412683Z",
"expires_at": "2026-12-05T10:25:30.412683Z"
}
]
}

This route returns one sandbox object. Status: 200, or 404 with sandbox_not_found.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a

The answer is a sandbox object, as in the example of POST /v1/sandboxes.

This route kills a sandbox. The daemon removes the container and all files in it. The daemon releases the GPUs of the sandbox after the engine removed the container.

Status: 204 without a body, or 404 with sandbox_not_found.

Terminal window
curl -i -X DELETE -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a
HTTP/1.1 204 No Content

If the client closes the connection, the daemon continues the kill for a maximum of 1 minute. A volume that the sandbox mounted stays.

This route pauses a sandbox. The request has no body. Status: 200 with the sandbox object.

  • The timeout clock stops. The answer has no expires_at.
  • If the sandbox is paused, the daemon changes nothing and returns the sandbox.
  • If the sandbox is suspended, the daemon wakes it first.
  • A paused sandbox refuses commands and file operations with sandbox_paused.
Terminal window
curl -X POST -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/pause
{
"id": "sbx_k3v7q2mzj5xw4n6a",
"image": "python:3.12",
"state": "paused",
"isolation": "gvisor",
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:15:30.412683Z"
}

This route resumes a paused sandbox. The request has no body. Status: 200 with the sandbox object.

  • The timeout clock starts again with the time that was left. The minimum is 1 second.
  • If the sandbox is not paused, the daemon changes nothing and returns the sandbox.
  • If the sandbox is suspended, the daemon wakes it. Use this route to wake a sandbox before you need it.
Terminal window
curl -X POST -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/resume

The answer is the sandbox object with "state": "running" and a new expires_at.

This route starts the timeout clock again from the present time.

Field Type Default Meaning and limits
timeout_seconds number necessary The sandbox ends this number of seconds from now. 0 means that the sandbox never ends. The limits are the same as for POST /v1/sandboxes.

Status: 200 with the sandbox object. 400 with invalid_request if the field is absent or out of the limits. 404 with sandbox_not_found.

For a paused sandbox, the daemon stores the value as the time that is left. The clock starts when the client resumes the sandbox.

Terminal window
curl -X POST http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/timeout \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"timeout_seconds": 1800}'
{
"id": "sbx_k3v7q2mzj5xw4n6a",
"image": "python:3.12",
"state": "running",
"isolation": "gvisor",
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:15:30.412683Z",
"expires_at": "2026-12-05T10:47:02.118204Z"
}

This route runs one command in a sandbox.

Field Type Default Meaning and limits
cmd string none A command line for a shell. The helper runs it with /bin/bash -c if the image has /bin/bash, and with /bin/sh -c if not.
argv array of strings none A program and its arguments. The helper runs them directly, without a shell.
cwd string The directory in which the engine starts the helper The directory of the command.
env object of strings none Environment variables for this command. They replace variables of the sandbox that have the same name.
timeout_seconds number 0 The helper kills the command after this time. 0 means no time limit. A negative number is an error.
stdin string none Text that the daemon sends to the standard input of the command. Then the daemon closes the standard input.
stdin_base64 string none The same as stdin, for input that is not text, in base64.
stream boolean false true makes the daemon stream the output.

Rules:

  • Give exactly one of cmd and argv.
  • Give stdin or stdin_base64, not the two together.
  • Without stdin and stdin_base64, the command reads from /dev/null.
  • Each command is a new process. A cd in one command has no effect on the next command.
  • If the sandbox is suspended, the daemon wakes it first.

Status codes:

Status Code Cause
200 The daemon ran the command, or started the stream. A command that fails also gives 200.
400 invalid_request A field is wrong.
404 sandbox_not_found The sandbox does not exist, or it ended while the command ran.
409 sandbox_paused The sandbox is paused.
409 sandbox_stuck The sandbox is suspended and cannot wake.
409 gpu_unavailable The sandbox is suspended and no GPU is free for it.

The daemon waits until the command ends. Then it answers with these fields:

Field Type Meaning
stdout string The standard output.
stderr string The standard error output.
exit_code integer The exit code of the command. For a command that a signal ended, 128 plus the number of the signal. 127 if the helper cannot start the command.
signal string The signal that ended the command, for example SIGKILL. Absent when no signal ended it.
timed_out boolean true if the time limit ended the command. Absent when false.
error string The reason why the helper cannot start the command. Absent when the command started.
truncated boolean true if an output was longer than the limit. Absent when false.

The daemon keeps the first 4 MiB of stdout and the first 4 MiB of stderr. It drops the remainder and sets truncated. The daemon replaces bytes that are not valid UTF-8 with the replacement character.

Terminal window
curl -X POST http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/exec \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"cmd": "python3 -c \"print(6 * 7)\"", "timeout_seconds": 30}'
{"stdout":"42\n","stderr":"","exit_code":0}

A command that the time limit ended gives this answer:

{"stdout":"","stderr":"","exit_code":137,"signal":"SIGKILL","timed_out":true}

The daemon sends a command of this type through the kept connection of the sandbox when that is possible. A command with more than 1 MiB of input gets its own connection. If the client closes the connection, the daemon stops the command and all processes that the command started.

With "stream": true, the answer has the header Content-Type: application/x-ndjson. Each line is one JSON object, an event. The daemon sends each event immediately. The answer also has the headers Cache-Control: no-store and X-Accel-Buffering: no.

type Other fields Meaning
started pid (integer) The process exists.
stdout data (string, base64) A part of the standard output.
stderr data (string, base64) A part of the standard error output.
exit exit_code (integer), signal, timed_out, error The command ended. This is the last event. The fields have the same meaning as in the answer without a stream.
error message (string) The daemon lost the connection to the sandbox. This is the last event.

Rules for the stream:

  • data is base64 because the output is not always text. A part can end in the middle of a character.
  • The stream has no limit on the size of the output.
  • An error before the first event is an ordinary error answer with its status code.
  • An error after the first event is an error event, because the daemon sent status 200 before.
  • If the stream ends without an exit event or an error event, the client does not know if the command ended.
  • If the client closes the connection, the daemon stops the command.
  • A streamed command does not use the kept connection.
Terminal window
curl -N -X POST http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/exec \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"argv": ["sh", "-c", "echo one; echo two >&2"], "stream": true}'
{"type":"started","pid":27}
{"type":"stdout","data":"b25lCg=="}
{"type":"stderr","data":"dHdvCg=="}
{"type":"exit","exit_code":0}

All file routes take a path in the sandbox. Give an absolute path. If the sandbox is suspended, the daemon wakes it first. A paused sandbox gives 409 with sandbox_paused.

A file route can give the error codes not_found, permission_denied, is_directory, not_directory, invalid_argument and io_error. See Errors for their status codes.

A file or a directory in the answers is an entry:

Field Type Meaning
name string The last part of the path.
path string The absolute path.
type string file, dir, symlink or other.
size integer The size in bytes.
mode string The permission bits as octal text, for example 0644.
mtime time The time of the last change.

This route downloads one file.

Query parameter Default Meaning
path necessary The path of the file.

Status: 200. The body is the bytes of the file.

Answer header Meaning
Content-Type application/octet-stream
Content-Length The size of the file in bytes.
X-Boxfork-Mode The permission bits as octal text, for example 0644.
  • If the body is shorter than Content-Length, the download is not complete.
  • The path must be a regular file. A directory gives is_directory. A different type gives invalid_argument.
  • A file that reports a size of 0, for example in /proc, can have a maximum of 16 MiB of content.
Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" -o hello.py \
"http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/files?path=/work/hello.py"

This route creates a file or replaces a file. The request body is the bytes of the file.

Query parameter Default Meaning and limits
path necessary The path of the file.
mode The mode of the file that exists, or 644 for a new file Octal permission bits from 1 to 7777, for example 755.
  • The maximum size of the body is 4 GiB. A larger body gives 413 with too_large.
  • The helper creates the directories of the path if they do not exist.
  • The helper writes a temporary file and then renames it. A reader sees the full old file or the full new file.
  • If the upload stops before the end, the helper discards the temporary file.

Status: 200.

Field Type Meaning
path string The path from the request.
size integer The number of bytes that the helper wrote.
Terminal window
curl -X PUT --data-binary @hello.py -H "Authorization: Bearer $BOXFORK_API_KEY" \
"http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/files?path=/work/hello.py&mode=644"
{"path":"/work/hello.py","size":15}

This route removes a file, or a directory and all its contents.

Query parameter Default Meaning
path necessary The path to remove. / is not permitted.

Status: 204 without a body. A path that does not exist gives 404 with not_found.

Terminal window
curl -i -X DELETE -H "Authorization: Bearer $BOXFORK_API_KEY" \
"http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/files?path=/work/old"
HTTP/1.1 204 No Content

This route describes one path. If the last part of the path is a symbolic link, the answer describes the link.

Query parameter Default Meaning
path necessary The path to describe.

Status: 200 with one entry.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" \
"http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/files/stat?path=/work/hello.py"
{"name":"hello.py","path":"/work/hello.py","type":"file","size":15,"mode":"0644","mtime":"2026-12-05T10:16:02.51Z"}

This route lists the entries of one directory. It does not list the directories below it.

Query parameter Default Meaning
path necessary The path of the directory.

Status: 200. The body has one field, entries, an array of entries. An empty directory gives an empty array. If the answer of the helper is larger than 32 MiB, the status is 422 with too_large.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" \
"http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/files/list?path=/work"
{
"entries": [
{"name":"data","path":"/work/data","type":"dir","size":4096,"mode":"0755","mtime":"2026-12-05T10:15:58.2Z"},
{"name":"hello.py","path":"/work/hello.py","type":"file","size":15,"mode":"0644","mtime":"2026-12-05T10:16:02.51Z"}
]
}

This route makes a directory and the directories above it that do not exist. The mode of a new directory is 0755.

Field Type Default Meaning
path string necessary The path of the directory.

Status: 204 without a body. A directory that exists is not an error.

Terminal window
curl -i -X POST http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/files/mkdir \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"path": "/work/data/raw"}'
HTTP/1.1 204 No Content

This route moves a file or a directory. The helper creates the directories of the target if they do not exist.

Field Type Default Meaning
from string necessary The path that exists.
to string necessary The new path.

Status: 204 without a body.

Terminal window
curl -i -X POST http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/files/rename \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"from": "/work/hello.py", "to": "/work/src/main.py"}'
HTTP/1.1 204 No Content

A snapshot holds the files of a sandbox. It does not hold the processes or the memory. A snapshot does not hold the contents of a mounted volume, or the directories in unsaved_paths.

Field Type Meaning
id string The identifier of the snapshot.
sandbox_id string The sandbox that the snapshot came from. That sandbox can be gone.
image string The image of that sandbox.
metadata object The metadata from the request. Absent when empty.
created_at time The time when the engine completed the snapshot.
temporary boolean true for a snapshot that a fork or a suspension made. The daemon deletes it when the last sandbox from it is gone. Absent when false.
excluded_paths array of strings The directories of the sandbox that the snapshot does not contain. Absent when empty.

This route saves the files of a sandbox as a snapshot. The sandbox continues after the snapshot.

Field Type Default Meaning
metadata object of strings none Labels for the client.

Status codes:

Status Code Cause
201 The body is the snapshot object.
404 sandbox_not_found The sandbox does not exist.
429 limit_reached The host is at its --max-snapshots limit. Delete a snapshot first.
501 unsupported Snapshots do not work on this host. The message tells you why.
  • If the sandbox is suspended, the daemon wakes it first.
  • If the client closes the connection, the daemon continues the snapshot for a maximum of 15 minutes.
  • Temporary snapshots do not count for the --max-snapshots limit.
Terminal window
curl -X POST http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/snapshot \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"metadata": {"step": "deps-installed"}}'
{
"id": "snap_p4c6w2yzr7mq3b5d",
"sandbox_id": "sbx_k3v7q2mzj5xw4n6a",
"image": "python:3.12",
"metadata": {"step": "deps-installed"},
"created_at": "2026-12-05T10:18:44.907115Z"
}

This route makes one or more new sandboxes with the files of a sandbox that runs. The daemon creates one temporary snapshot and creates each fork from it.

Field Type Default Meaning and limits
count integer 1 The number of forks, from 1 to 64. 0 gives the default.
timeout_seconds number The default timeout of the daemon The life of each fork. The limits are the same as for POST /v1/sandboxes.
gpu integer, boolean or object The number of GPUs of the original sandbox The GPUs of each fork. The forms are the same as for POST /v1/sandboxes. 0 or false gives forks without a GPU.
metadata object of strings The metadata of the original sandbox When present, it replaces the metadata of the original sandbox on each fork.

Each fork gets these properties from the original sandbox:

  • cpus, memory_mb and network
  • the same mounted volumes: the forks and the original sandbox share each volume
  • suspend_after_seconds

A fork has the files of the original sandbox. It has none of its processes. The daemon does not keep env, and it does not send the env of the original sandbox for a fork.

Status codes:

Status Code Cause
201 All forks run.
400 invalid_request A field is wrong.
404 sandbox_not_found The sandbox does not exist.
409 gpu_unavailable Each fork of a sandbox with a GPU needs its own free GPU.
429 limit_reached The forks go above the --max-sandboxes limit.
501 unsupported Snapshots do not work on this host.

The answer has these fields:

Field Type Meaning
snapshot_id string The temporary snapshot of the fork.
sandboxes array One sandbox object for each fork.
  • The fork is all or nothing. If one fork fails, the daemon removes the others and returns the error.
  • The daemon creates a maximum of 8 forks at the same time.
  • If the client closes the connection before the answer, the daemon kills the forks.
Terminal window
curl -X POST http://127.0.0.1:7070/v1/sandboxes/sbx_k3v7q2mzj5xw4n6a/fork \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"count": 2}'
{
"snapshot_id": "snap_d7k2m5xq4w6zr3pa",
"sandboxes": [
{
"id": "sbx_a6r3n5wq2zk7m4xc",
"image": "python:3.12",
"state": "running",
"isolation": "gvisor",
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:20:11.640318Z",
"snapshot": "snap_d7k2m5xq4w6zr3pa",
"expires_at": "2026-12-05T10:25:11.640318Z"
},
{
"id": "sbx_t2x7c4mq6va5k3zn",
"image": "python:3.12",
"state": "running",
"isolation": "gvisor",
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:20:11.655902Z",
"snapshot": "snap_d7k2m5xq4w6zr3pa",
"expires_at": "2026-12-05T10:25:11.655902Z"
}
]
}

This route lists the snapshots, the oldest first. The list includes temporary snapshots. Status: 200.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" http://127.0.0.1:7070/v1/snapshots
{
"snapshots": [
{
"id": "snap_p4c6w2yzr7mq3b5d",
"sandbox_id": "sbx_k3v7q2mzj5xw4n6a",
"image": "python:3.12",
"metadata": {"step": "deps-installed"},
"created_at": "2026-12-05T10:18:44.907115Z"
},
{
"id": "snap_d7k2m5xq4w6zr3pa",
"sandbox_id": "sbx_k3v7q2mzj5xw4n6a",
"image": "python:3.12",
"created_at": "2026-12-05T10:20:11.213377Z",
"temporary": true
}
]
}

This route returns one snapshot object. Status: 200, or 404 with snapshot_not_found.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/snapshots/snap_p4c6w2yzr7mq3b5d

The answer is a snapshot object, as in the example of POST /v1/sandboxes/{id}/snapshot.

This route deletes the files of a snapshot.

Status Code Cause
204 The snapshot is gone. The answer has no body.
404 snapshot_not_found The snapshot does not exist.
409 in_use A sandbox from the snapshot exists, or a pool uses the snapshot. Kill the sandboxes or delete the pool first.
Terminal window
curl -i -X DELETE -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/snapshots/snap_p4c6w2yzr7mq3b5d
HTTP/1.1 204 No Content

A pool keeps a number of sandboxes started for one image or one snapshot. When a client creates a sandbox that is the same as those of a pool, the daemon hands out a waiting sandbox. Then the daemon starts a new waiting sandbox.

POST /v1/sandboxes gets a waiting sandbox only if all these conditions are true:

  • The request has the image of the pool, written with the same text, or the snapshot of the pool.
  • cpus, memory_mb and network are equal to those of the pool, after the defaults.
  • The request has no gpu, no env and no volumes.

If no waiting sandbox is available, the daemon creates the sandbox in the usual way. A pool never makes a create fail.

Field Type Meaning
id string The identifier of the pool.
image string The image of the sandboxes. Absent for a pool of a snapshot.
snapshot string The snapshot of the sandboxes. Absent for a pool of an image.
size integer The number of sandboxes that the pool keeps.
cpus number The CPU limit of each sandbox.
memory_mb integer The memory limit of each sandbox, in MiB.
network boolean true if the sandboxes have networking.
created_at time The time of creation.
ready integer The number of waiting sandboxes at this moment.
last_error string The reason why the daemon did not start the last sandbox of the pool. Absent when the last start was good.

This route creates a pool. The daemon answers immediately and starts the sandboxes after the answer. If a pool for the same image or snapshot, cpus, memory_mb and network exists, the route changes its size.

Field Type Default Meaning and limits
image string The default image of the daemon The image of the sandboxes. The rules are the same as for POST /v1/sandboxes.
snapshot string none A snapshot to start from. Do not give image and snapshot together. A temporary snapshot is not permitted.
size integer necessary The number of sandboxes to keep. The minimum is 1.
cpus number 2 CPU cores of each sandbox.
memory_mb integer 1024 Memory of each sandbox in MiB.
network boolean true false gives sandboxes without networking.

Status codes:

Status Code Cause
201 The daemon created the pool. The body is the pool object.
200 The pool was there. The daemon changed its size. The body is the pool object.
400 invalid_request A field is wrong.
404 snapshot_not_found The snapshot does not exist.
429 limit_reached The sizes of all pools together go above the --max-pooled limit. The default limit is 64.
Terminal window
curl -X POST http://127.0.0.1:7070/v1/pools \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"image": "python:3.12", "size": 8}'
{
"id": "pool_h5n2x7tva3kq6m4c",
"image": "python:3.12",
"size": 8,
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:30:00.004512Z",
"ready": 0
}

Notes:

  • A waiting sandbox has no timeout. The timeout clock starts when the daemon hands it out.
  • Waiting sandboxes do not count for the --max-sandboxes limit.
  • When a sandbox for a pool does not start, the daemon tries again after 30 seconds. last_error has the reason.

This route lists the pools, the oldest first. Status: 200.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" http://127.0.0.1:7070/v1/pools
{
"pools": [
{
"id": "pool_h5n2x7tva3kq6m4c",
"image": "python:3.12",
"size": 8,
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:30:00.004512Z",
"ready": 8
}
]
}

This route returns one pool object. Status: 200, or 404 with pool_not_found.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/pools/pool_h5n2x7tva3kq6m4c

The answer is a pool object, as in the example of POST /v1/pools.

This route changes the number of sandboxes that a pool keeps.

Field Type Default Meaning and limits
size integer necessary The new number. The minimum is 1. To keep no sandboxes, delete the pool.

Status: 200 with the pool object. 400 with invalid_request, 404 with pool_not_found or 429 with limit_reached. If the new size is smaller, the daemon removes the waiting sandboxes that are too many. The daemon does this after the answer, thus ready can be larger than size in the answer.

Terminal window
curl -X PATCH http://127.0.0.1:7070/v1/pools/pool_h5n2x7tva3kq6m4c \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"size": 4}'
{
"id": "pool_h5n2x7tva3kq6m4c",
"image": "python:3.12",
"size": 4,
"cpus": 2,
"memory_mb": 1024,
"network": true,
"created_at": "2026-12-05T10:30:00.004512Z",
"ready": 8
}

This route deletes a pool and its waiting sandboxes. Sandboxes that the daemon handed out from the pool stay.

Status: 204 without a body, or 404 with pool_not_found. If the client closes the connection, the daemon continues for a maximum of 2 minutes.

Terminal window
curl -i -X DELETE -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/pools/pool_h5n2x7tva3kq6m4c
HTTP/1.1 204 No Content

A volume is storage that stays when a sandbox goes. The engine keeps the volumes. A sandbox mounts a volume through the volumes field of POST /v1/sandboxes.

Field Type Meaning
name string The name of the volume.
created_at time The time of creation.
sandboxes array of strings The identifiers of the sandboxes that mount the volume.
default_path string The path at which each new sandbox mounts the volume. Present only for a volume that boxfork serve --volume names.

This route creates an empty volume.

Field Type Default Meaning and limits
name string necessary 1 to 63 characters: lower-case letters, digits, ., _ and -. The first character is a letter or a digit.

Status codes:

Status Code Cause
201 The body is the volume object.
400 invalid_request The name is not permitted.
409 already_exists A volume with that name exists.
429 limit_reached The host is at its --max-volumes limit.
Terminal window
curl -X POST http://127.0.0.1:7070/v1/volumes \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"name": "data"}'
{"name":"data","created_at":"2026-12-05T10:40:12Z","sandboxes":[]}

This route lists the volumes in the sequence of their names. Status: 200. The list shows only the volumes that boxfork made.

Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" http://127.0.0.1:7070/v1/volumes
{
"volumes": [
{"name":"data","created_at":"2026-12-05T10:40:12Z","sandboxes":["sbx_k3v7q2mzj5xw4n6a"]},
{"name":"models","created_at":"2026-12-04T08:02:51Z","sandboxes":[],"default_path":"/models"}
]
}

This route deletes a volume and all its contents.

Status Code Cause
204 The volume is gone. The answer has no body.
404 volume_not_found No volume has that name.
409 in_use A sandbox mounts the volume, or the volume is a default volume of the daemon. A suspended sandbox also counts.
Terminal window
curl -i -X DELETE -H "Authorization: Bearer $BOXFORK_API_KEY" \
http://127.0.0.1:7070/v1/volumes/data
HTTP/1.1 204 No Content

This route lists the GPUs of the host and their use. Status: 200. The body has one field, gpus. On a host without a GPU, the array is empty.

Field Type Meaning
index integer The index of the device.
uuid string The identifier that the driver gives the device.
name string The model name.
memory_mb integer The memory of the device in MiB.
sandbox_id string The sandbox that holds the device. Absent when no sandbox holds it.
busy boolean true if a program that is not boxfork uses the device. Absent when false.
missing boolean true if the driver does not list the device at this time. The GPU allocator does not give it to a sandbox. Absent when false.
suspect boolean true if the last sandbox that got the device failed the GPU check. The GPU allocator gives it only when no other device is free. Absent when false.
memory_used_mb integer The memory in use, in MiB.
utilization_pct integer The load of the device, in percent.
Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" http://127.0.0.1:7070/v1/gpus
{
"gpus": [
{
"index": 0,
"uuid": "GPU-5b6c1d2e-8f3a-4c7b-9d1e-2a3b4c5d6e7f",
"name": "NVIDIA A100-SXM4-40GB",
"memory_mb": 40960,
"sandbox_id": "sbx_k3v7q2mzj5xw4n6a",
"memory_used_mb": 1320,
"utilization_pct": 12
},
{
"index": 1,
"uuid": "GPU-0f9e8d7c-6b5a-4d3c-8b2a-1f0e9d8c7b6a",
"name": "NVIDIA A100-SXM4-40GB",
"memory_mb": 40960,
"memory_used_mb": 0,
"utilization_pct": 0
}
]
}

This example shows the field names. Nobody did a test of the GPU routes on a machine with a real GPU.

These two routes give a model the sandbox tools. The MCP server and the tool kit of the Python SDK use them. mcp-and-tools.md describes each tool, its arguments and its answer.

This route lists the tools. Status: 200. The body has one field, tools.

Field Type Meaning
name string The name of the tool.
title string A short title for a person.
description string The text that tells a model when to use the tool.
input_schema object The arguments, as JSON Schema.
read_only boolean true if the tool changes nothing.
destructive boolean true if the tool can destroy work.
session_sandbox boolean true if a session can supply sandbox_id when the model omits it.
longest_seconds number The longest time that one call can take. Present only for sandbox_exec.
Terminal window
curl -H "Authorization: Bearer $BOXFORK_API_KEY" http://127.0.0.1:7070/v1/tools
{
"tools": [
{
"name": "sandbox_kill",
"title": "Remove a sandbox",
"description": "Stop a sandbox and delete everything in it. Its GPUs are freed. This cannot be undone; take a snapshot first if the files matter.",
"input_schema": {
"additionalProperties": false,
"properties": {
"sandbox_id": {"description": "The sandbox to remove.", "type": "string"}
},
"required": ["sandbox_id"],
"type": "object"
},
"read_only": false,
"destructive": true,
"session_sandbox": false
}
]
}

The example shows one of the nine tools.

This route does one tool call. The request body is the arguments of the call, a JSON object. The maximum size of the body is 8 MiB.

This route does not supply a sandbox. A tool that works in a sandbox needs sandbox_id in the arguments. The MCP server and the tool kit add the session rules.

Status codes:

Status Code Cause
200 The daemon did the call. A call that failed also gives 200, with is_error set.
404 unknown_tool No tool has that name.
413 too_large The body is larger than 8 MiB.

The answer has these fields:

Field Type Meaning
text string The result, as text for a model.
data object The same result as values for a program. Absent when the call has none.
is_error boolean true if the call did not do the work. text then gives the reason.
code string The type of the failure, for example sandbox_not_found. Absent when the call was good.
created array of strings The sandboxes that this call created. Absent when empty.
removed array of strings The sandboxes that this call killed. Absent when empty.
Terminal window
curl -X POST http://127.0.0.1:7070/v1/tools/sandbox_exec \
-H "Authorization: Bearer $BOXFORK_API_KEY" \
-d '{"sandbox_id": "sbx_k3v7q2mzj5xw4n6a", "command": "echo hello"}'
{
"text": "exit code: 0\nstdout:\nhello",
"data": {"exit_code": 0, "sandbox_id": "sbx_k3v7q2mzj5xw4n6a", "stderr": "", "stdout": "hello\n"},
"is_error": false
}

If the client closes the connection before the answer, the daemon kills the sandboxes that the call created.

Limit Value
JSON request body 8 MiB
File upload 4 GiB
stdout and stderr of a command without a stream 4 MiB each
Answer of the helper for a file operation 32 MiB
Content of a file that reports a size of 0 16 MiB
Forks in one call 64
Volumes in one sandbox 16
Characters in the name of a volume 63
Minimum of suspend_after_seconds, when not 0 10
Waiting sandboxes in all pools 64, or the --max-pooled value

The API has no flag to change the first five limits.

  • The GPU fields and the gpu_unavailable error ran only against stand-ins, not against a real GPU.
  • The examples on this page show the correct field names. A person wrote the values in them by hand.