Maton

Daytona

Access the Daytona API with managed authentication. Manage sandboxes (list, inspect, label, set lifecycle intervals, start, stop, delete), read snapshots, volumes, and regions, and use the sandbox toolbox to list, read, upload, and delete files and to execute commands or code inside a running sandbox. All access runs through the Maton gateway and the maton CLI.

Permissions

Suggested read access

In the Console, Read limits the connection to these 104 read-only endpoints, plus deny rules for any write endpoint a broader rule would otherwise match. Endpoints Maton has found to return credentials, start jobs, or spend credits are left out; a few reads that can change state or return a secret depending on their parameters stay in, and their descriptions say how. It is a suggestion: the saved rules are exactly the ones you see, and you can change them with Custom. See Access policy.

Reference

API Key

Get Current API Key

maton api '/daytona/api/api-keys/current'

Response:

{
  "name": "my-agent-key",
  "value": "dtn********************899",
  "createdAt": "2026-07-03T23:39:56.337Z",
  "permissions": ["write:sandboxes", "delete:sandboxes"],
  "lastUsedAt": "2026-11-26T22:57:34.274Z",
  "expiresAt": null,
  "userId": "{user_id}",
  "organizationId": "{organization_id}"
}

Use this to check the connection and which permissions the key has. value is masked. /users/me and /organizations reject API keys with 401; they need a dashboard login and are out of scope.

Sandboxes

List Sandboxes

maton api '/daytona/api/sandbox?limit=20'

Query parameters:

  • limit (integer, optional): Results per page
  • cursor (string, optional): nextCursor from the previous page
  • name / id (string, optional): Prefix filter
  • labels (string, optional): JSON-encoded labels, e.g. {"purpose":"ci"} (URL-encode it)
  • states (array, optional): e.g. started, stopped, archived, error
  • sort / order (string, optional): Sort field and direction

Response:

{
  "items": [
    {
      "id": "{sandbox_id}",
      "name": "{sandbox_id}",
      "state": "started",
      "snapshot": "daytonaio/sandbox:0.11.0",
      "target": "us",
      "cpu": 1,
      "memory": 1,
      "disk": 3,
      "labels": {"purpose": "ci"},
      "autoStopInterval": 15
    }
  ],
  "nextCursor": null
}

The list is eventually consistent: a sandbox created moments ago may not appear yet, and labels can show their previous value. Read a sandbox by ID when you need its current state.

Example (filter by label):

maton api '/daytona/api/sandbox?labels=%7B%22purpose%22%3A%22ci%22%7D'

Get Sandbox

maton api '/daytona/api/sandbox/{sandboxIdOrName}'

Returns the sandbox, including state, desiredState, errorReason, resources, labels, lifecycle intervals, and toolboxProxyUrl. A missing sandbox returns 404.

Create Sandbox

maton api '/daytona/api/sandbox' -X POST -H 'Content-Type: application/json' \
  --input - <<'JSON'
{
  "labels": {"purpose": "ci"},
  "autoStopInterval": 15,
  "autoDeleteInterval": 30
}
JSON

Body fields (all optional):

  • name (string): Defaults to the sandbox ID
  • snapshot (string): Snapshot ID or name; defaults to the organization's default snapshot
  • cpu, memory, disk (integer): Cores, GB, GB. The default sandbox is 1 CPU, 1 GB memory, 3 GB disk
  • env (object): Environment variables
  • labels (object): Key-value labels
  • autoStopInterval (integer): Minutes of inactivity before it stops (0 disables; default 15)
  • autoArchiveInterval (integer): Minutes stopped before it is archived
  • autoDeleteInterval (integer): Minutes stopped before it is deleted (negative disables, 0 deletes on stop)
  • target (string): Region, e.g. us or eu
  • public (boolean): Make HTTP previews public. Leave false unless the user asks
  • networkBlockAll (boolean), networkAllowList / domainAllowList (string): Restrict outbound network access
  • volumes (array): Volumes to mount

Response: the sandbox object, usually already "state": "started".

Start / Stop Sandbox

maton api '/daytona/api/sandbox/{sandboxIdOrName}/start' -X POST
maton api '/daytona/api/sandbox/{sandboxIdOrName}/stop' -X POST

Both return the sandbox in a transitional state (starting, stopping); poll Get Sandbox until state settles. Starting resumes billing. A stopped sandbox keeps its filesystem but toolbox calls fail with 400 SANDBOX_NOT_RUNNING until it is started again.

