Skip to content
Back to skills

Unkey

ASecurity

Unkey is high-performance infrastructure for minting, revoking, validating API keys, and enforcing distributed rate limits at the edge with global sub-10ms response times.

  • 13 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 21, 2026
ai-agentstypescriptbashdebuggingapisecurityperformance

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 21, 2026

npx -y skills add ashish7802/awesome-api-skills --skill unkey --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unkey?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unkey
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ashish7802-unkey/badge)](https://www.skillsdirectory.com/skills/ashish7802-unkey)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Unkey API Key & Rate Limiting Skill

## Overview
Unkey is high-performance infrastructure for minting, revoking, validating API keys, and enforcing distributed rate limits at the edge with global sub-10ms response times.

## Installation
```bash
npm install @unkey/api @unkey/ratelimit
```

## Verifying an Inbound API Key
```typescript
import { verifyKey } from '@unkey/api';

export async function authenticateApiKey(apiKeyValue: string) {
  const { result, error } = await verifyKey({
    key: apiKeyValue,
    apiId: process.env.UNKEY_API_ID!,
  });

  if (error) {
    console.error('Unkey verification failed:', error);
    return { authenticated: false };
  }

  if (!result.valid) {
    return { authenticated: false, reason: result.code };
  }

  return {
    authenticated: true,
    ownerId: result.ownerId,
    meta: result.meta,
  };
}
```

## Creating a New Customer API Key
```typescript
import { Unkey } from '@unkey/api';

const unkey = new Unkey({ rootKey: process.env.UNKEY_ROOT_KEY! });

const created = await unkey.keys.create({
  apiId: process.env.UNKEY_API_ID!,
  prefix: 'acme',
  ownerId: 'user_9921',
  name: 'Production Worker Key',
  ratelimit: {
    type: 'fast',
    limit: 100,
    duration: 60000, // 100 requests per minute
  },
  meta: {
    tier: 'enterprise',
  },
});

console.log('Customer API Key:', created.result?.key);
```

## AI Pitfalls & Anti-Hallucination Guidelines
- **Plaintext Key Security**: The plaintext API key is only returned once upon creation. Store hash or instruct user to copy immediately.
- **Root Key vs Client Verification**: Key creation requires `UNKEY_ROOT_KEY`. Verification only requires `apiId`.

## Production Verification Checklist
- [ ] API keys verified on edge runtime before handler execution
- [ ] Rate limit exhaustion returns HTTP 429 Too Many Requests
- [ ] Key prefixes utilized to simplify customer debugging (e.g. `pk_live_...`)

---
> **Last Verified:** 2026-07-03

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.