demi knows three ways to sign in. All three end in the same principle: whoever signs in acts with exactly one person's permissions, never more.
- People in the terminal
- Browser sign-in through the OAuth device flow:
demi auth login - Scripts and CI
- A personal API key as a bearer token
- AI clients
- OAuth 2.1 through the MCP server; every person signs in themselves
Create an API key
An API key always belongs to one person and acts with their permissions. You create it in the app or in the CLI.
Settings › API keys › New key Name: CI export Permissions: read, write or run agents Expiry: never, 30, 90 or 365 daysdemi me pats create "CI export" --expires-at 2027-03-01T00:00:00ZUse a key
Send the key as a bearer token in the Authorization header:
curl https://api.godemi.com/v1/me/profile \ -H "Authorization: Bearer <your-api-key>"Keys start with demi_pat_. That lets secret scanners spot one if it ever lands in a repository.
In the CLI
printf '%s' "$DEMI_API_KEY" | demi auth login --api-key-stdinWith --api-key-stdin the key lands neither in your shell history nor in the process list. The CLI can also read it from the DEMI_API_KEY environment variable.
Pick a tenant
A key acts in the tenant it was created in. If you are a member of several tenants, pick another one per request with the x-demi-tenant-id header:
curl https://api.godemi.com/v1/tenants/current \ -H "Authorization: Bearer <your-api-key>" \ -H "x-demi-tenant-id: <workspace-id>"In the CLI you pick the tenant with demi config set-tenant @your-workspace, or per call with --tenant @your-workspace.
Expiry and revocation
- The API rejects expired or revoked keys with
401. - When a person's account is deactivated, their keys stop working too.
- You can revoke any key at any time in the app under Settings › API keys.
Sign-in for AI clients
AI clients need no key. They sign in to the MCP server through OAuth 2.1: the client opens the demi sign-in in your browser, you sign in and pick your tenant. The token stays in the client, not in a config file. More: MCP server.
Recommendations
- One key per script. Then you can revoke one without disturbing the others.
- The shortest expiry that fits. 90 days is a good value for most scripts.
- Only the permissions it needs. An export needs no write access.
- Never in code, never in a prompt. Keys belong in a secret manager or your CI's secrets.
