Skip to main content

Workspaces and files

Workspaces and their shares, a task's files, uploads, memory notes, what a run changed, and a folder served as a site.

OperationMethod and path
List workspacesGET /api/v1/workspaces
Create a workspacePOST /api/v1/workspaces
Read a workspaceGET /api/v1/workspaces/{id}
Rename a workspacePATCH /api/v1/workspaces/{id}
Delete a workspace and its filesDELETE /api/v1/workspaces/{id}
List a workspace's sharesGET /api/v1/workspaces/{id}/shares
Share a workspace by emailPUT /api/v1/workspaces/{id}/shares
Share a workspacePUT /api/v1/workspaces/{id}/shares/{user_id}
Remove a shareDELETE /api/v1/workspaces/{id}/shares/{user_id}
List one directory of the task's workspaceGET /api/v1/conversations/{id}/files
Preview one fileGET /api/v1/conversations/{id}/files/content
Download one fileGET /api/v1/conversations/{id}/files/download
Show an HTML page, sandboxedGET /api/v1/conversations/{id}/files/view
Show one sheet of a spreadsheet as a tableGET /api/v1/conversations/{id}/files/sheet
Upload a file into the workspace's uploads/POST /api/v1/conversations/{id}/uploads
Write a memory note of the workspace (ADR-0041)PUT /api/v1/conversations/{id}/memory/{name}
Remove a memory note, keeping it for one UndoDELETE /api/v1/conversations/{id}/memory/{name}
Undo the last change to a memory notePOST /api/v1/conversations/{id}/memory/{name}/undo
Fork a workspace into a new one of your ownPOST /api/v1/workspaces/{id}/fork
Files a run changedGET /api/v1/conversations/{id}/runs/{run_id}/changes
One changed file as a unified diffGET /api/v1/conversations/{id}/runs/{run_id}/changes/diff
Mint a pass that serves a workspace folder as a sitePOST /api/v1/conversations/{id}/site
The root of a workspace folder served as a site, by its passGET /api/v1/conversations/{id}/site/{pass}/
A file of a workspace folder served as a site, by its passGET /api/v1/conversations/{id}/site/{pass}/{*path}

List workspaces​

GET /api/v1/workspaces

