How do you give an AI agent an API key that can't touch everything?
Scope an Orgo API key to one workspace or one computer, give it only the permission groups your agent needs, set an expiry, and know how the key Orgo puts on a computer behaves.
Give the agent a key with a narrow scope, only the permissions it needs, and an expiry. Every Orgo API key has three settings: a scope (all workspaces, one workspace, or one computer), an access level (full access, read only, or custom levels across eleven permission groups), and an expiry (1 day to a year, or none). Orgo checks scope and permissions on every request before the endpoint runs. A call outside the key's permissions answers 403 with code: "key_permission", and the message names the group and level the key would need. A program running on an Orgo computer can instead use the computer's own key, which Orgo makes, rotates and revokes, and which reaches only that computer.
This matters because an agent acts on whatever its key allows. If the key can delete computers, invite people or buy credits, a confused or prompt-injected agent can too.
The three settings
| Setting | Choices | With POST /api/keys |
|---|---|---|
| Scope | All workspaces, one workspace, one computer | Neither field, workspace_id, or computer_id |
| Access | Full access, read only, custom | Leave permissions out or send "full", send "read_only", or send an object of group to level |
| Expiry | 7, 30 or 90 days, 1 year, a date up to a year away, or none | expires_in_days (1 to 365) or expires_at; neither for no expiry |
A key made in Settings, API keys defaults to 90 days. Its value is shown once.
Scope
| Scope | Reaches | Suited to | Cannot |
|---|---|---|---|
| All workspaces | Everything your account can reach | Your own scripts and admin tooling | Nothing is fenced off |
| One workspace | That workspace and its computers and files | An agent running a fleet inside one workspace | Call anything outside computers, workspaces, files, screenshots, chat completions, support and keys (so no secrets, templates, billing or account settings); create or name another workspace; manage members, share links, or delete its workspace (workspace_scope_mismatch); make one-computer keys (account_key_required) |
| One computer | One Linux computer | A contractor, an embed in your app, an agent that drives one computer | Delete, resize, clone, fork or move its computer; manage keys; reach workspaces, files, templates, secrets or billing |
A one-computer key can start, stop, restart, suspend and resume its computer, and drive its screen, shell and Desktop API. Asked about another computer, it answers 403 with code: "computer_scope_mismatch".
Making a workspace key revokes the computer keys on that workspace's computers (below). If a program on one of those computers reads ORGO_API_KEY, switch it to the new key first.
Permissions
A restricted key has a level in each of eleven groups: none, read or write (write includes read). A group left out of a custom key is none.
| Group | Covers |
|---|---|
computers | Create, start, stop, resize and delete computers |
control | Screenshots, commands, mouse and keyboard on a computer |
files | Files stored in Orgo |
templates | Templates and their builds |
workspaces | Workspaces, their names and settings |
members | People, invites and share links |
secrets | Secret names, and setting or using them |
ai | Models, chats and agents |
bops | What the Bops app keeps in Orgo |
billing | Plan, credits and invoices |
keys | Make, change and revoke keys, never past the key's own access |
Most computer use agents need two groups: computers to start and stop their machines, and control to click, type, run commands and take screenshots. An agent that calls POST /api/v1/chat/completions also needs ai at write. Leave members, billing and keys at none unless managing those is the agent's job.
- Read is not always harmless. Control read takes screenshots of a computer's screen and reads files on it.
- A workspace key cannot have
membersat write. Asking for it answers400withcode: "invalid_permissions", as does an unknown group or level. - Custom with write in every group is still a restricted key. It cannot make a full access key, and it cannot call the endpoints reserved for a signed-in person.
A workspace key for an agent that runs and drives computers in one workspace, expiring in 30 days:
curl -X POST https://www.orgo.ai/api/keys \
-H "Authorization: Bearer $ORGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Fleet agent",
"workspace_id": "'"$WORKSPACE_ID"'",
"permissions": { "computers": "write", "control": "write" },
"expires_in_days": 30
}'Send computer_id instead of workspace_id to bind the key to one Linux computer.
The computer's own key
Orgo can make a key for one Linux computer and write it onto that computer as ORGO_API_KEY, so an agent running there can call Orgo. It does so when a template's secrets declare orgo_api_key, when you own the workspace, nobody else can use it, and you create the computer signed in or with a full access key for the whole account that never expires.
| Computer key | |
|---|---|
| Managed by | Orgo. PATCH /api/keys/{id} answers 409 with code: "managed_key" |
| Expiry | None |
| Rotation | Its secret rotates on use once it is 30 days old; the old secret works 10 more minutes |
| Reach | Its own computer, and a fixed list of calls for computer work and the Bops runner. Anything else answers 403 with code: "computer_key"; another computer, computer_scope_mismatch |
| Copies | A clone, fork or restore as a new computer gets its own key; no key is live on two computers |
| Revocation | Deleted with its computer or workspace, and revoked when the workspace stops being yours alone |
The last row is the one that surprises people. Anyone who can use the computer is root there and could read the key, so Orgo revokes it when an invite is accepted (whatever its access), a share link is claimed, a workspace key is made, someone connects the workspace through an MCP sign-in, an Invoicing client key is made or rotated for it, an agent account that owns it is claimed, or the computer moves into a shared workspace. A sweep every 15 minutes catches keys that should no longer stay. Programs that relied on ORGO_API_KEY then stop reaching Orgo.
Because anything that controls a computer can read its key, a restricted or expiring key cannot control a computer that holds its own key. Its control and AI calls about that computer answer 403 with code: "computer_key_held". Start, stop and get still work. Use a full access key that never expires for that computer, or sign in.
Rotating your own keys
Orgo never rotates a key you made, because it cannot reach where you keep it. Replace one in three steps:
- Create a new key with the same permissions and scope.
- Update every agent and service that uses the old key.
- Revoke the old key with
DELETE /api/keys/{id}.
Both keys work until you revoke the old one. Orgo emails the account 7 days and 1 day before a key expires. Past its expiry the key answers 401 with code: "key_expired", and a WebSocket closes with code 4001. A key that expires can only make keys that expire no later than it does.
For the computer key, a program on the computer should read ORGO_API_KEY from /root/.orgo-secrets.env first, then /root/.env, and read it again after a 401 before retrying once. In a shell, sourcing /root/.env is enough: it sources /root/.orgo-secrets.env last, so it gives the newest value. Both files are readable by root only.
# Run as root on the computer. Set COMPUTER_ID to the computer's UUID.
call_orgo() {
. /root/.env
status=$(curl -s -o /tmp/orgo-out.json -w '%{http_code}' "$@" \
-H "Authorization: Bearer $ORGO_API_KEY")
if [ "$status" = "401" ]; then
. /root/.env # the key may have rotated: read it again
status=$(curl -s -o /tmp/orgo-out.json -w '%{http_code}' "$@" \
-H "Authorization: Bearer $ORGO_API_KEY")
fi
cat /tmp/orgo-out.json
}
call_orgo "https://www.orgo.ai/api/computers/$COMPUTER_ID"A 401 that persists after a fresh read means the key was revoked, not rotated. A 503 with code: "key_rotation_failed" means Orgo could not write the new secret, usually because the computer is not running; nothing changed, so retry after Retry-After seconds.
Revoking a one-computer key
When you revoke a one-computer key that could control its computer, Orgo changes the computer's VNC password and Desktop API token, and open screen viewers close. Until the change finishes, Get VNC password answers 503 with code: "vnc_rotation_pending", so fetch the password again rather than reusing a stored one. Settings, API keys, the computer's General tab, and GET /api/keys?computer_id={id} show which keys reach a computer.
Errors
| Status | code | Meaning |
|---|---|---|
| 403 | key_permission | The key lacks the group or level this endpoint needs |
| 403 | computer_key_held | A restricted or expiring key tried to control a computer that holds its own key |
| 403 | computer_scope | A one-computer key called an endpoint outside its list |
| 403 | computer_scope_mismatch | A key bound to one computer asked about another |
| 403 | computer_key | A computer key called an endpoint outside its fixed list |
| 403 | workspace_scope_mismatch | A workspace key went outside its workspace or its surfaces |
| 403 | account_key_required | A workspace key tried to manage a one-computer key |
| 403 | key_escalation | A key tried to make, change or revoke a key wider than itself |
| 400 | invalid_permissions | An unknown group or level, or members write on a workspace key |
| 409 | computer_key_in_use | A one-computer key was requested for a computer that holds its own key |
| 400 | computer_scope_fixed | Someone tried to change a one-computer key's computer; make a new key |
| 400 | computer_scope_unsupported | A one-computer key was requested for a computer that is not Linux |
| 409 | managed_key | Someone tried to change a computer key |
| 401 | key_expired | The key is past its expiry |
| 503 | key_rotation_failed | A computer key's rotation could not be written; retry shortly |
Related
- Embed an AI agent computer in your app
- The Orgo computer use API
- Orgo MCP for AI agents
- Can an AI agent sign up for its own cloud computer? (its signup key is full access for the whole account; narrow it with the steps above)