Back to Templates

Documentation with embedded api keys

Embed api keys in your documentation for easy copy-pasting

Written by
chronark
Framework
Next.js
Language
Typescript
Embed api keys in your documentation for easy copy-pasting

Showing real keys in your documentation snippets

How you can use Unkey to safely display real production keys for your users.
unkey.dev

Quickstart

Create a root key

  1. Go to /settings/root-keys and click on the "Create New Root Key" button.
  2. Enter a name for the key.
  3. Select the following workspace permissions: create_key, read_key, encrypt_key and decrypt_key.
  4. Click "Create".

Create your API

  1. Go to https://app.unkey.com/apis and click on the "Create New API" button.
  2. Give it a name.
  3. Click "Create".

Set up the example

  1. Clone the repository
1git clone git@github.com:unkeyed/examples.git
2cd examples/docs-with-real-keys
  1. Install the dependencies
1pnpm install
  1. Create a .env file and add the following:
1UNKEY_ROOT_KEY=your-root-key
2UNKEY_API_ID=your-api-id
  1. Start the server
1pnpm dev
  1. Open your browser and go to http://localhost:3000

Protect your API.
Start today.

2500 verifications and 100K successful rate‑limited requests per month. No CC required.