<!-- KeepSnappy docs for keepsnappy CLI 0.1.0-alpha.35 -->

# Keys

> Every KeepSnappy key in one place. What each one can do, where you get it, where it goes, who may see it, and how to replace or stop it.

This page is for whoever sets up KeepSnappy or looks after your CI secrets. It names every key you meet, what each one can and can't do, where you get it and where it goes. It also says how to replace or stop each one.

Every KeepSnappy key belongs to one app. Owners and admins of your organization make, replace and stop keys on **Setup** in the [dashboard](https://keepsnappy.com). If you aren't one, ask one.

## The keys at a glance

| Key | What it can do | Where you get it | Where it goes |
|---|---|---|---|
| [CI key](#ci-key) | Start sessions, upload measurements, read results | **Setup**, step 1: **Make a CI key** | The GitHub secret `KEEPSNAPPY_KEY` |
| [SDK key](#sdk-key) | Send measurements from the app, nothing else | **Setup**, step 1, under **Builds that send their own measurements** | The build variable `EXPO_PUBLIC_KEEPSNAPPY_KEY` |
| [Read key](#read-key) | Read results | **Setup**: **Connect a coding agent** | Your shell, or the GitHub secret `KEEPSNAPPY_READ_KEY` |
| [The Mac app's key](#the-mac-apps-key) | Read results, and mark places as a person | The Mac app, when you sign in to it | The Mac app |
| [AI keys](#ai-keys) | Pay your AI provider for the optional AI steps | Your AI provider | The GitHub secret `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` |

## Which keys your setup needs

- iOS, on a simulator in your CI or an iPhone on a cable: the CI key only.
- Android, on an emulator in your CI or a phone on a cable: the CI key and the SDK key.
- Real phones on BrowserStack, iOS or Android: the CI key and the SDK key.
- A coding agent or the KeepSnappy MCP server, which lets a coding agent such as Claude Code read your results ([In your coding agent](https://keepsnappy.com/docs/ask-the-ai.md#in-your-coding-agent)): a read key.
- AI review in CI: the CI key and an AI key. Investigation in CI also needs a read key.

## CI key

### What it can do

The CI key starts sessions, uploads their measurements and reads results. `keepsnappy run --upload` needs it, and so does the AI review in CI.

It can't mark an alarm as a false alarm: a mark is a person's. It can't make, see or stop other keys. It never goes into an app build, where anyone with the build could read it.

### Where you get it

An owner or admin opens **Setup** and, in step 1, chooses **Make a CI key**. If Setup says the app already has a CI key, the button says **Make a new CI key**.

The dashboard shows the key once. Copy it then. Nobody can see it again, owners included.

### Where it goes

The CI key goes into GitHub as the repository secret `KEEPSNAPPY_KEY`, and never into your app. `init` asks for it at a hidden prompt, checks it, and stores it with `gh`. It never writes the key to a file ([Getting started, step 1](https://keepsnappy.com/docs/getting-started.md#1-set-up-your-app)).

To store it, or a new one, later:

```sh
npx --no-install keepsnappy init --key
```

Without `gh`, add it by hand in GitHub: **Settings → Secrets and variables → Actions**, a new repository secret named `KEEPSNAPPY_KEY`. The step that runs `keepsnappy` reads it through its `env:` block ([the complete workflow](https://keepsnappy.com/docs/ci.md#a-complete-workflow)).

To measure on your Mac, set `KEEPSNAPPY_KEY` in your shell ([Try it on your Mac](https://keepsnappy.com/docs/on-your-mac.md)). Keep the key out of commits and out of terminal output you share.

To check it, run `npx --no-install keepsnappy doctor --group app`. Its `key` line says whether the API accepts the key in your shell, or else whether the GitHub secret is set.

### Who may see it

Only your CI, and the person who copies it into GitHub. Treat it like a password.

### Replace it

Replace the CI key when someone who had it leaves, or when it may have leaked.

1. On **Setup**, step 1, choose **Make a new key**, then confirm with **Make a new key**. The dashboard shows the new key once.
2. Store it in GitHub with `npx --no-install keepsnappy init --key`.

The old key becomes the previous key. It keeps working for 7 days, so CI doesn't break while you update the secret. Only one older key keeps working: a new key stops any previous key that still had time left.

To end the previous key sooner, choose **Stop it now** next to it and confirm. Runs that still use it fail from then on, with `invalid_key`. After a leak, do this as soon as the new key is in GitHub.

### Stop it

The dashboard can't stop the current CI key. It can only replace it. To stop CI keys for good, follow [Leaving KeepSnappy](https://keepsnappy.com/docs/leaving.md#3-stop-the-keys).

## SDK key

### What it can do

The SDK key lets the app send its measurements to KeepSnappy. It can do nothing else. It can't start a session, read a result or reach another app.

The SDK key is safe to ship in a build, because it can only send measurements. Treat it as public. Never put your CI key in a build in its place.

### Which builds need it

A build needs the SDK key when the app sends its measurements itself:

- Android, on an emulator or a phone on a cable.
- Real phones on BrowserStack, iOS or Android.

An iOS simulator or an iPhone on a cable doesn't need it. There, `keepsnappy run --upload` reads the measurements off the device and uploads them with the CI key ([The build switch](https://keepsnappy.com/docs/sdk.md#the-build-switch)).

### Where you get it

Every app has one SDK key from the start. You don't make it. Open **Setup**, step 1, and unfold **Builds that send their own measurements**. Owners and admins see the key there, with the API address. Members see only its first characters and ask an owner or admin for it.

### Where it goes

The SDK key goes into the build, at build time, in `EXPO_PUBLIC_KEEPSNAPPY_KEY`. The build also needs the API address in `EXPO_PUBLIC_KEEPSNAPPY_INGEST_URL`. Without both, the app sends nothing.

The Android job `init` writes reads the SDK key from the GitHub secret `EXPO_PUBLIC_KEEPSNAPPY_KEY`. It reads the API address from the repository variable `KEEPSNAPPY_API`. `init` lists both at its end. To add them with `gh`:

```sh
gh secret set EXPO_PUBLIC_KEEPSNAPPY_KEY
gh variable set KEEPSNAPPY_API --body "<the API address from Setup>"
```

Paste the SDK key when `gh` asks for the secret ([Android](https://keepsnappy.com/docs/android.md#android-emulator)).

If a session ends with no data because the build had no SDK key, see [Troubleshooting](https://keepsnappy.com/docs/troubleshooting.md#fix-common-problems).

### Who may see it

Anyone who has your measuring build can read the key out of it. That is fine: it can only send measurements to your app.

### Replace or stop it

The dashboard has no button for the SDK key. To replace or stop it, ask the KeepSnappy team, through the person who invited you.

## Read key

### What it can do

A read key reads your app's results. It is the key for a coding agent, for the KeepSnappy MCP server, and for investigation in CI. It also stores what an AI says about an [alarm](https://keepsnappy.com/docs/glossary.md#alarm), such as its hypotheses or an answer that an alarm is a false alarm.

It can't upload or start a session. It can't mark an alarm: a mark is a person's.

### Where you get it

An owner or admin opens **Setup** and chooses **Connect a coding agent**. They name it, choose **Make its read key**, and copy the key. The dashboard shows it once. Make one read key for each agent or machine, so you can stop one without the others.

### Where it goes

- A coding agent or the MCP server on your machine: put it in `KEEPSNAPPY_KEY` in your shell, for example in `~/.zshenv`, never in the repo ([In your coding agent](https://keepsnappy.com/docs/ask-the-ai.md#in-your-coding-agent)).
- Investigation in CI: store it as the GitHub secret `KEEPSNAPPY_READ_KEY`. `keepsnappy act` gives its agent this key and never your CI key ([AI investigation and fixes in CI](https://keepsnappy.com/docs/ai-act.md#add-the-act-step)).

The read key and the CI key use the same variable on your Mac. `~/.zshenv` sets `KEEPSNAPPY_KEY` for every shell. If it holds a read key, `keepsnappy run --upload` fails: the API refuses the key with `insufficient_scope`. Set the CI key with `export` in the one shell where you measure ([Try it on your Mac](https://keepsnappy.com/docs/on-your-mac.md#measure-a-session-before-ci)).

### Who may see it

The agent or the CI job that uses it, and the person who set it up. Keep it private: anyone who has it can read your app's results.

### Replace or stop it

Each connected agent shows under **Connected tools** on **Setup**. To stop its key, choose **Disconnect** and confirm. Agents and MCP servers that still use that key fail from then on.

To replace a read key, connect the agent again, then disconnect the old one.

## The Mac app's key

If you use the KeepSnappy Mac app, it holds a key of its own, tied to you. You don't make it or copy it: the Mac app connects itself when you sign in to it. It shows under **Connected tools** on **Setup** as a KeepSnappy Mac app.

At most 3 Mac app keys per person and app work at once. Signing in on a fourth Mac stops your oldest key ([Limits](https://keepsnappy.com/docs/limits.md#limits-you-may-reach)).

This key reads results, like a read key. It is also the only key that can mark an alarm as a person, so `keepsnappy mark` needs it. On the dashboard you mark alarms with **Mark false alarm** and need no key ([False alarms](https://keepsnappy.com/docs/false-alarms.md)).

To stop it, choose **Disconnect** on its row and confirm. When the KeepSnappy team removes someone from your organization, their Mac app key stops too. The keys they made on **Setup** keep working, so replace the CI key if they had it.

## AI keys

The AI steps in CI are optional, and they run with your own AI provider. KeepSnappy makes no AI call and never receives your AI key ([AI review and investigation in CI](https://keepsnappy.com/docs/ai-in-ci.md)).

- For Claude, store your key as the GitHub secret `ANTHROPIC_API_KEY`.
- For Codex, store your key as the GitHub secret `OPENAI_API_KEY`. Only the review runs with Codex.

Without an AI key, `keepsnappy review` and `keepsnappy act` use the login of the `claude` or `codex` command on that machine. Your AI provider receives the diff and the measured facts, with your key. To replace or stop an AI key, do it at your AI provider.

## If a key leaks

- The CI key: [replace it](#replace-it), store the new key, then choose **Stop it now** on the previous key.
- A read key, or the Mac app's key: choose **Disconnect** on it.
- The SDK key: it is public already, and can only send measurements. To replace it anyway, ask the KeepSnappy team.
- An AI key: revoke it at your AI provider.

To take KeepSnappy out completely, with every secret and key, see [Leaving KeepSnappy](https://keepsnappy.com/docs/leaving.md).

All KeepSnappy docs for agents: https://keepsnappy.com/llms.txt
