> ## Documentation Index
> Fetch the complete documentation index at: https://www.unkey.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Unkey is two separate products. Compute builds, deploys, and runs apps behind a gateway. API Management issues API keys, enforces rate limits, manages identities and permissions, and reports usage. Say which product a page belongs to; a reader can use either without the other.
> Every Unkey API endpoint is an HTTP POST to https://api.unkey.com/v2/{service}.{procedure} with a root key in the Authorization: Bearer header. Root keys are workspace scoped.
> Error codes have the form err:{system}:{category}:{specific} and each has a page at /errors/{system}/{category}/{specific}.
> The word environment means production or preview in Compute. Rate limiting has four meanings on this site; the glossary lists them.

# Security

> See how Unkey protects your keys and workspace and what you can turn on.

Unkey stores every API key and root key as a SHA-256 hash, so you can issue and verify keys without keeping a homegrown key table. A copy of the database isn't a list of working keys. This page covers that storage and what you can turn on around it.

## How Unkey stores API keys

Unkey doesn't store the API key. On create, it hashes the full key string with SHA-256 and stores the hash as standard base64, not hex. Verification hashes the key your user sent and compares the two strings. There's no salt. The plaintext is returned once, in the create response, and isn't kept.

See the [OWASP Secrets Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) and the [OWASP REST Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/REST_Security_Cheat_Sheet.html) for hashing and storing secrets you only need to verify. SHA-256 here is a fast hash of a random key, not a password hash such as bcrypt or Argon2.

If a keyspace must show a key again, you opt in to an encrypted copy beside the hash. The copy is AES-256-GCM, the keyring is the workspace, and only a root key with decrypt permission can read the key back. Verification still uses the hash. See [Key storage](https://www.unkey.com/docs/platform/security/key-storage.md) and [Recovering keys](https://www.unkey.com/docs/api-management/security/recovering-keys.md).

## Should you build your own API key system?

You can. What moves to Unkey is generating the random key, storing only the hash, and checking it on each request. `keys.createKey` issues the key. `keys.verifyKey` checks enabled, expiry, credits, rate limits, and permissions. If you already have hashes and the format matches, [Migrating keys](https://www.unkey.com/docs/api-management/keys/migrating-keys.md) covers importing them.

You still run your API, unless you deploy it on Compute. You still decide the HTTP status you return to your users. You stop maintaining the keys table, the hash comparison, and, if you use Unkey for them, the rate-limit counters and the monthly credit balance.

## How Unkey protects the workspace

Two controls apply to the workspace itself, separate from how keys are stored.

**Access is scoped.** A root key only works in the workspace that issued it, and every endpoint needs a specific permission. Dashboard users are either an admin or a developer. Developers can see admin-only settings such as billing and the workspace name but can't change them, and **Root Keys** is hidden from them. See [Team](https://www.unkey.com/docs/platform/workspace/team.md).

**Changes are audited.** Changes made in the dashboard appear in the audit log with who made them, the event, and a description. For example, renaming a workspace logs `workspace.update`. How long entries are kept depends on your plan. See [Limits](https://www.unkey.com/docs/platform/billing/limits.md).

## Security features you can use

> [card] [Key storage](https://www.unkey.com/docs/platform/security/key-storage.md)
>
> Hashing, verification, and the opt-in encrypted storage for recoverable keys.

> [card] [GitHub secret scanning](https://www.unkey.com/docs/platform/security/github-secret-scanning.md)
>
> What happens when a key is pushed to a public repository.

> [card] [Delete protection](https://www.unkey.com/docs/platform/security/delete-protection.md)
>
> A flag that blocks deleting a keyspace, project (A group of apps, usually one per codebase or product.), or app until you turn it off.

> [card] [Two-factor authentication](https://www.unkey.com/docs/platform/workspace/team.md#two-factor-authentication)
>
> Enroll a second factor on your own account.

## Reporting a vulnerability

If you find a security issue, email [security@unkey.com](mailto:security@unkey.com) with steps to reproduce. Don't open a public issue or pull request. Reports about `api.unkey.com` and `app.unkey.com` are in scope. The docs site, the marketing site, and misconfigured self-hosted setups aren't. The full policy is in [SECURITY.md](https://github.com/unkeyed/unkey/blob/main/SECURITY.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.