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.
Estimated entropy: 190 bits · 62-character pool~1,801,715,136 quintillion times the age of the universe to crack
Weak · <50 bitsFairGood · 70+Strong · 100+

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

Strong190 bits
Strong190 bits
Strong190 bits
Strong190 bits
Strong190 bits
Bulk:Exported files contain sensitive values — delete after use.

Test Your API Key

Validate API key format and test basic functionality with common endpoints.

Click "Use Generated Key" to test format validation

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

No permissions selected
json
{
  "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.

PlatformAPI TypeKey FormatExampleUse Case
StripeRESTsk_live_*sk_live_51H7...Payment processing
GitHubRESTghp_*ghp_16C7e42F...Repository access
AWSRESTAKIA*AKIAIOSFODNN7...Cloud services
ShopifyGraphQL/RESTshpat_*shpat_c7efcf...E-commerce APIs
SendGridRESTSG.*SG.ngeVfQF...Email delivery
TwilioRESTAC*AC32a3c49...Communications
Custom APIREST/GraphQLapi_*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

middleware/auth.js
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

api_auth.py
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

.env
# 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

Live Secret Key
sk_live_...
Production payments
Test Secret Key
sk_test_...
Development and testing
Publishable Key
pk_live_...
Client-side integration

OpenAI

API Key
sk-...
GPT and API access
Organization Key
org-...
Organization management

GitHub

Personal Token
ghp_...
Repository access
App Token
ghs_...
GitHub App authentication

AWS

Access Key ID
AKIA...
AWS service access
Secret Key
random40chars
Paired with Access Key

SendGrid

API Key
SG....
Email delivery service

Google Cloud

API Key
AIza...
Google services access

API Keys vs OAuth vs JWT

Choose the right authentication method for your use case.

FeatureAPI KeysOAuth 2.0JWT 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 ForServer-to-serverUser authorizationMicroservices

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'))"

How to Generate Secure API Keys

01
Choose API Key Format
Choose a REST, GraphQL, OAuth, platform-style, or custom prefix for your API credential.
02
Configure Key Settings
Adjust the key length and encoding options (Base64 or hex) based on your security requirements.
03
Generate API Key
Click the generate button to create a cryptographically secure random API key using your browser's Web Crypto API.
04
Copy and Store Securely
Copy the generated API key and store it securely in your environment variables or key management system. Never expose API keys in client-side code.