API Keys
What is an API Key?
┌─────────────────────────────────────────────────────────────────────────────┐
│ API KEY STRUCTURE │
└─────────────────────────────────────────────────────────────────────────────┘
API Key: sk-llm-api-a1b2c3d4e5f6g7h8i9j0...
├─┘├──────┘├──────────────────────┘
│ │ │
│ │ └── Random secret (32+ characters)
│ │
│ └── Project identifier (optional, for readability)
│
└── Prefix (sk- = secret key)
Associated Data:
┌─────────────────────────────────────────────────────────────────────────┐
│ project_id: 5ac942ba-0290-48a7-be6e-7ea58cd40b68 │
│ team_id: ab2785b2-b5d0-4926-92fb-00aae5ec860a │
│ org_id: 4047160a-abb2-497c-bf0c-3f4ab7cb0b16 │
│ created_by: [email protected] │
│ created_at: 2025-01-15T10:30:00Z │
│ expires_at: 2026-01-15T10:30:00Z (optional) │
│ status: active │
│ last_used: 2025-01-20T14:30:00Z │
└─────────────────────────────────────────────────────────────────────────┘API Key Lifecycle
Creation
Storage (Security)
Usage
Revocation
Authentication Flow
API Key vs JWT Token
Aspect
API Key
JWT Token
Managing API Keys
Admin Dashboard
Column
Description
Actions
Action
Description
Security Best Practices
Storage
✅ Do
❌ Don't
Access Control
✅ Do
❌ Don't
Operations
✅ Do
❌ Don't
Code Examples
Python
JavaScript/TypeScript
cURL
Troubleshooting
"401 Unauthorized: Invalid API key"
"401 Unauthorized: API key revoked"
"401 Unauthorized: API key expired"
"403 Forbidden: Service not allowed"
"API key not working in production"
Last updated