Foundational Compute

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

  1. Sign in at compute.fdtn.dev and open API keys.
  2. Click create. Enter a name (1 to 64 characters) and an expiry: Never, In 30 days or In 90 days.
  3. Optional: select Use as my default key. The Home page then shows it in code examples, only to you.
  4. Copy the key. The page shows it once.
Formatfdtn_ and 40 letters or digits (45 characters)
ScopeOne workspace, full access
Our storageA hash only. A default key is kept encrypted, readable only by its creator.
MembersOwners 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:

OrderPlaceUse it for
1api_key= (Python), apiKey (TypeScript)Your own secret store (SDKs only)
2FDTN_API_KEYServers, CI and containers
3~/.fdtn/keyYour 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()
  • The HTTP API reads the key from the X-API-Key header (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.dev or your FDTN_DOMAIN.
  • Never put a key in a web page. Call the SDK from your server.

Rotate a key

  1. On API keys, open the key's menu and click Rotate.
  2. Copy the new secret. The name and expiry stay the same.
  3. Update every place that uses the key: fdtn auth --replace on 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_KEY or ~/.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 doctor shows only its source and length.

Next