> ## 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.

# portal_key_limit_reached

> The end user already holds as many keys as their portal session allows.

> [!CAUTION]
>
> `err:unkey:application:portal_key_limit_reached`

An end user tried to create a key in the Customer Portal, but they already hold as many live keys in the keyspace as their portal session allows. No key was created. You get HTTP 412.

```json Example response theme={"system"}
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "error": {
    "detail": "You have reached the maximum number of keys. A key must expire, or the service owner must remove one, before you can create another.",
    "status": 412,
    "title": "Precondition Failed",
    "type": "/errors/unkey/application/portal_key_limit_reached"
  }
}
```

## Likely causes

* The end user created keys in the portal up to the key cap on their session.
* Keys you issued to the same `externalId` with `keys.createKey` count toward the same cap. Expired and deleted keys don't.

## How to fix

1. Delete a key the end user no longer needs with `keys.deleteKey`, or wait for one to expire.
2. To allow more keys, create a new portal session with a higher key cap. The cap is fixed for the lifetime of a session.

The cap only limits keys created through the portal. You can still issue keys to the same end user with `keys.createKey`.

## Related errors

* [`err:unkey:application:portal_key_creation_unavailable`](https://www.unkey.com/docs/errors/unkey/application/portal_key_creation_unavailable): the session's key-creation settings can no longer be applied.


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