Command line

tfile works with your files from a shell: for scripts, backups and AI agents. It signs in with an API token and does what the token and your account allow.

On this page
  1. Install
  2. Sign in
  3. Naming files and folders
  4. Commands
  5. Changing things safely
  6. Output and exit codes
  7. Profiles
  8. Single-user mode

Install

Each release has one program for each system. Download the one for yours:

SystemFile
Linux (x86-64)tfile-<version>-linux-amd64
Linux (ARM64)tfile-<version>-linux-arm64
macOS (Apple silicon)tfile-<version>-macos-arm64
macOS (Intel)tfile-<version>-macos-amd64
Windows (x86-64)tfile-<version>-windows-amd64.exe

On Linux, check the download, make it runnable and put it where your shell finds it. On macOS use shasum -a 256 -c --ignore-missing SHA256SUMS for the check.

sha256sum -c --ignore-missing SHA256SUMS
chmod +x tfile-1.5.0-linux-amd64
sudo mv tfile-1.5.0-linux-amd64 /usr/local/bin/tfile
tfile --version

On Windows, rename the file to tfile.exe and put it in a folder listed in PATH.

Every program is built by GitHub Actions and its origin can be verified:

gh attestation verify tfile-1.5.0-linux-amd64 -R ThirtyFile/ThirtyFile
The programs aren't signed for macOS or Windows. macOS blocks the first start: run xattr -d com.apple.quarantine tfile after checking the download. Windows SmartScreen may warn: choose More info › Run anyway.

Sign in

Run tfile auth login. It opens your browser at an address with a code; sign in there as usual (password, two-factor, passkey or single sign-on), check that the page shows the same code, choose what tfile may do, in which folder and for how long, and approve. tfile then receives its API token. --no-browser only prints the address, to open on another device. The code works once and for ten minutes.

tfile auth login --server https://drive.example.com
tfile auth whoami

Or make an API token in the web interface under API tokens in the account menu and paste it: tfile auth login --with-token, or pipe it in. It isn't shown as you paste, and it is never given as an argument.

For scripts and servers, give the address and the token in the environment instead; nothing is saved then:

export THIRTYFILE_URL=https://drive.example.com
export THIRTYFILE_TOKEN=tft_…

Naming files and folders

tfile files list "/My files/Reports"
tfile files list Reports
tfile files list . --space "Team"
tfile files get id:4f2c…
In Git Bash on Windows, an argument that starts with / is rewritten by the shell. Use relative paths or ids, or set MSYS_NO_PATHCONV=1.

Commands

Commands read like tfile files move. Find one by what you want to do, and see what it takes:

tfile cli search "move files into a folder"
tfile schema files move
tfile files move --help

Common tasks:

tfile files list Reports
tfile files search invoice --ext pdf
tfile files download Reports/q3.pdf --output q3.pdf
tfile files upload q3.pdf summary.md Reports
tfile files upload ./photos Reports
tfile files folders create "Reports/2026"
tfile files move Reports/q3.pdf Archive
tfile files rename id:4f2c… "q3 final.pdf"
tfile files archive create Reports Archive
tfile files versions list Reports/q3.pdf
tfile files trash Reports/old.txt --force
tfile trash list
tfile trash restore id:4f2c…
tfile files text get Reports/q3.docx

Tab completion

tfile complete prints a completion script for bash, zsh, fish, PowerShell or elvish, with the commands of the server you signed in to. Load it from your shell's start-up file, and make it again after the server is updated.

# bash (~/.bashrc)
source <(tfile complete bash)
# zsh (~/.zshrc)
source <(tfile complete zsh)
# fish
tfile complete fish > ~/.config/fish/completions/tfile.fish
# PowerShell ($PROFILE)
tfile complete powershell | Out-String | Invoke-Expression

Changing things safely

tfile files move Reports/q3.pdf Archive --dry-run
tfile files upload q3.pdf Reports --on-conflict keep
tfile files content update Reports/notes.txt notes.txt --if-version 1790000000

An administrator's token with View administration (admin.read) reads it: tfile users list, tfile settings get, tfile logs sign-ins list, tfile usage get, tfile storage list, tfile backups list and the other commands tfile cli search finds. Such a token lasts at most 90 days, can't be limited to a folder, and stops working once the account is no longer an administrator; secrets such as passwords and keys are never in the answers. Listing what a backup or a storage location holds (tfile backups snapshots browse, tfile storage objects list) waits for your approval, as the following do. Sharing (tfile shares, access, buckets, ftp-folders), deleting for good and emptying the trash, with a token that has that access, wait for your approval in the browser: tfile prints the address and waits until you approve or refuse, then prints the result. --no-wait prints the approval at once; tfile approvals wait <id> follows it later. --force doesn't skip an approval.

With Administer (admin.users, admin.spaces, admin.storage and admin.settings) an administrator's token changes the Control panel too. What can be undone runs at once: tfile spaces create, tfile branding update, tfile storage test, tfile moves pause. The rest waits for your approval as sharing does, and the approval page names the accounts, spaces or storage locations it is about: tfile users create, tfile users update, tfile groups update, tfile settings update, tfile storage update, tfile backups policies create. What only a person does in the web interface, such as the email settings, single sign-on or adding a storage location, isn't a command: tfile cli search and tfile schema find it and say browser only and why, and typing it fails with browser_only. A field only a person sends, such as an account's password or role, is refused with browser_only_field; tfile schema lists them under browser_only_fields.

tfile users create amy --display-name "Amy Chen"
tfile cli search "change the email server"

Output and exit codes

Results are JSON on standard output; messages and errors go to standard error. A list is {"items": […], "next": …}, 50 items a page. A search comes a page at a time too.

tfile files list Reports --limit 20
tfile files list Reports --limit 20 --cursor "…"
tfile files list Reports --all

An error is {"error": {"code": …, "message": …}}, and the exit code says what kind it is:

Exit codeMeaning
0Success
1Another failure, or you said no
2Wrong command or argument
3Not signed in, or the token no longer works
4Not found, or not visible to your account
5Not permitted
6A name is taken, or something changed meanwhile
7Try again later
9Partly done
10Needs --force

The error's code says more than the exit code, and stays the same between releases. The common ones:

CodeExit codeMeaning
name_taken6An item with that name is already there
version_conflict6The file changed since the version given with --if-version
not_empty6The folder isn't empty
busy7The item is still being changed
space_moving7The space is being moved to another storage location
storage_unavailable7The disk or storage service doesn't answer
read_only5The space is read-only
token_permission5The API token lacks the permission
token_folder5The token is limited to a folder: outside it, or the folder itself
token_folder_gone3The token's folder is gone, or the account can no longer open it
token_not_admin3The token is for administration, and its account is no longer an administrator
browser_only5Only a person does this, in the web interface
browser_only_field5A field only a person sends, in the web interface (a password, a role, a credential)
approval_refused5Refused in the browser: nothing changed
approval_expired7Nobody approved it within ten minutes
approval_failed1Approved, but it didn't run (something it names changed meanwhile)
too_many_approvals7Five approvals of this token are waiting already
too_many_items2More items than one request takes
content_search_off6Search inside files is off

Profiles

A profile keeps a server and a token. Use several for several servers or tokens, and tie one to a folder:

tfile auth create work --server https://drive.example.com
tfile auth activate work ~/projects/reports
tfile auth list
tfile files list --profile work

Single-user mode

In single-user mode there are no tokens:

tfile auth login --server http://localhost:8080 --no-token
Without a token nothing is limited: every program on that computer can do what the page itself can, deleting for good included. With THIRTYFILE_KEEP_HISTORY=false there is no trash: tfile files trash deletes for good.