Skip to content

An API key lets ons, the E2B SDKs and your own code call the onshore.sh API for one organization. It looks like msb_<id>_<secret>. Only the prefix msb_<id> is ever shown again after creation.

Terminal window
ons login

ons login opens a page in your browser and prints a code (XXXX-XXXX). Sign in, type the code, and ons saves a new key named msb login · <host>. <host> is your machine’s name.

  • The key is saved with its domain in ~/.config/onshore/config.toml, readable only by you.
  • If you belong to several organizations, pick one with ons login --org <organization-id>.
  • When the browser runs on another machine, add --paste and paste the address the browser ends on.
  • A new ons login from the same machine revokes the key of the previous one, unless that key still owns live miniVMs or AI accounts. ons tells you which keys it kept.
Where How
ons ons login saves it. In CI, set ONS_API_KEY instead; it wins over the saved login.
E2B SDKs Set E2B_API_KEY=<your-key> and E2B_DOMAIN=onshore.sh. ons ignores these two variables.
REST API Send the header X-API-Key: <your-key> to https://api.onshore.sh.

<your-key> is the full key, msb_….

To pass a key to ons login from a script, pipe it on stdin:

Terminal window
printf '%s\n' "$ONS_API_KEY" | ons login --key
  • A key sees and acts on the miniVMs it created. Another key of the same organization does not see them through the API.
  • In the console, every member sees all the organization’s miniVMs (shape and who started them, never their environment, metadata or tokens). Members pause, resume and kill the miniVMs of their own keys; owners act on any. See Organizations.
  • A key calls the miniVM and template API. It cannot create keys, manage members or change billing: that is done in the console.

Open API keys in the console and revoke the key. Members revoke the keys they created; owners revoke any key.

  • Revocation takes effect within 5 seconds and is final.
  • The miniVMs the key created keep running, but nothing can act on them through that key anymore. Kill them from Fleet in the console, or let them reach their timeout. A miniVM of a revoked key cannot be resumed.
  1. Create a new key.
  2. Deploy it where the old one was used.
  3. Kill or let end the miniVMs the old key created: the new key cannot reach them.
  4. Revoke the old key.

If a key leaked, revoke it at once, then rotate.

  • An organization holds at most 100 active keys.
  • An organization creates at most 200 keys per 24 hours, revoked ones included.
  • Repeated calls with a wrong key are rate-limited per client address.