Origami

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=, HEADDownload a file
PUT /files/content?path=Upload a file
POST /files/moveMove 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

JSON
{
  "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, nameWhere it is, and its last segment
kindfile, directory, symlink or other
idStays the same through renames, moves and uploads. A string, because it may not fit a JSON number
sizeIn bytes. Not there for a directory
modePermissions, in octal
modifiedAtWhen the content last changed. Programs can set it
changedAtWhen the content or the entry last changed
contentTypeGuessed from the name, for files
target, targetKindFor 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
parentstrue makes missing parent directories

201 when made, 200 with the existing entry when the directory was already there.

ErrorWhen
409 already_existsSomething that isn't a directory is at the path
404 parent_not_foundA parent is missing, and parents isn't true
412 precondition_failedIf-None-Match: * was sent and the directory exists

Delete an entry

DELETE /files?path=. 204.

Parameter
recursivetrue removes a directory with everything in it, all at once
ErrorWhen
404 not_foundNothing is at the path
409 directory_not_emptyA directory with entries, without recursive
400 invalid_requestThe path is the root

List a directory

GET /files/children?path=. 200:

JSON
{ "directory": { "...": "the directory's entry" }, "entries": [ { "...": "an entry" } ], "nextCursor": null }
Parameter
recursivetrue lists everything below, in path order
limitEntries per page, 1 to 5,000. Default 1,000
cursorThe nextCursor of the page before
  • Entries are sorted by name, byte by byte.
  • Only a nextCursor of null means 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.
ErrorWhen
404 not_foundNo directory at the path
409 not_a_directoryThe 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: bytesAs usual
Content-TypeFrom the file's extension, from a fixed list, else application/octet-stream. Never HTML or SVG
Content-Disposition: attachmentWith 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.

ErrorWhen
404 not_foundNo file at the path
409 is_a_directoryThe path is a directory
416 invalid_rangeThe range is outside the file

Upload a file

PUT /files/content?path= with the bytes as the body, of any Content-Type.

Parameter
parentstrue makes missing parent directories
modePermissions 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.

ErrorWhen
404 parent_not_foundA parent is missing, and parents isn't true
409 is_a_directoryA directory is at the path
412 precondition_failedIf-None-Match: *, and something is there
413 too_largeOver 1 GiB
400 precondition_not_supportedIf-Match, or any If-None-Match but *

Move or rename

POST /files/move:

JSON
{ "from": "docs/a.md", "to": "archive/a.md", "overwrite": false }
Field
from, toPaths, as path is written. to is the new path itself, never a directory to move into
overwritetrue 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.

ErrorWhen
404 not_foundNothing at from
404 parent_not_foundThe directory to would be in doesn't exist
409 already_existsSomething is at to, and overwrite isn't true
409 directory_not_emptyoverwrite onto a directory that has entries
409 invalid_moveA directory into itself, or the root
409 not_a_directory, is_a_directoryThe kinds at from and to don't fit

Errors on every route

ErrorWhen
404 not_foundNo such workspace in your organization
409 symlink_loopMore than 40 symlinks on the way
503 busyAnother client holds what's needed and didn't hand it over in time. Try again
503 store_unavailableThe workspace's storage isn't configured or can't be reached