Skip to main content
This guide gets you from zero to a working API key verification as fast as possible. We’ll create a key, then verify it using your preferred method.
Need an account? Sign up free, takes 30 seconds.

1. Create a keyspace

A keyspace in Unkey is a container for your keys. Head to your dashboard and create one, or use one you already have. Copy your API ID, it looks like api_xxxx.

2. Create a root key

Root keys authenticate your requests to the Unkey API (for creating and managing keys).
  1. Go to Workspace Settings → Root Keys
  2. Click Create New Root Key
  3. Give it a name and select the permissions you need
  4. Copy the key, you won’t see it again
Keep your root key secret. Never expose it in client-side code or commit it to git.

3. Create an API key

Now let’s create a key that your users would use to authenticate:
Save the returned key value, that’s what you’ll verify in the next step.

4. Verify the key

This is what you’ll do on every API request to check if a key is valid:
A successful response looks like:
That’s it! You’ve just verified an API key with Unkey. 🎉

What’s in the verification response?

The data object contains everything you need to make authorization decisions:
Fields marked with ? are optional and only included when relevant (e.g., remaining only appears if you set a usage limit).

Next steps

Now integrate Unkey into your actual application:

Next.js

Protect API routes with middleware

Express

Add key verification to Express routes

Bun

Fast verification with Bun’s native server

Hono

Globally distributed API key verification
Or explore more features:

Add rate limiting

Protect endpoints from abuse

Set usage limits

Cap requests per key for billing tiers

Add permissions

Fine-grained access control

SDK Reference

Full TypeScript SDK docs
Last modified on June 2, 2026