Your own and those shared with you, with your access. all=true (administrators only) lists every workspace's metadata without names, sources or content. limit (1-100) pages the list with an opaque next_cursor, stable while workspaces are added; without limit the whole list comes at once, as before. sort: recent (last used, else created; newest first), created (newest first, the default) or name (A to Z). filter: in_use (a task's sandbox holds its write lease), idle, or shared_with_me (someone else's, shared with you). A cursor belongs to its sort and filter; any other is 400 cursor_invalid. q searches the names the caller may read (their own and those shared with them), case-insensitively and as literal text, even with all=true; trimmed, at most 100 characters, else 400 value_too_long. A cursor belongs to its q as to its sort and filter.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
allqueryboolean
limitqueryinteger 1–100
cursorquerystring
sortquery"recent", "created", "name"
filterquery"all", "in_use", "idle", "shared_with_me"
qquerystringSearch text in the names you may read; empty is no search.

Responses

StatusMeaningBody
200Successful operationWorkspaces
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Create a workspace​

POST /api/v1/workspaces

An empty workspace. A task clones a repository into it with plain git and a key under Keys (ADR-0037 §7). git_url was removed in this release: a request that still sends it is 400 invalid_request with details [{field: git_url, reason: removed}], never ignored.

Sign-in: A signed-in session or an API token.

Request body

application/json: NewWorkspace

Responses

StatusMeaningBody
201Successful operationWorkspace
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
422unknown_reference: profile is not one the caller may useError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Read a workspace​

GET /api/v1/workspaces/{id}

The owner or a share holder; everyone else gets 403.

Sign-in: A signed-in session or an API token.

Responses

StatusMeaningBody
200Successful operationWorkspace
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Rename a workspace​

PATCH /api/v1/workspaces/{id}

Owner only.

Sign-in: A signed-in session or an API token.

Request body

application/json: UpdateWorkspace

Responses

StatusMeaningBody
200Successful operationWorkspace
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Delete a workspace and its files​

DELETE /api/v1/workspaces/{id}

Owner only. Refused with 409 workspace_in_use while a task's environment on it has a run going or is pinned (lease.running, lease.pinned), and while bound active tasks exist unless with_conversations=true and they all belong to the owner (then they are deleted with it); with 409 has_helpers while one of those tasks leads an agent team with helpers (delete that lead with its helpers first). A kept, idle environment is retired for the delete, as for a new task's handover, and the host directory goes once it has let go; with no environment, the directory goes at once; its tasks, recorded changes, snapshots and shares are purged within minutes, and forks stay with forked_from cleared. One content-free audit record is written per workspace and per task deleted with it.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
with_conversationsqueryboolean

Responses

StatusMeaningBody
204Successful operation
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409workspace_in_use; workspace_not_ready while it is being forked; has_helpers while a task deleted with it leads an agent team with helpersError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

List a workspace's shares​

GET /api/v1/workspaces/{id}/shares

Owner only.

Sign-in: A signed-in session or an API token.

Responses

StatusMeaningBody
200Successful operationWorkspaceShares
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Share a workspace by email​

PUT /api/v1/workspaces/{id}/shares

The owner shares with the one active account whose email matches exactly (case-insensitive). An unknown or inactive email is 404 user_not_found, the same answer either way; nothing lists or searches accounts. Attempts are limited to 10 a minute per caller (429 busy).

Sign-in: A signed-in session or an API token.

Request body

application/json: ShareByEmail

Responses

StatusMeaningBody
200Successful operationWorkspaceShare
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Share a workspace​

PUT /api/v1/workspaces/{id}/shares/{user_id}

Owner only. read: see the workspace, read its files, fork it. write: also bind your own tasks to it and run on it. Sharing a workspace never shares tasks or transcripts.

Sign-in: A signed-in session or an API token.

Request body

application/json: ShareWorkspace

Responses

StatusMeaningBody
200Successful operationWorkspaceShare
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Remove a share​

DELETE /api/v1/workspaces/{id}/shares/{user_id}

Owner only.

Sign-in: A signed-in session or an API token.

Responses

StatusMeaningBody
204Successful operation
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

List one directory of the task's workspace​

GET /api/v1/conversations/{id}/files

Directories first, then names; links listed but never followed; .tqa/ left out; names that are not UTF-8 are omitted. Authorization is workspace access: the owner or a share (read to list and read, write to upload); the administrator role grants no content. On a Firecracker installation the workspace is read through its runtime (ADR-0030): with no live sandbox on the workspace, the task owner's request starts theirs (429 busy while a slot is awaited) and anyone else gets 409 sandbox_not_ready; a runtime reply outside the request's bounds is 502 upstream_invalid. A link anywhere in the path is 400 path_invalid.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
pathquerystringA path relative to the workspace root: no leading /, no . or .. segment, at most 1024 bytes; never under .tqa/.
afterquerystringContinue after this entry name.
limitqueryinteger 1–5001-500, default 200.

Responses

StatusMeaningBody
200One page of entriesFilePage
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Preview one file​

GET /api/v1/conversations/{id}/files/content

Metadata and, for UTF-8 text, up to files.preview_bytes (default 512 KiB). If-None-Match with the ETag answers 304. Authorization is workspace access: the owner or a share (read to list and read, write to upload); the administrator role grants no content. On a Firecracker installation the workspace is read through its runtime (ADR-0030): with no live sandbox on the workspace, the task owner's request starts theirs (429 busy while a slot is awaited) and anyone else gets 409 sandbox_not_ready; a runtime reply outside the request's bounds is 502 upstream_invalid, and a file that changes while it is read in chunks is 409 file_changed (retryable). A link anywhere in the path is 400 path_invalid.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
pathqueryyesstringA path relative to the workspace root: no leading /, no . or .. segment, at most 1024 bytes; never under .tqa/.

Responses

StatusMeaningBody
200The file's metadata and text previewFileContent
304Not modified since the given ETag
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Download one file​

GET /api/v1/conversations/{id}/files/download

The bytes as application/octet-stream with Content-Disposition: attachment and X-Content-Type-Options: nosniff, never rendered by the browser; above files.download_bytes (default 100 MiB) 413 body_too_large. Authorization is workspace access: the owner or a share (read to list and read, write to upload); the administrator role grants no content. On a Firecracker installation the workspace is read through its runtime (ADR-0030): with no live sandbox on the workspace, the task owner's request starts theirs (429 busy while a slot is awaited) and anyone else gets 409 sandbox_not_ready; a runtime reply outside the request's bounds is 502 upstream_invalid, and a file that changes while it is read in chunks is 409 file_changed (retryable). A link anywhere in the path is 400 path_invalid.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
pathqueryyesstringA path relative to the workspace root: no leading /, no . or .. segment, at most 1024 bytes; never under .tqa/.

Responses

StatusMeaningBody
200The filestring (binary) (application/octet-stream)
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Show an HTML page, sandboxed​

GET /api/v1/conversations/{id}/files/view

An HTML page of the task's workspace (.html or .htm only), for the Files panel's frame: text/html with Content-Security-Policy sandbox allow-scripts; default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:; font-src data:; media-src data:; connect-src 'none'; form-action 'none'; frame-src 'none'; child-src 'none'; worker-src 'none'; base-uri 'none'; frame-ancestors 'self', so the page has an opaque origin (no cookies or API as the person), no network, no forms, popups or top-level navigation, and only this site's pages may frame it; also X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer, Cache-Control: no-store. Any other type is 415 preview_unsupported (download it instead); above files.preview_html_bytes (default 2 MiB) 413 body_too_large. Access, paths and the runtime-backed read are as for the download.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
pathqueryyesstringA path relative to the workspace root: no leading /, no . or .. segment, at most 1024 bytes; never under .tqa/.

Responses

StatusMeaningBody
200The page, sandboxedstring (text/html)
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
415No preview for this file type (preview_unsupported)Error
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Show one sheet of a spreadsheet as a table​

GET /api/v1/conversations/{id}/files/sheet

One sheet of a spreadsheet of the task's workspace (.xlsx, .xlsm, .xlsb or .ods; legacy .xls is not read) as display text, for the Files panel's table. Formulas show their cached values and are never evaluated; macros and external links are ignored; cells are plain text, never markup or links. At most 500 rows and 50 columns are returned, each cell at most 200 characters (a longer one ends in …). Any other type is 415 preview_unsupported; above files.preview_sheet_bytes (default 10 MiB) 413 body_too_large; a file whose parts inflate past 100 MiB, hold more than 10,000 entries, or take longer than 5 s to read 413 preview_too_large; a damaged file, or one that isn't really a spreadsheet, 422 preview_damaged; a password-protected one 422 preview_protected; a sheet the file doesn't have 404 not_found. Access, paths and the runtime-backed read are as for the download.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
pathqueryyesstringA path relative to the workspace root: no leading /, no . or .. segment, at most 1024 bytes; never under .tqa/.
sheetquerystringThe sheet's name; the first sheet when absent.

Responses

StatusMeaningBody
200The sheet's shown tableSheetPreview
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Over files.preview_sheet_bytes (body_too_large), or the file inflates past what a preview reads (preview_too_large)Error
415No preview for this file type (preview_unsupported)Error
422The spreadsheet is damaged (preview_damaged) or protected with a password (preview_protected)Error
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Upload a file into the workspace's uploads/​

POST /api/v1/conversations/{id}/uploads

The request body is the file. Stored as uploads/<sanitised name> ([A-Za-z0-9._-], no leading dot, at most 128 bytes; an existing name gets -2, -3, never overwritten). Refused before anything is stored: over files.upload_bytes (default 25 MiB) 413 upload_too_large, over files.uploads_bytes of uploads in the workspace (default 1 GiB) 409 uploads_full. Contents are not scanned; uploads are served only as downloads. Cookie requests need the exact Origin. Authorization is workspace access: the owner or a share (read to list and read, write to upload); the administrator role grants no content. On a Firecracker installation the upload streams through the workspace's runtime (ADR-0030) with the same names and limits (files.uploads_bytes is advisory there: usage is counted from the runtime's listing, and the workspace image's size is the real bound); the owner's sandbox is started if none is live, and a runtime reply outside its bounds is 502 upstream_invalid. A link anywhere in the path is 400 path_invalid.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
namequeryyesstringThe client's file name; sanitised as described.

Request body

application/octet-stream: string (binary)

Responses

StatusMeaningBody
201StoredUpload
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Write a memory note of the workspace (ADR-0041)​

PUT /api/v1/conversations/{id}/memory/{name}

The request body is the note's text (UTF-8, at most 64 KiB): .memory/<name> is written atomically and its previous version kept for one Undo. A text that holds what looks like a key or token is refused (400 invalid_request): notes are kept and shown to every later task. Authorization is workspace access with a write share, as for uploads; the administrator role grants no content. Cookie requests need the exact Origin. Directory workspaces only: a Firecracker installation answers 409 files_unavailable until its workspace link gains the operation. A link in the way (the memory folder, its undo folder or the note) is 400 path_invalid. Listing and reading notes use the files operations on .memory/. With memory off ([memory] enabled = false, the default) .memory/ is an ordinary folder and this is 409 memory_off (ADR-0041's third amendment, A11).

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
namepathyesstringThe note's file name: one component of [A-Za-z0-9._-], not hidden, ending .md, at most 128 bytes.

