Skip to main content

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