Skip to main content
An API is a container for related API keys. It doesn’t represent a running service or HTTP endpoint. Instead, it provides a boundary for organizing keys by product, environment, or tier. Every key belongs to exactly one API. When you create a key, you specify which API it belongs to by passing an apiId.

When to create separate APIs

Use multiple APIs when you need independent key prefixes, permissions, or analytics boundaries.
StrategyExample API namesWhy
By productpayments-api, search-apiDifferent key prefixes and permission sets per product
By environmentproduction, stagingSeparate keys and usage tracking per stage
By tierfree-tier, enterpriseDifferent default rate limits per plan
A single API works fine if all your keys share the same configuration and you filter by metadata or tags instead.

Create an API

  1. Navigate to APIs in the sidebar.
  2. Click Create API.
  3. Enter a name for your API.
Unkey generates a unique api_xxx identifier and a keyspace for the API. You use this identifier when creating keys and querying analytics.

API settings

Each API exposes configuration through its settings page.
SettingDescription
NameHuman-readable label shown in the dashboard
Default prefixPrefix prepended to every key created in this API (for example, sk_live)
Default bytesNumber of random bytes used to generate new keys (default: 16)
Store encrypted keysWhen enabled, Unkey stores an encrypted copy of each key so it can be recovered later. See Recovering keys.
IP whitelistRestrict key verification to specific IP addresses. See IP whitelist.

Keyspace

Every API has a keyspace (internally called key_auth). The keyspace is the storage and validation boundary for all keys in that API. When Sentinel or the verification endpoint receives a key, it resolves the keyspace by key prefix and validates the key against that keyspace’s configuration. The keyspace stores:
PropertyDescription
idUnique identifier (ks_xxx), used in Sentinel policies and analytics queries
default_prefixPrefix for new keys (for example, sk_live). The prefix appears before the random portion of the key.
default_bytesNumber of random bytes per key (default: 16, producing a 24-character base58 string)
store_encrypted_keysWhether to store a recoverable encrypted copy of each key
size_approxApproximate number of live keys in this keyspace
Keyspace IDs appear in analytics queries as key_space_id and in Sentinel configuration when connecting a keyspace to a deployment.

Key format

Each key is composed of a prefix and a random portion:
sk_live_abc123def456ghi789
└─────┘ └──────────────────┘
 prefix   random (base58-encoded)
The prefix is optional but recommended. It makes keys visually identifiable and lets Unkey route verification requests to the correct keyspace without a database lookup.

Delete an API

Deleting an API permanently removes the API, its keyspace, and all associated keys. This action cannot be undone.
Delete protection prevents accidental deletion. Disable it in the API settings before deleting.

Constraints

LimitValue
APIs per workspaceVaries by plan
Key prefix max length8 characters
Default bytes range16 to 32
PageDescription
API key managementIssue, verify, and manage keys
Rate limitingPer-key rate limits
AuthorizationRoles and permissions
AnalyticsQuery verification data by keyspace
Sentinel authenticationConnect keyspaces to Sentinel policies
Last modified on March 30, 2026