Skip to content

API Keys

The Keys module replaces tools like Unkey for API key management.

  • 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
Terminal window
# Create an API key
soup 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 keys
soup keys list
# Revoke a key
soup keys revoke sk_live_abc123
# Check usage
soup keys usage sk_live_abc123

Your application validates keys against Soup:

// In your API middleware
const 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' });
}
import { Soup } from '@soup-dev/sdk';
const soup = new Soup({ apiKey: 'sk_...' });
// Create a key
const key = await soup.keys.create({
name: 'Customer API Key',
rateLimit: 100, // per minute
expiresAt: new Date('2025-01-01')
});
// Validate a key
const result = await soup.keys.validate('sk_live_...');
// { valid: true, remaining: 95, keyId: 'key_abc123' }
TierLimits
Free20 keys, 10K validations/month
StandardUnlimited ($1/user/month)
Self-hostedUnlimited (free)

Sign up for early access to be notified when Keys is available.