# Service keys

> Draft for `/docs/service-keys`. Behaviour read from `src/server/services/service-keys.ts` on 2026-11-22.
> **True only after the Settings screen ships** (settings-mvp.md, S3). Today keys are created by the operator on the server; until S3 ships, replace "Create a key" below with "write to hello@nauvid.com".

A service key lets an agent work in nauvid when nobody is there to sign in: a nightly job, a CI step, `claude -p`.

## What a key is

- It starts with `nv_sk_`.
- It works in **one team**. It cannot see any other team, even if its creator is a member of several.
- It acts with the rights of the person who created it. Changes are recorded as that person, via the key's name, for example "Lena · via Nightly design refresh".
- It stops working the moment it is revoked, or when its creator leaves or is removed from the team.
- nauvid stores only a SHA-256 hash. The key is shown once, when it is created.

## Create a key

1. In nauvid open Settings → Agents & keys. Only team owners see **New key**.
2. Give it a name that says what uses it (up to 80 characters), for example "CI screenshots".
3. Copy the key and put it in a secret store or an environment variable.

## Use a key

Send it as a bearer token on every request to `https://nauvid.com/mcp`:

```
Authorization: Bearer nv_sk_...
```

Client setup: [Claude Code](connect-claude-code.md#headless-service-key), [Gemini CLI](connect-gemini.md#gemini-cli), [any MCP client](connect-any-mcp-client.md). ChatGPT and the Claude apps cannot send a key; use the Google sign-in there.

## Keep it safe

- Never commit a key, paste it into a prompt or a chat, or put it in a URL.
- One key per job. If a job is retired or a key may have leaked, revoke that key under Settings → Agents & keys and create a new one.
- A leaked key can read and change every design in its team until it is revoked.

## Key or sign-in?

| | Sign-in (OAuth) | Service key |
| --- | --- | --- |
| Someone can click through a browser | Yes | Not needed |
| Works in | All of the person's teams | One team |
| Recorded as | The person, via the client | The key's creator, via the key's name |
| Ends when | The person revokes the agent | An owner revokes the key, or its creator leaves |