Request body

text/plain: string

Responses

StatusMeaningBody
201StoredUpload
204Done
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Remove a memory note, keeping it for one Undo​

DELETE /api/v1/conversations/{id}/memory/{name}

Removes .memory/<name>; its content is kept for one Undo. 404 when there is no such note. Authorization is workspace access with a write share, as for uploads; the administrator role grants no content. Cookie requests need the exact Origin. Directory workspaces only: a Firecracker installation answers 409 files_unavailable until its workspace link gains the operation. A link in the way (the memory folder, its undo folder or the note) is 400 path_invalid. Listing and reading notes use the files operations on .memory/. With memory off ([memory] enabled = false, the default) .memory/ is an ordinary folder and this is 409 memory_off (ADR-0041's third amendment, A11).

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
namepathyesstringThe note's file name: one component of [A-Za-z0-9._-], not hidden, ending .md, at most 128 bytes.

Responses

StatusMeaningBody
201StoredUpload
204Done
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Undo the last change to a memory note​

POST /api/v1/conversations/{id}/memory/{name}/undo

Undoes the last change to .memory/<name>, the agent's or a person's: its kept previous version comes back (outcome restored), or, a note that was new at that change is removed (outcome removed). Once: 404 when there is nothing to undo, so the same Undo sent again changes nothing. Authorization is workspace access with a write share, as for uploads; the administrator role grants no content. Cookie requests need the exact Origin. Directory workspaces only: a Firecracker installation answers 409 files_unavailable until its workspace link gains the operation. A link in the way (the memory folder, its undo folder or the note) is 400 path_invalid. Listing and reading notes use the files operations on .memory/. With memory off ([memory] enabled = false, the default) .memory/ is an ordinary folder and this is 409 memory_off (ADR-0041's third amendment, A11).

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
namepathyesstringThe note's file name: one component of [A-Za-z0-9._-], not hidden, ending .md, at most 128 bytes.

Responses

StatusMeaningBody
200What the Undo didobject
201StoredUpload
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Fork a workspace into a new one of your own​

POST /api/v1/workspaces/{id}/fork

Needs any access (owner or a read or write share). The copy runs in the background within the quota and does not wait for a running task; links are copied as links, never followed.

Sign-in: A signed-in session or an API token.

Request body

application/json: ForkWorkspace

Responses

StatusMeaningBody
202The fork is being copied (state forking)Workspace
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409workspace_not_ready (the source is still forking or failed)Error
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Files a run changed​

GET /api/v1/conversations/{id}/runs/{run_id}/changes

The files the run added, modified or deleted, compared between the workspace snapshot taken when its message was delivered and the next snapshot of the workspace, or the live workspace for the latest run (live: true). .tqa/, uploads/, .git/ and node_modules/ are left out. A run recorded before this feature, or without a snapshot, is 404 changes_unavailable; an unknown run is 404 not_found. Authorization is workspace access: the owner or a share (read or write); the administrator role grants no content. On a Firecracker installation the live side is read through the workspace's runtime (ADR-0030); a runtime reply outside its bounds is 502 upstream_invalid.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
run_idpathyesstring

Responses

StatusMeaningBody
200The run's changed filesRunChanges
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

One changed file as a unified diff​

GET /api/v1/conversations/{id}/runs/{run_id}/changes/diff

A unified diff (3 lines of context) of one changed file, from the text copies the snapshots kept; binary files and files over files.snapshot_text_bytes have no diff text. The text is cut at files.diff_bytes (truncated: true). A file the run did not change is 404. Authorization is workspace access: the owner or a share (read or write); the administrator role grants no content. On a Firecracker installation the live side is read through the workspace's runtime (ADR-0030); a runtime reply outside its bounds is 502 upstream_invalid.

Sign-in: A signed-in session or an API token.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
run_idpathyesstring
pathqueryyesstringA changed file of the run, relative to the workspace root.

Responses

StatusMeaningBody
200The file's diffFileDiff
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404Record not foundError
409Bootstrap closed, idempotency route conflict or deleted conversationError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

Mint a pass that serves a workspace folder as a site​

POST /api/v1/conversations/{id}/site

Owner or share only (the files routes' access). The folder is a path relative to the workspace root (the root itself as an empty string); any folder that exists (404 not_found otherwise): a page beside other files, such as an agent's report.html, is opened by its name under the pass, and index.html is only what the root and a route answer. The pass is a capability: 32 random bytes, unpadded base64url, kept in the gateway's memory for 900 seconds from its last use and forgotten at a restart; at most 8 live passes per task, the 9th is 409 site_passes_limit. The answer's url is the site's root under the pass: the Files panel frames it, and the frame's own requests (CSS, scripts, images, fonts, fetches of the site's own files) resolve under it without a cookie, which an opaque sandboxed frame cannot send. A leaked pass gives read-only reads of that one folder of that one task until it expires, and nothing else. The answer also says what the install's network setting lets the page reach (network: the any-host rule, and the exact and *.domain hosts), so the panel can name what a page loads that the browser will block.

Sign-in: No sign-in.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)

Request body

application/json: SitePassRequest

Responses

StatusMeaningBody
201The pass and the site's rootSitePass
400Invalid request or unsupported protocolError
401Authentication requiredError
403Origin, ownership or role deniedError
404not_found: the task, or no such folderError
409site_passes_limit: 8 live passes already serve this taskError
413Request body limit exceededError
429Rate or capacity limit reachedError
503Database unavailable or gateway restartingError
504I/O deadline exceededError

The root of a workspace folder served as a site, by its pass​

GET /api/v1/conversations/{id}/site/{pass}/

The folder's index.html, exactly as siteFile serves it for an empty path (the same pass, headers, Content-Security-Policy and limits); a folder without an index.html is 404 not_found at its root while its files still open by name. This is the address mintSitePass answers as url.

Sign-in: No sign-in.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
passpathyesstringThe pass mintSitePass answered (43 characters of unpadded base64url).

Responses

StatusMeaningBody
200The file's bytes with its extension's type
404not_found: an unknown or expired pass, a path that climbs, or no such file and no index.htmlError
413body_too_large: above the page or download limitError
429Rate or capacity limit reachedError
503Gateway restartingError
504I/O deadline exceededError

A file of a workspace folder served as a site, by its pass​

GET /api/v1/conversations/{id}/site/{pass}/{*path}

No cookie, no Origin: the pass in the path is the whole credential (see mintSitePass); an unknown or expired pass, a path that climbs or a file outside the folder is 404 not_found, with no distinction. The rest of the path (slashes included) is the file under the folder; empty, a directory, or a path with no file of that name answers the folder's index.html, so a built site's own routes work. Each file is served by its extension's type, never guessed (html/htm text/html, js/mjs text/javascript, css, json and map, svg, png/jpg/jpeg/gif/webp/ico, woff/woff2/ttf/otf, wasm, txt; anything else application/octet-stream) up to files.preview_html_bytes for a page and files.download_bytes otherwise (413 body_too_large above). Every answer carries X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer, Cache-Control: no-store and Cross-Origin-Resource-Policy: cross-origin and Access-Control-Allow-Origin: * (the page's origin is opaque, so its own styles, scripts and images are cross-origin loads to the browser, and a module script is a CORS fetch from origin null; the pass guards the files); a page also carries the site's Content-Security-Policy: sandbox allow-scripts (an opaque origin: no cookies or API as the person), base-uri 'none', form-action 'none', frame-src 'none', worker-src 'none', frame-ancestors 'self', and for script-src, style-src, img-src, font-src, media-src and connect-src the site's own root under this pass plus 'unsafe-inline' (scripts and styles) and data: and blob: (media), plus the install's network setting rendered as sources: the any-host rule as https:, an exact host as https://host (with its ports other than 443), a *.domain rule as https://*.domain; internet access turned off or an empty allow-list adds nothing, so the browser blocks every outside load before it leaves.

Sign-in: No sign-in.

Parameters

NameInRequiredTypeDescription
idpathyesstring (uuid)
passpathyesstringThe pass mintSitePass answered (43 characters of unpadded base64url).
*pathpathyesstringThe file under the folder, slashes included; the empty rest is index.html.

Responses

StatusMeaningBody
200The file's bytes with its extension's type
404not_found: an unknown or expired pass, a path that climbs, or no such file and no index.htmlError
413body_too_large: above the page or download limitError
429Rate or capacity limit reachedError
503Gateway restartingError
504I/O deadline exceededError