API keys
The CLI, the SDKs and the HTTP API use an API key. A key can do everything in its workspace, so keep it private. To let a sandbox use your Anthropic key without holding it, see Secrets.
1Create a key
- Sign in at compute.fdtn.dev and open API keys.
- Click create. Enter a name (1 to 64 characters) and an expiry: Never, In 30 days or In 90 days.
- Optional: select Use as my default key. The Home page then shows it in code examples, only to you.
- Copy the key. The page shows it once.
| Format | fdtn_ and 40 letters or digits (45 characters) |
|---|---|
| Scope | One workspace, full access |
| Our storage | A hash only. A default key is kept encrypted, readable only by its creator. |
| Members | Owners and admins can always create keys. A workspace can stop members from creating keys, or set a longest expiry for them. |
2Store the key
The CLI and the SDKs use the first key they find:
| Order | Place | Use it for |
|---|---|---|
| 1 | api_key= (Python), apiKey (TypeScript) | Your own secret store (SDKs only) |
| 2 | FDTN_API_KEY | Servers, CI and containers |
| 3 | ~/.fdtn/key | Your own computer |
On your computer
$ fdtn auth # paste the key; it does not show or go into shell history $ fdtn auth --replace # save a new key, also when a working key is saved $ fdtn auth < key.txt # read the key from a file or pipe; no check with the service
fdtn auth checks the key and saves it in ~/.fdtn/key (mode 600). The CLI and the SDKs refuse a key file that other users can read or own; the error shows the fix.
On a server or in CI
Put the key in your secret store and expose it as FDTN_API_KEY. It wins over the saved file. CI setup: Run CI.
$ export FDTN_API_KEY=fdtn_...In code
Python · TypeScript · curl
key.py
import os from fdtn import Sandbox # Reads FDTN_API_KEY or ~/.fdtn/key by itself: sbx = Sandbox.create("base") sbx.kill() # Or pass a key from your own secret store: sbx = Sandbox.create("base", api_key=os.environ["MY_FDTN_KEY"]) sbx.kill()
import { Sandbox } from '@fdtn/sdk' // Reads FDTN_API_KEY or ~/.fdtn/key by itself: let sbx = await Sandbox.create('base') await sbx.kill() // Or pass a key from your own secret store: sbx = await Sandbox.create('base', { apiKey: process.env.MY_FDTN_KEY }) await sbx.kill()
$ curl -s https://api.sbx.fdtn.dev/v2/sandboxes \
-H "X-API-Key: $FDTN_API_KEY"- The HTTP API reads the key from the
X-API-Keyheader (HTTP API). - The SDKs never put the key in a URL, a log line or an error. A key they found by themselves goes only to
sbx.fdtn.devor yourFDTN_DOMAIN. - Never put a key in a web page. Call the SDK from your server.
Rotate a key
- On API keys, open the key's menu and click Rotate.
- Copy the new secret. The name and expiry stay the same.
- Update every place that uses the key:
fdtn auth --replaceon each computer, and each secret store.
The old secret stops at once. Calls that use it fail until you update them.
Revoke or delete a key
- Revoke stops the key at once; the next request gets
401. Running sandboxes keep running. - Delete works only on a revoked or expired key. It removes the key from the list. The activity log keeps its events.
- Owners and admins see all key changes on the Key history tab.
Keep keys safe
- Never paste a key into a chat, issue, email or agent prompt. Give agents the key through
FDTN_API_KEYor~/.fdtn/key. - Never commit a key.
- Use one key per computer or system, so you can revoke one place only.
- Give CI keys an expiry.
- Never send a key to support.
fdtn doctorshows only its source and length.