# API keys

> Documentation index: [llms.txt](https://westkite.com/docs/llms.txt). Every page is also at its URL plus `.md`.

Every call carries an API key. Create keys in the dashboard, give each one only the access it needs, and cap what it can spend.


## Get a key

Sign in at [app.westkite.com/developers](https://app.westkite.com/developers). Your first key, named Default, is ready. Make one key per app, agent or environment. You can then see each one's usage and revoke one without touching the rest.

Keys look like `wk_live_` and 32 letters and digits. The dashboard shows the first 12 characters so you can tell keys apart, when each was last used and what it has spent this month.

A coding agent can also get a key for you with your email: see the [agent quickstart](https://westkite.com/docs/api/agent-quickstart.md).

## Send the key

```sh
curl https://api.westkite.com/v1/balance -H "Authorization: Bearer $WESTKITE_API_KEY"
```

`X-API-Key: <key>` works too, for clients that can't set `Authorization`. Keep keys on a server or in your agent's environment, never in a browser or a mobile app.

## Scopes

A key can do what its scopes allow. New keys have all three.

| Scope | Allows |
|---|---|
| `data` | Search, find, properties, images, markets, coverage, exports, data requests, balance and usage |
| `research` | [Owner research](https://westkite.com/docs/api/research.md) |
| `contacts` | [Contacts](https://westkite.com/docs/api/research.md#retrieve-contact-details) |

Give an agent that only reads records a `data` key, so it can never start paid research. A call outside a key's scopes gets [`scope_missing`](https://westkite.com/docs/api/errors.md#scope_missing).

## Spend caps

A spend cap is the most a key can spend in a month. Calls that would pass it get [`spend_limit_exceeded`](https://westkite.com/docs/api/errors.md#spend_limit_exceeded) until the month turns or you raise the cap; your other keys keep working. Owner research through the API runs without an approval step, so set a cap on any key that can research.

## Roll, expire or revoke

- **Roll** a key to get a new secret at once. The old one keeps working for the grace period you pick: none if it leaked, or 1 hour, 24 hours or 7 days while you deploy the new one. Name, scopes, cap and history stay.
- **Expire** a key on a date you set.
- **Revoke** a key to stop it immediately. This can't be undone.

A revoked, expired or unknown key gets [`invalid_key`](https://westkite.com/docs/api/errors.md#invalid_key), with a `reason` that says which.

## Keys belong to your team

A key is tied to your team's billing account, not to the person who made it, so it keeps working when they leave.
