ื“ืœื’ ืœืชื•ื›ืŸ ื”ืจืืฉื™

Tenant API Keys

Programmatic API access using tenant-scoped API keys.

Overviewโ€‹

Tenant API Keys provide an alternative to JWT authentication for machine-to-machine communication. Each key is scoped to a specific tenant.

Creating API Keysโ€‹

POST /api/tenant-api-key
Authorization: Bearer {admin-token}
Content-Type: application/json

{
"name": "CI/CD Integration",
"expiresAt": "2025-12-31T00:00:00.000Z"
}

Using API Keysโ€‹

Include the API key in the X-API-Key header:

GET /api/employee
X-API-Key: {api-key}

Key Propertiesโ€‹

PropertyDescription
NameHuman-readable key identifier
API KeyThe secret key (shown once)
Expires AtOptional expiration date
TenantScoped to creating tenant

Security Considerationsโ€‹

PracticeRecommendation
Key storageStore as environment variable
RotationRotate quarterly
ExpirationAlways set expiration dates
Minimum scopeCreate purpose-specific keys
RevocationDelete immediately if leaked