How do you call the Orgo API from an agent's computer without an API key on disk?
A program on a Linux Orgo computer can ask 169.254.169.254 for a one-hour token that reaches only that computer. How to get it, refresh it, what it can call, and which computers get one.
Quick answer: ask the computer for a token. On a Linux Orgo computer that serves identity tokens, a program sends GET http://169.254.169.254/orgo/v1/identity/token with the header Metadata-Flavor: Orgo and gets back a one-hour Orgo token. It works as a Bearer token on the Orgo API, reaches only that computer, and is never written to the computer's disk (Identity tokens).
An identity token is a short-lived credential a computer hands to the programs running on it, so they can call Orgo about that computer without anyone copying a key there. Orgo's tokens start with orgo_vm_.
TL;DR
- Get one: a plain
GETto169.254.169.254overhttpon port 80, withMetadata-Flavor: Orgo, and no proxy in the way. - Lifetime: one hour. Ask again whenever you need a token: you get the same one while at least 40 minutes are left, and a new one after that.
- Reach: the token acts as the computer's own key, held to its own computer. It can take screenshots, click, type, run bash and Python, and open the terminal and screen streams. It cannot read the VNC password, manage keys or reach billing.
- Where it works: Linux computers in a workspace only their owner uses, with no one-computer key bound to them. Not every computer serves tokens yet. Where one doesn't, use
ORGO_API_KEY.
Why use a token instead of a key on the computer?
An agent loop, a script or a scheduled job running on the computer often needs to call Orgo about that same computer: take a screenshot, run a command, resume it. There are three ways to give it a credential.
| Identity token | Computer key (ORGO_API_KEY) | A key you make | |
|---|---|---|---|
| Where it lives | Asked for from 169.254.169.254 when needed, never written to disk | A file on the computer, /root/.orgo-secrets.env or /root/.env, readable by root | Wherever you put it |
| Lifetime | One hour | Never expires; its secret rotates on use once it is 30 days old | 1 day to a year, or no expiry |
| Reach | Its own computer, a fixed list of calls | Its own computer, a fixed list of calls | The scope you set: all workspaces, one workspace or one computer |
| Managed by | Orgo | Orgo | You |
| Computers | Linux, owner-only workspace, where tokens are served | Linux | Any; one-computer keys are Linux only |
Sources: Identity tokens, Key scopes and computer keys, Expiry and rotation.
The token stands in for the computer key, with nothing to read off the disk, nothing to rotate and nothing to re-read after a rotation. For scoping keys you make, see How do you give an AI agent an API key that can't touch everything?
How do you get a token?
Run this on the computer:
curl -s -H 'Metadata-Flavor: Orgo' http://169.254.169.254/orgo/v1/identity/tokenThe answer is JSON with:
| Field | What it is |
|---|---|
token | The token, starting orgo_vm_. Send it as Authorization: Bearer. Treat it as a secret: never print or log it |
token_type | Always Bearer |
expires_in, expires_at | Seconds left, and the expiry time in UTC |
desktop_id | The computer's UUID, the id the REST endpoints take |
vm_id | The computer's current instance_id. It changes when the computer wakes onto a new host, so address the API with desktop_id |
user_id | The account that owns the computer's workspace. The token acts as that account, held to this computer |
project_id | The computer's workspace UUID |
Four rules for the request: the Metadata-Flavor: Orgo header is required, only GET works, it goes over plain http on port 80, and it must not go through a proxy. If your environment sets http_proxy or HTTP_PROXY, add 169.254.169.254 to no_proxy and NO_PROXY.
GET http://169.254.169.254/orgo/v1/identity with the same header answers only desktop_id, vm_id and "state": "bound". It never returns a token, and a 200 there does not mean tokens are on. The token request is the test.
How do you use it with the Orgo API?
Ask for a token, then call the API with it. After a 401, ask once more with ?fresh=1:
import requests
METADATA = "http://169.254.169.254/orgo/v1/identity/token"
def identity(fresh=False):
response = requests.get(
METADATA,
params={"fresh": "1"} if fresh else None,
headers={"Metadata-Flavor": "Orgo"},
timeout=10,
)
response.raise_for_status()
return response.json()
def call_orgo(method, path, **kwargs):
ident = identity()
url = f"https://www.orgo.ai/api{path.format(id=ident['desktop_id'])}"
response = requests.request(method, url, headers={"Authorization": f"Bearer {ident['token']}"}, **kwargs)
if response.status_code == 401:
ident = identity(fresh=True)
response = requests.request(method, url, headers={"Authorization": f"Bearer {ident['token']}"}, **kwargs)
return response
print(call_orgo("GET", "/computers/{id}").json())The Identity tokens guide has the same pattern in bash and Node.
How often should you refresh the token?
You don't need to store a token. Ask the address before each batch of calls. The computer hands back the same token while at least 40 minutes of its hour are left and gets a new one after that, so asking often is cheap.
The address allows 20 requests a second per computer, with bursts of 40. Past that it answers 429 with Retry-After: 1.
What should you do after a 401?
The Orgo API checks on every request that the computer still stands as the token says. After a copy of the computer, a move, a transfer, or someone else joining its workspace, a token can go stale and answer 401. Ask once with ?fresh=1, the only query parameter the address accepts. If the new token also answers 401, or the address now answers 403 or 404, the computer can no longer have a token. Stop retrying and use ORGO_API_KEY.
What can the token call?
The token reaches its own computer only. The calls it can make include:
| Calls | What they do |
|---|---|
GET /api/computers/{id} | The computer's status, hardware and connection details, with vnc_password returned as null |
bash, exec | Run a shell command or Python code and get the output |
screenshot, click, drag, mouse-move, scroll, type, key, wait | Drive the screen |
screens | List, add or get the computer's screens |
resume | Resume a suspended computer |
/api/desktops/{id}/proxy/... | Pass requests through to the computer's Desktop API |
| WebSockets: terminal, VNC, WebRTC, audio, stats | Open a terminal, stream the screen and sound |
Anything else answers 403 with code: "computer_key", including GET /api/computers/{id}/vnc-password. A call about another computer answers 403 with code: "computer_scope_mismatch". The token never manages keys and never reaches your billing.
An open WebSocket is checked again every 15 seconds. It can stay open past the token's hour, and closes within about 25 seconds once the computer no longer stands as the token says.
Which computers get a token?
A computer gets a token when all of these hold:
- It is a Linux computer. Windows, Mac and iPhone computers get none, and some older Linux computers are not served.
- Only its owner can use its workspace: no other member, no open invite or share link, and no workspace key, Invoicing client or MCP sign-in for it.
- No one-computer key is bound to it.
- Its owner is a registered account that has not asked to be deleted.
Not every computer serves tokens. On one that doesn't, the address answers 404 with "error": "not_enabled", or the connection fails. A program in a web page on the computer can't get a token, and neither can a container on the computer, such as one run with Docker.
This fits the pattern of giving every customer of your vertical agent its own computer: each computer's agent can call Orgo about its own machine, and no customer's computer carries a long-lived key.
Which errors can you get?
From 169.254.169.254, every error body is { "error": "...", "message": "..." }:
| Status | error | What to do |
|---|---|---|
400 | metadata_header_required | Send Metadata-Flavor: Orgo exactly |
400 | bad_request | Send a plain GET with no body, no other query and no proxy-style request line |
403 | browser_request | Call from a program, not a web page, with no proxy |
403 | not_eligible | Use ORGO_API_KEY. reason is computer_deleted, not_linux, owner_guest, owner_deleting or workspace_shared |
404 | not_enabled | Tokens are not on for this computer or its host. Use ORGO_API_KEY |
429 | rate_limited | Wait for Retry-After |
503 | retry | The computer is starting, just woke or moved. Wait for Retry-After (2 to 60 seconds) |
From the Orgo API, a refused token answers 401 with invalid_token (ask for a new token), identity_stale (ask with ?fresh=1), or not_eligible or vm_identity_off (use ORGO_API_KEY).
Is it safe to let any program on the computer get a token?
Any program on the computer can ask for a token, whatever user it runs as. Treat every program there as able to act as the computer. What the token limits is reach and lifetime: one computer, a fixed list of calls, one hour, nothing on disk. Don't print or log it.
FAQ
How long does an identity token last?
One hour. expires_in and expires_at in the answer say exactly when it ends.
Is the token saved on the computer?
No. A token is never written to the computer's disk. Ask the address whenever you need one.
Does it work on Windows or Mac computers?
No. Only Linux computers get identity tokens. Use ORGO_API_KEY on Windows and Mac.
Can a Docker container on the computer get a token?
No. Neither can a program in a web page on the computer.
Can the token read the computer's VNC password?
No. GET /api/computers/{id}/vnc-password answers 403 with code: "computer_key", and GET /api/computers/{id} returns "vnc_password": null.
What if the address answers 404 not_enabled?
Tokens are not on for that computer or its host. Use ORGO_API_KEY there.
Related
- How do you give an AI agent an API key that can't touch everything?
- How do you give every customer of your vertical agent its own computer?
- Orgo computer use API: run an AI agent with one request
- How do you SSH into an AI agent's cloud computer?
- How to embed a live AI agent computer in your app
- Orgo templates and triggers: reproducible cloud computers for AI agents