Skip to main content

ApiKeyResponseDTO

Package: @nauth-toolkit/core Type: DTO (Response)

Sanitized API key metadata. Never includes the plaintext key or its hash.

import { ApiKeyResponseDTO } from '@nauth-toolkit/nestjs';

Properties​

PropertyTypeRequiredDescription with validation inline
keyIdstringYesExternal key identifier (UUID v4).
namestring | nullNoUser-friendly label.
lastFourstring | nullNoLast few characters of the key (display hint).
allowedIpsstring[] | nullNoAllowed IPs / CIDR ranges (null = any IP).
expiresAtDate | nullNoExpiry timestamp, or null if never expires.
isActivebooleanYesWhether the key is active.
createdByAdminbooleanYesWhether an admin created the key.
lastUsedAtDate | nullNoLast successful use.
lastUsedIpstring | nullNoIP of last use (when tracking enabled).
usageCountnumberYesTotal successful authentications.
createdAtDateYesCreation timestamp.

Example​

{
"keyId": "550e8400-e29b-41d4-a716-446655440000",
"name": "CI pipeline",
"lastFour": "a1b2",
"allowedIps": ["203.0.113.0/24"],
"expiresAt": "2026-10-01T00:00:00.000Z",
"isActive": true,
"createdByAdmin": false,
"usageCount": 12,
"createdAt": "2026-07-01T00:00:00.000Z"
}

Used By​