Skip to main content
This guide walks through the full lifecycle of an API key: creating one, verifying it, choosing the right scopes, using it with an organization, rotating it safely, and revoking it when done. For the full specification of every scope and role ceiling, see the Scopes & Permissions reference.

When to use this

  • You want to use Runtime programmatically - from your terminal, scripts, coding agents, or CI/CD pipelines
  • You need to understand the difference between personal and organization keys
  • You want to establish a key rotation policy for your team

Prerequisites

  • A Runtime account
  • Access to the Settings > API Keys page in the dashboard

Create a key

Keys are created from the dashboard only - there is no programmatic key-creation endpoint. This prevents a compromised key from bootstrapping new credentials.
1

Choose a context

Decide whether the key should act as you personally or as a member of an organization.
  • Personal key - operates on your own sessions and secrets. Cannot touch org resources.
  • Organization key - operates on resources owned by the organization. You must have the org selected in the org switcher when you create the key.
2

Pick scopes

The dashboard offers scope presets for common use cases:You can also pick individual scopes. See Scopes & Permissions for the full list.
3

Set an expiration

Optionally set an expiration between 1 and 365 days. Keys without an expiration live until revoked.
For production automation, set a 90-day expiration and rotate before it lapses. For one-off scripts, shorter is better.
4

Copy the secret

The raw token is shown once. Copy it immediately and store it in a secret manager (1Password, Doppler, GitHub Actions secrets, etc.).
Runtime stores only a one-way hash. If you lose the secret, revoke the key and create a new one.

Verify the key

Confirm the key is valid and inspect its scopes before doing real work:
A healthy response looks like:
If the key is expired or revoked, you get 401:

Use an organization key

Organization keys have the org encoded on the key itself. You do not need to pass the org on every request. However, if you do send the X-Organization-Id header, it must match the key’s org or the request fails with 403.

Scope hygiene

Apply the principle of least privilege:
  • Give CI keys only sessions:read, sessions:write, and sessions:prompt - not sessions:delete or sessions:terminal
  • Monitoring dashboards need only sessions:read and activity:read
  • Only org admins or owners should use templates:write, guardrails:write, or integrations:write
  • Never share a single key across multiple services - create one key per consumer

Rotate a key

Runtime does not have a built-in “rotate” button. Instead, follow this sequence:
1

Create a new key

Create a new key with the same scopes and context. You now have two active keys.
2

Deploy the new key

Update your CI secrets, environment variables, or secret manager to use the new key.
3

Verify the new key is working

Confirm the new key produces successful requests in your logs.
4

Revoke the old key

In the dashboard, revoke the old key. Revocation is immediate - any in-flight requests using the old key fail with 401.
A user may have at most 3 active keys per context (personal + each org). Key creation is rate-limited to 5 keys per hour per user across all contexts.

Revoke a key

Navigate to Settings > API Keys in the dashboard and click Revoke next to the key. Revocation is immediate and permanent - the key ID is retained for audit but the key can never be used again. Revoke immediately when:
  • A key is committed to a public repository
  • A key is posted in a chat or document
  • A teammate with key access leaves the organization
  • A key is no longer needed

Next steps

Scopes & Permissions

Full scope catalog, role ceilings, and legacy expansion table.

Manage sessions at scale

Use your key to create, poll, and manage sessions programmatically.

Best practices

Key hygiene, lifecycle patterns, prompt design, and cost controls.

Authentication reference

Full API reference for Bearer auth and the X-Organization-Id header.