Aller au contenu

Connexion et clés d'API

Comment les personnes, les scripts et les clients IA se connectent à demi, et comment gérer les clés en toute sécurité.

DisponibleMise à jour : 9 novembre 2026

Le texte de cette page est en anglais (aussi disponible en allemand).

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.

Text
Settings › API keys › New key  Name:        CI export  Permissions: read, write or run agents  Expiry:      never, 30, 90 or 365 days

Use a key

Send the key as a bearer token in the Authorization header:

Terminal
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

Terminal
printf '%s' "$DEMI_API_KEY" | demi auth login --api-key-stdin

With --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:

Terminal
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.

Votre configurateur

Aucun cas d'usage pour l'instant

Votre configurateur est encore vide

Ajoutez un cas d'usage depuis n'importe quelle carte ou page de cas et voyez ce qu'il rapporte par an, calcul à l'appui. Gratuit, sans inscription, sans engagement : essayez et modifiez chaque chiffre.

Voir les cas d'usage