API Key Management
All admin endpoints require authentication. Rate limit: 10 requests/min per IP.
POST /admin/keys
Generates a new API key.
curl -X POST http://localhost:4000/api/v1/admin/keys \ -H "Content-Type: application/json" \ -H "x-api-key: sk_your_key" \ -d '{ "name": "wordygo-frontend" }'Response 201:
{ "key": "sk_a1b2c3d4e5f6...", "message": "Save this key securely. It will not be shown again."}Keys generated at runtime exist only in memory and are lost on process restart. Only the key defined in
API_KEYin.envpersists between restarts.
GET /admin/keys
Lists all registered keys.
curl http://localhost:4000/api/v1/admin/keys \ -H "x-api-key: sk_your_key"Response 200:
[ { "keyPreview": "sk_test_...ocal", "name": "Default (from .env)", "createdAt": "2026-05-09T20:00:00.000Z", "lastUsedAt": "2026-05-09T21:00:00.000Z", "isActive": true }]DELETE /admin/keys
Revokes a key.
curl -X DELETE http://localhost:4000/api/v1/admin/keys \ -H "Content-Type: application/json" \ -H "x-api-key: sk_your_key" \ -d '{ "rawKey": "sk_a1b2c3d4e5f6..." }'Response 200:
{ "revoked": true }