API Keys
The Keys module replaces tools like Unkey for API key management.
Planned Features
Section titled “Planned Features”- Key generation - Create secure API keys with prefixes
- Rate limiting - Per-key rate limits
- Expiration - Set key expiration dates
- Usage tracking - Monitor key usage
- Revocation - Instantly revoke compromised keys
Quick Start (Preview)
Section titled “Quick Start (Preview)”# Create an API keysoup keys create \ --name "Production API" \ --rate-limit 1000 \ --expires 2025-01-01
# Output:# Key: sk_live_abc123...xyz789# Prefix: sk_live_abc123# Save this key - it won't be shown again!
# List keyssoup keys list
# Revoke a keysoup keys revoke sk_live_abc123
# Check usagesoup keys usage sk_live_abc123Key Validation (Preview)
Section titled “Key Validation (Preview)”Your application validates keys against Soup:
// In your API middlewareconst response = await fetch('https://api.getsoup.dev/keys/validate', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_SOUP_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ key: request.headers['x-api-key'] })});
const { valid, remaining, key_id } = await response.json();
if (!valid) { return res.status(401).json({ error: 'Invalid API key' });}
if (remaining <= 0) { return res.status(429).json({ error: 'Rate limit exceeded' });}SDK Usage (Preview)
Section titled “SDK Usage (Preview)”import { Soup } from '@soup-dev/sdk';
const soup = new Soup({ apiKey: 'sk_...' });
// Create a keyconst key = await soup.keys.create({ name: 'Customer API Key', rateLimit: 100, // per minute expiresAt: new Date('2025-01-01')});
// Validate a keyconst result = await soup.keys.validate('sk_live_...');// { valid: true, remaining: 95, keyId: 'key_abc123' }Pricing (Planned)
Section titled “Pricing (Planned)”| Tier | Limits |
|---|---|
| Free | 20 keys, 10K validations/month |
| Standard | Unlimited ($1/user/month) |
| Self-hosted | Unlimited (free) |
Interested?
Section titled “Interested?”Sign up for early access to be notified when Keys is available.