Skip to main content
An API key (ibk_...) is the credential that code, CI jobs, and agents use to call InstaBox when nobody is there to sign in. The HTTP API, the SDK, the CLI, and SSH all accept a key. People sign in with GitHub, Google or email instead, both to use the dashboard and to make keys.

Send a key

Over HTTP, send the key as X-API-Key: <key> or Authorization: Bearer <key>. The CLI and the SDK read the key from INSTABOX_API_KEY, so set that variable once.
With the key set, the CLI needs no instabox login, which suits a CI job or a script. The CLI and the SDK read the server from INSTABOX_API_URL, which defaults to https://api.instabox.sh.

Make a key

You can make a key from the dashboard or the CLI, or you can let an agent ask for one and approve its request. You see the key’s secret only once, so copy it when it is shown.
Choose API keys in the sidebar, then Create Key (dashboard.instabox.sh/api-keys). Full access suits the SDK, and Restricted picks scopes. The key belongs to the workspace selected in the sidebar.
Only a sign-in makes and revokes keys, so a key never makes another key, whatever its scopes are.

Make a key for a workspace

A key reaches only the workspace it belongs to, so a team’s machines need a key of the team’s workspace. To make a key of a workspace other than your personal one, name the workspace with --org. You need to be the owner or an admin of that workspace.

List your keys

List your keys to see which ones exist before you make or revoke one. The list shows your keys and never their secrets.

Revoke a key

Revoke a key when you no longer need it, so that nobody can call InstaBox with it again. Revoking a key also ends its SSH certificates.

Pick a key’s scopes

A scope limits what a key can do, so you can give a job only the access it needs, such as a key that reads machines and changes nothing. Pass --scope when you make the key, or choose Restricted in the dashboard.
Write and delete include read. Without --scope, instabox keys create gives a personal key machines:read, machines:write, machines:delete, and images:read, and a workspace key workspace:admin.
Give images:read to keys that create machines. The SDK and CLI use it to look snapshot names up.
A key with machines:write can select Org Secrets for a machine and run code there, and that code can send the selected Secrets to their allowed hosts. For a new machine that should get credentials from neither store, pass "vault": false, "secrets": [] on create.

Which workspace a key reaches

Every key belongs to exactly one workspace and reaches nothing outside it. Where you make the key decides which workspace that is.
  • A key made with instabox keys create (no --org), with POST /v1/keys, or on API keys with your personal workspace selected belongs to your personal workspace. One made with --org W, with POST /v1/orgs/{id}/keys, or with W selected belongs to W.
  • Machines a key creates go in its workspace. Other workspaces’ machines, snapshots, and settings are 404 to it, and so is a create naming another workspace’s orgId.
  • To work in another workspace, use a key of that workspace, which its owner or an admin makes. Only a sign-in reaches every workspace you belong to (instabox create --org W).

Find a key’s workspace

When you are not sure which workspace a key belongs to, list workspaces with that key. Because a key reaches one workspace only, the list holds that one workspace.
For a workspace key, GET /v1/me also has orgId.

Key errors

A bad key gets a 401 whose error.code says why: missing_key, malformed_key, invalid_key, expired_key, or revoked_key. A key without the scope that a route needs gets 403 missing_scope, and requiredScopes in the response names the scopes that the route accepts. The full list of error codes is on Errors.

What a key cannot do

Some routes take a sign-in (instabox login or the dashboard) and refuse any API key with 403 permission_denied (“API keys cannot be used on this route”). They cover managing API keys, your Vault, GitHub CI installations and jobs, creating and deleting workspaces, billing, and sessions. A workspace’s Org Secrets take a workspace:admin key instead. To set up CI, install the GitHub App from the dashboard (CI).
  • API keys: GET /v1/keys, POST /v1/keys, DELETE /v1/keys/{id}, GET /v1/orgs/{id}/keys, POST /v1/orgs/{id}/keys, DELETE /v1/orgs/{id}/keys/{keyId}
  • Vault: GET /v1/vault, PUT /v1/vault/{name}, PATCH /v1/vault/{name}, DELETE /v1/vault/{name}, POST /v1/vault/import, POST /v1/vault/{name}/export
  • GitHub CI: GET /v1/orgs/{id}/github/installations, DELETE /v1/orgs/{id}/github/installations/{installationId}, GET /v1/orgs/{id}/github/jobs, GET /v1/orgs/{id}/github/jobs/{job}, GET /v1/orgs/{id}/github/stats
  • Workspaces and billing: POST /v1/orgs, DELETE /v1/orgs/{id}, PATCH /v1/orgs/{id}/billing, POST /v1/orgs/{id}/billing/checkout, POST /v1/orgs/{id}/billing/portal, POST /v1/orgs/{id}/billing/plan, GET /v1/orgs/{id}/billing/change-preview, POST /v1/orgs/{id}/billing/credits/subscribe, GET /v1/orgs/{id}/billing/topup, POST /v1/orgs/{id}/billing/topup, DELETE /v1/orgs/{id}/billing/subscription, POST /v1/orgs/{id}/billing/subscription/resume, POST /v1/orgs/{id}/billing/move-personal, POST /v1/orgs/move-personal
  • Sessions: GET /v1/sessions, DELETE /v1/sessions/{id}
The API reference lists every route a key can call.

SDK quick start

Use the key from TypeScript or HTTP.

Agent sign-up

An agent gets its own key, approved by you.