Skip to main content
A keyspace 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. In the dashboard, keyspaces appear under Keyspaces (APIs). Every key belongs to exactly one keyspace. When you create a key, you specify which keyspace it belongs to by passing its apiId.

When to create separate keyspaces

Use multiple keyspaces when you need independent key prefixes, permissions, or analytics boundaries. A single keyspace works fine if all your keys share the same configuration and you filter by metadata or tags instead.

Create a keyspace

  1. Navigate to Keyspaces (APIs) in the sidebar.
  2. Click New keyspace.
  3. Enter a name for your keyspace.
Unkey generates a unique API ID (api_xxx) for the keyspace. This is the identifier you pass when creating keys and querying analytics, so keep it handy.

Keyspace settings

Each keyspace exposes configuration through its settings page.

Identifiers

Each keyspace has two identifiers:

Storage and validation

A keyspace is the storage and validation boundary for all of its keys (internally, it’s backed by a key_auth record). When the gateway 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: KeySpace IDs appear in analytics queries as key_space_id and in gateway configuration when connecting a keyspace to a deployment.

Key format

Each key is composed of a prefix and a random portion:
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 a keyspace

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

Constraints

Last modified on July 10, 2026