# Limits

Default entity limits and the errors Keycard returns at a limit or a rate limit.

Keycard limits how many of each entity you can create, and applies rate limits to some requests. Deleted and archived entities do not count toward an entity limit.

## Entity limits

| Entity | Default limit |
| --- | --- |
| Organizations created per person | 5 |
| [Service accounts](/admin/service-accounts/) per organization | 10 |
| [Zones](/concepts/zones/) per organization | 25 |
| [Applications](/concepts/applications/) per Zone | 500 |
| [Groups](/concepts/groups/) per Zone | 1,000 |
| [Policies](/concepts/policies/) per Zone | 500 |
| [Policy Sets](/concepts/policies/) per Zone | 100 |
| [Providers](/concepts/providers/) per Zone | 200 |
| [Resources](/concepts/resources/) per Zone | 1,000 |
| [Roles](/admin/roles-and-permissions/) per Zone | 200 |
| [SCIM sync tokens](/admin/single-sign-on/scim-provisioning/) per Zone | 5 |
| [Vaulted credentials](/concepts/resources/#vaulted-static-credentials) per Zone | 1,000 |
| [Users](/concepts/users/) per Zone | 5,000 |
| [Credentials](/concepts/applications/#credentials) per Application | 10 |
| [Dependencies](/concepts/applications/#dependencies) per Application | 1,000 |
| [Actions](/admin/unified-access-gateway/tool-management/) per Resource | 1,000 |
| Credentials per service account | 10 |

## When you reach a limit

When an entity is at its limit, Keycard rejects the next create request with HTTP `403 Forbidden`. A retry does not succeed. Delete an entity that you do not use, or [request a limit increase](#request-a-limit-increase).

To detect this error, match `details[].code` to `quota_exceeded`. Keycard also returns the top-level `code` `forbidden` for missing permissions. `details[].field` names the entity, and `details[].message` describes the limit in words.

```json
{
  "status": 403,
  "code": "forbidden",
  "message": "Limit of 5000 users per zone reached",
  "details": [
    {
      "field": "users",
      "code": "quota_exceeded",
      "message": "Limit of 5000 users per zone reached"
    }
  ],
  "request_id": "<request-id>"
}
```

A SCIM request at the User limit returns `403` with a SCIM error body instead. Its `detail` reads `quota exceeded: limit of <limit> users per zone reached`.

## Rate limits

Keycard applies rate limits to some requests, per User, organization, Zone, or source IP address.

When a request exceeds a rate limit, Keycard returns HTTP `429 Too Many Requests` with `code` set to `rate_limit_exceeded`. Retry with exponential backoff. If the response includes a `Retry-After` header, wait that many seconds before you retry.

## Request a limit increase

To request a higher limit, email [support@keycard.ai](mailto:support@keycard.ai). Include your organization ID, the Zone ID for a per-Zone limit, the entity, and the limit you need.
