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.
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
- 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.
- Click Create key.
- Under Name, say what will use the key, such as
CI deploy(up to 64 characters). - Under Scope, tick at least one of Read, Run, Data, Build or Admin. Scopes explains each.
- Optional: open Limit to and pick the flows or tables the key may reach.
- Under Expires, choose 30 days, 90 days or 365 days. The default is 90 days.
- Click Create key.
- 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.
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.
| Scope | What the key may do | Limit it to |
|---|---|---|
| Read | Read flows, steps, tables, connections (never their secrets), forms, models and other configuration. Read runs, their steps and files. Read table rows. | Flows, tables |
| Run | Start a flow's manual run and read the runs this key started. Nothing else. | Flows |
| Data | Read, add, change and delete table rows, and read files. | Tables |
| Build | Create, change and delete flows, steps, tables, connections (never their credentials) and similar configuration. For CI, Terraform and the CLI. | Never limited |
| Admin | Everything 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.
- CLI
- HTTP
- Terraform
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.
curl "$LUMEN_API/apis/runtime.lumen.ai/v1alpha1/namespaces/tenant-acme/runs/$RUN" \
-H "Authorization: Bearer $LUMEN_TOKEN"
See the Runtime API for starting runs and downloading results.
provider "lumen" {
token = var.lumen_api_key
namespace = "tenant-acme"
}
See the Terraform provider.
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:
- Create a new key with the same scopes and limits.
- Put it where the old one was, and deploy.
- Check that the old key's Last used stops moving.
- Revoke the old key.
Revoke a key
- In Settings, API keys, find the key and click its revoke icon (Revoke the key, with the name).
- 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
429for the rest of the minute.


