Skip to main content

API keys

An API key lets a script, a CI job or another system use your workspace with no person signed in. Each key is confined to one workspace and to the scopes you give it, and every key expires.

  • 5 minutes
  • Workspace admins

Only a workspace admin, signed in as a person, can create or revoke keys. A key can never create another key.

Create a key​

In the console​

  1. Open Settings and choose the API keys tab. Each key is a row: its status, its name, the start of the key, what it may do, who created it, when it was last used and when it expires.
  2. Click Create key.
  3. Under Name, say what will use the key, such as CI deploy (up to 64 characters).
  4. Under Scope, tick at least one of Read, Run, Data, Build or Admin. Scopes explains each.
  5. Optional: open Limit to and pick the flows or tables the key may reach.
  6. Under Expires, choose 30 days, 90 days or 365 days. The default is 90 days.
  7. Click Create key.
  8. Copy the key with Copy the key and store it where the job will read it, such as your CI's secret store. Then click Done.
Settings with the API keys tab selected. The subtitle reads: Keys let scripts, the CLI and other systems start your flows and read their runs, without a person signing in. A switch labeled Allow API keys is on, next to a Create key button. A table lists six keys, each with a status icon, a name, the start of the key, scope icons, who created it, the creation date and the last use. The last key, Old laptop, has a struck-through status icon.Settings with the API keys tab selected. The subtitle reads: Keys let scripts, the CLI and other systems start your flows and read their runs, without a person signing in. A switch labeled Allow API keys is on, next to a Create key button. A table lists six keys, each with a status icon, a name, the start of the key, scope icons, who created it, the creation date and the last use. The last key, Old laptop, has a struck-through status icon.
Settings, then API keys. The icons next to a key's name are its scopes, and a filter icon marks a key limited to some flows or tables.
The Create an API key dialog. A Name field with the placeholder CI deploy. Five scope cards: Read, Run (ticked), Data, Build and Admin, each with a one-line description. A collapsed Limit to section. An Expires list set to 90 days. Cancel and Create key buttons.The Create an API key dialog. A Name field with the placeholder CI deploy. Five scope cards: Read, Run (ticked), Data, Build and Admin, each with a one-line description. A collapsed Limit to section. An Expires list set to 90 days. Cancel and Create key buttons.
Pick the smallest set of scopes the job needs. Run is ticked by default.
The Your new API key dialog. A warning reads: Copy this key now. You won't be able to see it again. The full key is shown in a field with a copy button, and below it two example commands that use it with curl and with lumen run.The Your new API key dialog. A warning reads: Copy this key now. You won't be able to see it again. The full key is shown in a field with a copy button, and below it two example commands that use it with curl and with lumen run.
The only time the key is shown. Lumen keeps a hash of it and cannot show it again.
Shown once

Lumen stores only a SHA-256 hash of the key. If you lose it, revoke it and create a new one.

A workspace can have at most 10 active keys at a time.

Through the API​

An admin signed in as a person can also create keys over HTTP. expiresInDays is required and is 30, 90 or 365.

curl -X POST "$LUMEN_API/apis/runtime.lumen.ai/v1alpha1/namespaces/tenant-acme/apikeys" \
-H "Authorization: Bearer $PERSON_TOKEN" -H "Content-Type: application/json" \
-d '{"name": "GitHub Actions deploy", "scopes": ["run"], "flows": ["invoices"], "expiresInDays": 90}'

The answer holds the key once, in key. GET .../apikeys lists the workspace's keys without their secrets.

Scopes​

A key has one or more scopes, and each request uses the broadest one that allows it.

ScopeWhat the key may doLimit it to
ReadRead flows, steps, tables, connections (never their secrets), forms, models and other configuration. Read runs, their steps and files. Read table rows.Flows, tables
RunStart a flow's manual run and read the runs this key started. Nothing else.Flows
DataRead, add, change and delete table rows, and read files.Tables
BuildCreate, change and delete flows, steps, tables, connections (never their credentials) and similar configuration. For CI, Terraform and the CLI.Never limited
AdminEverything the other four do, plus rerunning and cancelling runs, testing steps and connections, agent memory and similar.Never limited

A key that only starts runs should have Run and nothing else. A job that applies flows from a repository needs Build.

No key, whatever its scopes, can reach: API keys, members and roles, single sign-on, plans, budgets and credits, a connection's credentials, secrets, approvals (a person's decision), the audit log, or anything outside its own workspace. Those answer 403. A key is never a person, so it never signs in as one.

Limit a key​

By default a key reaches the whole workspace. Limit to narrows it:

  • Flows limits what Run and Read reach, to the flows you name.
  • Tables limits what Data and Read reach, to the tables you name.

You can name up to 50 of each, and they must exist when you create the key. Build and Admin are never limited, and the console tells you so. A key limited to some flows cannot start, list or read any other flow or its runs, and a run key reads only the runs it started.

Use a key​

Send the key as a bearer token. There is no separate setting for keys anywhere.

export LUMEN_TOKEN=lmn_eu_...
lumen run invoices -f march.pdf --wait
lumen apply -f flows/

The CLI also reads --token. It asks the server which workspace the key belongs to, so you do not pass -w. See Install the CLI.

In the audit log a key's actions show as a machine, apikey: followed by the key's id, and a run a key started records which key did it.

Rotate a key​

Keys expire, so plan to replace them. Rotation has no downtime if you do it in this order:

  1. Create a new key with the same scopes and limits.
  2. Put it where the old one was, and deploy.
  3. Check that the old key's Last used stops moving.
  4. Revoke the old key.

Revoke a key​

  1. In Settings, API keys, find the key and click its revoke icon (Revoke the key, with the name).
  2. Type the key's name to confirm, then click Revoke.

Scripts that use the key stop working. Revoking takes effect at once on the server that handled it and within 15 seconds everywhere, and it cannot be undone. A key you revoked shows as Revoked; one past its date shows as Expired.

Keys follow their creator: when the admin who made a key is removed from the workspace, or is no longer an admin, the keys they made are revoked at once.

If a key leaks, revoke it first and ask questions after.

Turn API keys off​

The switch Allow API keys at the top of the tab is on by default. Turn it off, for example in a workspace that requires single sign-on, and no key of the workspace works and none can be created. The keys are kept and work again when you turn the switch back on. Allow up to 15 seconds for the change to reach every server. The change is recorded in the audit log.

What a key looks like​

lmn_<region>_<id>_<secret>

A key starts with lmn_, then the region it works in (for example eu), a public 12-character id that names the key in the list and in the audit log, and the secret with a checksum. The checksum lets a scanner or Lumen reject a typo without a lookup.

To find leaked keys in a repository, scan for this pattern, for example as a gitleaks rule with the keyword lmn_:

\blmn_[a-z0-9-]{2,20}_[0-9A-Za-z]{12}_[0-9A-Za-z]{49}\b

A key works only in its workspace's region. Sent to another region's API it is answered 421 Misdirected Request, with the right address.

Lumen refuses, with 401, a token that looks like it carries a key but is not exactly one: a key in quotes, after other text, or cut short.

Limits​

  • 10 active keys per workspace.
  • 30, 90 or 365 days of life, 365 at most.
  • After repeated failed attempts from one address in a minute, that address is answered 429 for the rest of the minute.

Next steps​