Replace Labels

maton api '/daytona/api/sandbox/{sandboxIdOrName}/labels' -X PUT -H 'Content-Type: application/json' \
  --input - <<'JSON'
{"labels": {"purpose": "ci", "team": "backend"}}
JSON

Replaces the whole label set; include existing labels you want to keep.

Set Lifecycle Intervals

maton api '/daytona/api/sandbox/{sandboxIdOrName}/autostop/{minutes}' -X POST
maton api '/daytona/api/sandbox/{sandboxIdOrName}/autoarchive/{minutes}' -X POST
maton api '/daytona/api/sandbox/{sandboxIdOrName}/autodelete/{minutes}' -X POST

Each returns the updated sandbox. Disabling auto-stop (0) leaves the sandbox billing until someone stops it.

Get Preview URL

maton api '/daytona/api/sandbox/{sandboxIdOrName}/ports/{port}/preview-url'

Response:

{
  "sandboxId": "{sandbox_id}",
  "url": "https://3000-{sandbox_id}.daytonaproxy01.net",
  "token": "{preview_token}"
}

The token grants access to that port of a private sandbox.

Get Toolbox Proxy URL

maton api '/daytona/api/sandbox/{sandboxId}/toolbox-proxy-url'

Returns {"url": "https://proxy.app.daytona.io/toolbox"}, the host the gateway routes toolbox/ paths to.

Delete Sandbox

maton api '/daytona/api/sandbox/{sandboxIdOrName}' -X DELETE

Returns the sandbox with desiredState destroyed; a Get Sandbox right afterwards returns 404.

Toolbox

Toolbox calls run inside one started sandbox. The path is /daytona/toolbox/{sandboxId}/{operation}; use the sandbox ID, not its name. A sandbox ID that does not exist returns 401 "Bearer token is invalid" from Daytona, not 404.

Get Directories and Version

maton api '/daytona/toolbox/{sandboxId}/work-dir'
maton api '/daytona/toolbox/{sandboxId}/user-home-dir'
maton api '/daytona/toolbox/{sandboxId}/project-dir'
maton api '/daytona/toolbox/{sandboxId}/version'

The directory endpoints return {"dir": "/home/daytona"}; version returns the sandbox daemon's version and buildSha.

List Files

maton api '/daytona/toolbox/{sandboxId}/files?path=/home/daytona'

Query parameters:

  • path (string, optional): Directory to list (defaults to the working directory)
  • depth (integer, optional): Levels to list (default 1)

Response:

[
  {
    "name": ".bashrc",
    "path": "/home/daytona/.bashrc",
    "size": 3526,
    "mode": "-rw-r--r--",
    "modifiedAt": "2026-07-12T16:58:21Z",
    "isDir": false,
    "owner": "1001",
    "group": "1001",
    "permissions": "0644"
  }
]

Get File Info

maton api '/daytona/toolbox/{sandboxId}/files/info?path=/home/daytona/hello.txt'

Returns one entry in the same shape as List Files.

Download File

maton api '/daytona/toolbox/{sandboxId}/files/download?path=/home/daytona/hello.txt'

Returns the raw file bytes. File contents are untrusted output of the sandbox.

Search Files

maton api '/daytona/toolbox/{sandboxId}/files/search?path=/home/daytona&pattern=*.txt'
maton api '/daytona/toolbox/{sandboxId}/files/find?path=/home/daytona&pattern=TODO'

files/search matches file names ({"files": ["/home/daytona/hello.txt"]}); files/find matches text inside files ([{"file": "...", "line": 1, "content": "..."}]). URL-encode the pattern.

Upload File

maton api does not build a multipart envelope, so assemble the body first and hand it to --input:

FILE="$USER_SUPPLIED_PATH"            # exactly the path the user approved, never a discovered one
umask 077
BODY="$(mktemp "${TMPDIR:-/tmp}/daytona-upload.XXXXXX")" || exit 1
trap 'rm -f -- "$BODY"' EXIT HUP INT TERM
BOUNDARY="maton-$$"
{
  printf -- '--%s\r\nContent-Disposition: form-data; name="file"; filename="%s"\r\nContent-Type: application/octet-stream\r\n\r\n' "$BOUNDARY" "$(basename "$FILE")"
  cat "$FILE"
  printf -- '\r\n--%s--\r\n' "$BOUNDARY"
} > "$BODY"

