Files
Every route of the files API, with its parameters, answers and errors.
All routes are below /v1/workspaces/{id}, and take the path of an entry in the query parameter path. The guide Working with files shows them in use.
| Route | |
|---|---|
GET /files?path= | One entry, whatever its kind |
PUT /files?path= | Make a directory |
DELETE /files?path= | Remove an entry |
GET /files/children?path= | List a directory |
GET /files/content?path=, HEAD | Download a file |
PUT /files/content?path= | Upload a file |
POST /files/move | Move or rename |
Paths
Relative to the workspace's root, which a command sees as /workspace. The root is the empty path. Split on /; a leading or trailing / is ignored. Refused with invalid_path: an empty segment, ., .., a NUL, a name over 255 bytes, a path over 1,024 bytes. Encode the path as one query value.
Boolean parameters are true or false. Anything else is refused.
An entry
{
"path": "docs/a.md",
"name": "a.md",
"kind": "file",
"id": "281474976710662",
"size": 1204,
"mode": "0644",
"modifiedAt": "2026-11-21T20:23:10.842Z",
"changedAt": "2026-11-21T20:23:10.842Z",
"contentType": "text/markdown"
}| Field | |
|---|---|
path, name | Where it is, and its last segment |
kind | file, directory, symlink or other |
id | Stays the same through renames, moves and uploads. A string, because it may not fit a JSON number |
size | In bytes. Not there for a directory |
mode | Permissions, in octal |
modifiedAt | When the content last changed. Programs can set it |
changedAt | When the content or the entry last changed |
contentType | Guessed from the name, for files |
target, targetKind | For a symlink: what it points to, and whether that is a file, a directory or missing |
Every call that changes something answers with the entry as it now is.
Get an entry
GET /files?path=. 200 with the entry. A symlink at the end of the path is described, not followed. 404 not_found if there's nothing.
Make a directory
PUT /files?path= with the body {"kind":"directory"}.
| Parameter | |
|---|---|
parents | true makes missing parent directories |
201 when made, 200 with the existing entry when the directory was already there.
| Error | When |
|---|---|
409 already_exists | Something that isn't a directory is at the path |
404 parent_not_found | A parent is missing, and parents isn't true |
412 precondition_failed | If-None-Match: * was sent and the directory exists |
Delete an entry
DELETE /files?path=. 204.
| Parameter | |
|---|---|
recursive | true removes a directory with everything in it, all at once |
| Error | When |
|---|---|
404 not_found | Nothing is at the path |
409 directory_not_empty | A directory with entries, without recursive |
400 invalid_request | The path is the root |
List a directory
GET /files/children?path=. 200:
{ "directory": { "...": "the directory's entry" }, "entries": [ { "...": "an entry" } ], "nextCursor": null }| Parameter | |
|---|---|
recursive | true lists everything below, in path order |
limit | Entries per page, 1 to 5,000. Default 1,000 |
cursor | The nextCursor of the page before |
- Entries are sorted by name, byte by byte.
- Only a
nextCursorofnullmeans the end. A cursor never expires. - An entry that exists from the first page to the last appears exactly once. One that is made, moved or removed meanwhile may or may not.
- Symlinks are listed, never followed.
| Error | When |
|---|---|
404 not_found | No directory at the path |
409 not_a_directory | The path is a file |
Download a file
GET /files/content?path=, or HEAD for the headers alone. Follows symlinks.
200 with the bytes, or 206 for a Range. One range is honoured; a request for several gets the whole file.
| Header | |
|---|---|
Content-Length, Last-Modified, Accept-Ranges: bytes | As usual |
Content-Type | From the file's extension, from a fixed list, else application/octet-stream. Never HTML or SVG |
Content-Disposition: attachment | With the file's name |
A download is the file as it was when the request began. If the file changes while it's sent, the connection is cut.
| Error | When |
|---|---|
404 not_found | No file at the path |
409 is_a_directory | The path is a directory |
416 invalid_range | The range is outside the file |
Upload a file
PUT /files/content?path= with the bytes as the body, of any Content-Type.
| Parameter | |
|---|---|
parents | true makes missing parent directories |
mode | Permissions of a new file, in octal, such as 0600. Default 0644. A replaced file keeps its own |
| Header | |
|---|---|
If-None-Match: * | Only if nothing is at the path. Otherwise 412 precondition_failed |
201 for a new file, 200 for a replaced one, with the entry. The file changes in one step when the last byte has arrived. A symlink at the path is followed: the file it points to is replaced.
| Error | When |
|---|---|
404 parent_not_found | A parent is missing, and parents isn't true |
409 is_a_directory | A directory is at the path |
412 precondition_failed | If-None-Match: *, and something is there |
413 too_large | Over 1 GiB |
400 precondition_not_supported | If-Match, or any If-None-Match but * |
Move or rename
POST /files/move:
{ "from": "docs/a.md", "to": "archive/a.md", "overwrite": false }| Field | |
|---|---|
from, to | Paths, as path is written. to is the new path itself, never a directory to move into |
overwrite | true replaces what is at to: a file replaces a file, a directory an empty directory. Default false |
200 with the entry at its new path. A directory moves in one step, whatever it holds.
| Error | When |
|---|---|
404 not_found | Nothing at from |
404 parent_not_found | The directory to would be in doesn't exist |
409 already_exists | Something is at to, and overwrite isn't true |
409 directory_not_empty | overwrite onto a directory that has entries |
409 invalid_move | A directory into itself, or the root |
409 not_a_directory, is_a_directory | The kinds at from and to don't fit |
Errors on every route
| Error | When |
|---|---|
404 not_found | No such workspace in your organization |
409 symlink_loop | More than 40 symlinks on the way |
503 busy | Another client holds what's needed and didn't hand it over in time. Try again |
503 store_unavailable | The workspace's storage isn't configured or can't be reached |