Listing files
Uploading files
Upload a file using multipart form data:/files/upload/initiate, /part, /complete, /abort).
Downloading files
Reading and writing file content
For text files, you can read and write content directly without downloading:Read file content
"encoding": "base64". Very large files must be downloaded instead. protection is non-null when the file is locked, and revision is what you pass back on a conditional write.
Update file content
Writing without clobbering someone else
A plain write overwrites whatever is there. When an agent, a collaborator, or another job might be editing the same file, write conditionally instead:File management
Create a folder
Move or rename
Delete files
Versions
When versioning is on for the workspace, every write keeps the previous copy.Referring to a file that might move
Paths change; ids do not. Ask for a file’s stable id once and store that instead, then resolve it back to a path when you need to read the file.argfile_… and survive renames and moves. Documents that embed other files use them for exactly this reason - see list references and what points at a file.
The optional kind is file by default. Send {"path":"/sites/portfolio","kind":"folder"} when the referenced node is a folder.
Locking a file
Lock a file to stop writes while something else owns it - a long import, a review window. The lock is enforced on every write path, agents included./files/unlock, and list active locks with /files/protections.