# API keys

Open machine access, revocable without breaking anything else.

## What a key is for

It lets a script, the command line or an AI assistant talk to Naoshift without a browser session: send an export, read your data, generate a report. Your collectors have their own credentials: nothing to do here for them.

For the command line on your own computer, use **Settings › My account › API keys & CLI** instead: the computer is enrolled there with your rights.

## The steps

1. Open **Settings › Organization › Users & roles**, then **Invite and manage**.
2. Switch to the **Service accounts** tab.
3. Click **+ New key**, name it after what will use it, and choose its expiry: 30, 90 or 365 days. A key always expires.
4. Tick its **Scopes**. With nothing ticked, it can only read: a write right is never given implicitly.
5. Click **Generate**.
6. **Copy the key right away**: it will never be shown again. Keep it in your secret vault.

> Naoshift only keeps the key's fingerprint: nobody can show it to you again, not even us.

## One key per use

When a script and an assistant share a key, you cannot read its **Last access** column usefully, nor revoke one without breaking the other. A key acts within your company: treat it like a password.

Before revoking, look at **Last access**: a key used an hour ago is probably still plugged in somewhere. Revocation is immediate and final.

### I lost the key

It cannot be recovered. Create another one, replace it wherever it is used, then revoke the old one.

### Someone is leaving

Their keys do not stop with their account: go through this tab, and revoke those they created.

### My call is refused

Check the key's expiry and the company it was created in: a key only reads that company.