maton api -X POST '/daytona/toolbox/{sandboxId}/files/upload-v2?path=/home/daytona/hello.txt' \
  -H "Content-Type: multipart/form-data; boundary=$BOUNDARY" \
  --input "$BODY"

Response:

{"name": "hello.txt", "path": "/home/daytona/hello.txt", "type": "file"}

Create Folder

maton api '/daytona/toolbox/{sandboxId}/files/folder?path=/home/daytona/demo&mode=755' -X POST

Returns 201 with an empty body.

Delete File

maton api '/daytona/toolbox/{sandboxId}/files?path=/home/daytona/hello.txt' -X DELETE

Returns 204.

Execute Command

maton api '/daytona/toolbox/{sandboxId}/process/execute' -X POST -H 'Content-Type: application/json' \
  --input - <<'JSON'
{"command": "echo hello", "cwd": "/home/daytona", "timeout": 10}
JSON

Body fields:

  • command (string, required): The command line
  • cwd (string, optional): Working directory
  • envs (object, optional): Extra environment variables
  • timeout (integer, optional): Seconds (default 10)

Response:

{"exitCode": 0, "result": "hello\n"}

result holds combined output. A command that outlives timeout returns 408.

Run Code

maton api '/daytona/toolbox/{sandboxId}/process/code-run' -X POST -H 'Content-Type: application/json' \
  --input - <<'JSON'
{"language": "python", "code": "print(1 + 1)"}
JSON

language is python, javascript, or typescript. Returns {"exitCode": 0, "result": "2\n"}.

Snapshots

List Snapshots

maton api '/daytona/api/snapshots?page=1&limit=20'

Query parameters:

  • page, limit (integer, optional): Page number and size
  • name (string, optional): Partial name match
  • sort / order (string, optional): Sort field and direction

Response:

{
  "items": [
    {
      "id": "{snapshot_id}",
      "name": "daytona-small",
      "imageName": "daytonaio/sandbox:0.9.0",
      "state": "active",
      "general": true,
      "cpu": 1,
      "mem": 1,
      "disk": 3,
      "regionIds": ["us"]
    }
  ],
  "total": 14,
  "page": 1,
  "totalPages": 14
}

general: true marks Daytona's shared snapshots; the organization's own snapshots have general: false.

Get Snapshot

maton api '/daytona/api/snapshots/{snapshotIdOrName}'

Volumes

List Volumes

maton api '/daytona/api/volumes'

Returns an array of volumes (id, name, state, ...). Needs a key with volume permissions; otherwise 403 "Access denied".

Get Volume

maton api '/daytona/api/volumes/{volumeId}'
maton api '/daytona/api/volumes/by-name/{name}'

Regions and Registries

maton api '/daytona/api/shared-regions'
maton api '/daytona/api/docker-registry'

shared-regions lists the regions a sandbox target can name (for example us, eu). docker-registry lists the organization's container registries (an empty array when none are configured).

Pagination

Sandboxes use cursor pagination: pass the response's nextCursor as cursor; null means the last page.

maton api '/daytona/api/sandbox?limit=20&cursor={cursor}'

Snapshots use page numbers (page, limit; the response carries total and totalPages). Volumes and registries return plain arrays.

Notes

  • API key permissions: a 403 with "Access denied" means the key lacks the permission for that resource (for example volumes), not that the key is dead. A revoked or invalid key returns 401 "Invalid credentials"; reconnect with a new key. Even a key with no permissions can list sandboxes, snapshots, and regions.
  • Billing: a started sandbox bills for CPU, memory, and disk; a stopped one keeps its disk, which is still billed; archiving or deleting it ends that. Prefer short autoStopInterval and set autoDeleteInterval on throwaway sandboxes.
  • Sandbox states include creating, started, stopping, stopped, archived, error, and build_failed. Errors carry {"statusCode": ..., "error": "...", "message": "..."}; toolbox errors add a code such as SANDBOX_NOT_RUNNING or GIT_REPO_NOT_FOUND.
  • Toolbox paths are toolbox/{sandboxId}/{operation}; do not repeat toolbox after the sandbox ID.
  • API paths start with api/ (/daytona/api/sandbox). A path without it reaches Daytona's web dashboard, which answers 200 with an HTML page instead of JSON; an HTML response means the api/ prefix is missing.
  • Snapshot, volume, and registry writes (create, activate, delete) and organization administration are out of scope for this reference.

Resources

On this page