Manage API keys
Create a key for the sync CLI or an agent that can't sign in through a browser, see what each key can reach, and revoke the ones you no longer need.
An API key lets an agent, script or command-line tool act on your behalf. Keys are personal: a key can only reach workspaces you're a member of, and it stops working for a workspace the moment you leave it.
Create a key
- In the web app, open the account menu at the bottom of the sidebar and choose Agents & API keys.
- Under API keys, enter a Name. This is the label the activity feed shows next to everything the key does, so name it after the agent or machine:
claude-code,inbox-filer,build-server. - Choose Used by:
- Agent (MCP) for an agent. Its changes are marked as an agent's.
- Human (CLI) for your own scripts and tools. Its changes are marked as yours.
- Choose its Access and Reach. See limit what a key can do.
- Select Create key.
- Copy the key, and the ready-made command for Claude Code or the sync CLI if you need them.
- Select I've copied it. The full key is never shown again.
What a key can reach
Keys you create under API keys in the web app reach All your workspaces unless you choose otherwise: they work in every workspace you belong to, and agents using them choose a workspace per request. Choose This workspace to tie a key to the one that's open.
The desktop app and the sync CLI get a different kind of key when you approve them in the browser. Those are tied to the one workspace you chose, and are named Treehouse Desktop or treehouse-cli in your list.
Either way, a key can do what you can do in that workspace, and no more. It can't see other members' private files, and it can't create public links, invite people or manage keys, whatever it's used for.
Limit what a key can do
A key can have less access than you. Giving an agent only what it needs makes it safe to leave running.
| Setting | What it does |
|---|---|
| Access: Read only | The key can read and comment, but can't create, change, move, delete or restore anything. |
| Reach: a folder | The key can only reach that folder and what's inside it, in the workspace that's open. Everything else is out of reach, and it can't change the workspace's name or appearance. |
The limits show next to the key in your list. To change them, revoke the key and create a new one.
When you approve the desktop app or CLI in the browser, Limit what this device can do offers the same choices. A folder synced with a read-only key behaves like a Viewer's, and one limited to a folder only receives that folder.
Limits are checked on every request, on top of your own access. If you're made a Viewer, every key you hold becomes read-only at the same moment. A key can never do more than you can, and it can't remove its own limits.
Revoke a key
- Open Agents & API keys from the account menu.
- Under API keys, find the key by its name and the first few characters shown beside it.
- Select Revoke, then confirm.
Anything using the key stops working immediately. Revoking a Treehouse Desktop or treehouse-cli key stops that folder syncing; the desktop app shows Sign in needed for it.
Undo what a key changed
Next to a key, select Undo changes… to reverse everything it changed in the open workspace since a moment you choose. Changes anyone else made are kept. See undo what an agent did.
When someone leaves a workspace
When a member is removed, the keys tied to that workspace (their desktop app and CLI keys) are deleted straight away. Their account-wide keys keep working in their other workspaces but are refused in the one they left.
Keep keys safe
- Treat a key like a password. Anyone who has it can do whatever the key is allowed to.
- Don't paste keys into files inside a synced folder. Everything in the folder syncs to the workspace, where your teammates can read it.
- Prefer client settings that read the key from an environment variable or a secure prompt, like the VS Code and Codex examples.
- Revoke keys you no longer use. If you think a key has leaked, revoke it and create a new one.
Related
- Manage connected agents
See which agents have signed in to Treehouse as you, rename how their work is labelled, and disconnect the ones you no longer use.
- Connect Claude Code
Give Claude Code access to a workspace through your synced folder, the Treehouse MCP server, or both.
- Authentication
How OAuth sign-in for MCP clients and API keys work, what each credential can reach, the device flow the CLI uses, and how access is revoked.
- Security and privacy
How Treehouse encrypts your files, who can see what in a workspace, and how keys, share links and HTML pages are kept in check.
Last updated
