Skip to main content
The file manager lives on client.apps.files. Every method takes the app id first, then a path inside the app. Paths are at most 256 characters. Examples use the client from Creating the client. app_id is the id of one of your apps: client.account.me() lists them.

Listing a directory

files.list(app_id, path=None) lists a directory (the app root when path is omitted). Unlike other optional modifiers, path can be passed by position.
A directory that does not exist is 404 FILE_NOT_FOUND. A path the file manager does not expose is 403 BLOCKED_PATH.

Reading a file

files.read(app_id, path) returns the file’s content as bytes. Files are limited to 10 MB: a larger one is 413 FILE_TOO_LARGE.

Writing a file

files.write(app_id, path, content) creates or overwrites a file.
  • A str is sent as plain text.
  • bytes are sent as base64, so any binary content round-trips.
  • Empty content ('' or b'') creates an empty file.
Content over 10 MB fails locally with FILE_TOO_LARGE (status 0) before anything is sent. Content over 1 MiB is sent without a timeout once connected, like an upload. For larger files, use apps.commit().
Writing does not restart the app. Call apps.restart() to apply the change.

Moving or renaming a file

Deleting a file

Errors

See Errors for the codes every call can return.

Next steps

Environment variables

Read and change the variables of an app.

File manager API reference

The REST endpoints behind these methods.

Manage files from the CLI

The same actions from the terminal.