Free · Private · Client-side
Secure API Key Generator
Generate secure API tokens with customizable prefixes. Perfect for authentication tokens, API credentials, and access management.
Generated values never leave this device.In plain terms: a gaming PC guessing a million passwords per second would need 1,801,715,135,946,800 quintillion times the age of the universe. Even someone renting every cloud server on Earth — a trillion guesses per second — would need 1,801,715,136 quintillion times the age of the universe. Nobody is guessing this password; the only realistic risks are it being reused or phished.
Generated API keys
Test Your API Key
Validate API key format and test basic functionality with common endpoints.
API Key Permissions Builder
Define granular permissions and access controls for your API keys with preset templates and custom scopes.
Permission Presets
Individual Permissions
API Configuration
{
"api_key": "sk_live_...",
"permissions": [
"users:read"
],
"rate_limit": "1000/hour",
"api_version": "v1",
"created_at": "YYYY-MM-DDTHH:mm:ss.sssZ",
"expires_at": "YYYY-MM-DD"
}API Formats by Platform
Different platforms use specific API key formats. Choose the right format for your integration.
| Platform | API Type | Key Format | Example | Use Case |
|---|---|---|---|---|
| Stripe | REST | sk_live_* | sk_live_51H7... | Payment processing |
| GitHub | REST | ghp_* | ghp_16C7e42F... | Repository access |
| AWS | REST | AKIA* | AKIAIOSFODNN7... | Cloud services |
| Shopify | GraphQL/REST | shpat_* | shpat_c7efcf... | E-commerce APIs |
| SendGrid | REST | SG.* | SG.ngeVfQF... | Email delivery |
| Twilio | REST | AC* | AC32a3c49... | Communications |
| Custom API | REST/GraphQL | api_* | api_1234abcd... | Your application |
REST vs GraphQL
- • REST: One key per resource level
- • GraphQL: Fine-grained query permissions
- • OAuth: Token-based with scopes
Security Best Practices
- • Use different keys for dev/staging/prod
- • Rotate keys every 90 days minimum
- • Implement proper rate limiting
- • Log all API key usage
Implementation Examples
Express.js Permission Middleware
const apiKeys = new Map([
['sk_live_example', {
permissions: ['users:read'],
rate_limit: '1000/hour',
api_version: 'v1'
}]
]);
function requirePermission(requiredPermission) {
return (req, res, next) => {
const apiKey = req.headers['authorization']?.replace('Bearer ', '');
if (!apiKey) {
return res.status(401).json({ error: 'API key required' });
}
const keyData = apiKeys.get(apiKey);
if (!keyData) {
return res.status(401).json({ error: 'Invalid API key' });
}
// Check permission
const hasPermission = keyData.permissions.includes('*:*') ||
keyData.permissions.includes(requiredPermission);
if (!hasPermission) {
return res.status(403).json({
error: 'Insufficient permissions',
required: requiredPermission,
granted: keyData.permissions
});
}
req.apiKey = keyData;
next();
};
}
// Usage
app.get('/users', requirePermission('users:read'), (req, res) => {
res.json({ users: [] });
});
app.post('/users', requirePermission('users:write'), (req, res) => {
res.json({ message: 'User created' });
});Python Flask with Scopes
from functools import wraps
from flask import request, jsonify
API_KEYS = {
'sk_live_example': {
'permissions': ['users:read'],
'rate_limit': '1000/hour',
'api_version': 'v1'
}
}
def require_permission(required_permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
auth_header = request.headers.get('Authorization', '')
if not auth_header.startswith('Bearer '):
return jsonify({'error': 'API key required'}), 401
api_key = auth_header[7:] # Remove 'Bearer '
key_data = API_KEYS.get(api_key)
if not key_data:
return jsonify({'error': 'Invalid API key'}), 401
permissions = key_data['permissions']
has_permission = ('*:*' in permissions or
required_permission in permissions)
if not has_permission:
return jsonify({
'error': 'Insufficient permissions',
'required': required_permission,
'granted': permissions
}), 403
request.api_key_data = key_data
return f(*args, **kwargs)
return decorated_function
return decorator
# Usage
@app.route('/users')
@require_permission('users:read')
def get_users():
return jsonify({'users': []})
@app.route('/users', methods=['POST'])
@require_permission('users:write')
def create_user():
return jsonify({'message': 'User created'})Usage Example
# Store your API token securely
API_KEY=sk_live_...Token prefixes
Prefixes like sk_ (secret) and pk_ (public) help identify token types at a glance and prevent accidental exposure. The _live and _test suffixes distinguish production from development environments.
API Key Formats by Platform
Different platforms use specific API key formats. Choose the right format for your integration needs.
Stripe
OpenAI
GitHub
AWS
SendGrid
Google Cloud
API Keys vs OAuth vs JWT
Choose the right authentication method for your use case.
| Feature | API Keys | OAuth 2.0 | JWT Tokens |
|---|---|---|---|
| Setup Complexity | 🟢 Simple | 🟡 Moderate | 🟡 Moderate |
| Security Level | 🟡 Medium | 🟢 High | 🟢 High |
| Token Expiry | 🔴 Manual | 🟢 Automatic | 🟢 Built-in |
| Permissions | 🟡 Fixed Scopes | 🟢 Dynamic Scopes | 🟢 Claim-based |
| Best For | Server-to-server | User authorization | Microservices |
API Keys
Perfect for backend services, webhooks, and system-to-system authentication where simplicity is key.
OAuth 2.0
Ideal for user-facing applications where users need to authorize third-party access to their data.
JWT Tokens
Best for distributed systems and microservices where stateless authentication is required.
Generate in Terminal
For production systems, generate tokens locally:
OpenSSL with prefix
echo "sk_live_$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c 32)"Python secrets module
python3 -c "import secrets; print(f'sk_live_{secrets.token_urlsafe(24)}')"Node.js crypto
node -e "console.log('sk_live_' + require('crypto').randomBytes(24).toString('base64url'))"