#48 [Admin Panel] API Key Management - Create API Key

closed critical Created 2025-11-27 07:13 · Updated 2025-11-27 08:57

Description

Edit
Implement POST /api/v1/admin/api-keys endpoint to create API keys for service accounts. **API Specification:** - Endpoint: POST /api/v1/admin/api-keys - Permission Required: manage_users - Request Body: {name, description?, permissions[]?, expires_at?, ip_whitelist[]?} - Response: {api_key_id, api_key (shown once), name, permissions[], created_at} **Requirements:** - Generate secure API key (32-byte random, base64 encoded) - API key shown ONLY on creation (cannot be retrieved later) - Optional permission scoping (subset of available permissions) - Optional IP whitelist restriction - Optional expiration date - Store hash of API key, not plaintext **Database Schema (api_keys table):** - api_key_id (UUID), tenant_id - name, description - key_hash (SHA256) - key_prefix (first 8 chars for identification) - permissions[] (JSONB) - ip_whitelist[] (JSONB) - created_at, expires_at, last_used_at - created_by, is_active **IMPORTANT:** Implement with ultra attention to details and correctness. **BEFORE CLOSING:** Take screenshot showing API key creation. Add comment summarizing implementation.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...