ApiKeyResponseDTO
Package: @nauth-toolkit/core
Type: DTO (Response)
Sanitized API key metadata. Never includes the plaintext key or its hash.
- NestJS
- Express
- Fastify
import { ApiKeyResponseDTO } from '@nauth-toolkit/nestjs';
import { ApiKeyResponseDTO } from '@nauth-toolkit/core';
import { ApiKeyResponseDTO } from '@nauth-toolkit/core';
Properties
| Property | Type | Required | Description with validation inline |
|---|---|---|---|
keyId | string | Yes | External key identifier (UUID v4). |
name | string | null | No | User-friendly label. |
lastFour | string | null | No | Last few characters of the key (display hint). |
allowedIps | string[] | null | No | Allowed IPs / CIDR ranges (null = any IP). |
expiresAt | Date | null | No | Expiry timestamp, or null if never expires. |
isActive | boolean | Yes | Whether the key is active. |
createdByAdmin | boolean | Yes | Whether an admin created the key. |
lastUsedAt | Date | null | No | Last successful use. |
lastUsedIp | string | null | No | IP of last use (when tracking enabled). |
usageCount | number | Yes | Total successful authentications. |
createdAt | Date | Yes | Creation 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"
}