Skip to main content

CreateApiKeyDTO

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

Create an API key for the authenticated user. Expiry is mandatory; IP allowlist is optional.

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

Properties​

PropertyTypeRequiredDescription with validation inline
namestringNoOptional label. Max 255 chars.
expiresInDaysnumber | nullYesExpiry in days, or null for never (if allowed). Positive integer when set.
allowedIpsstring[]NoIPs / IPv4 CIDR ranges. Empty = any IP.

Example​

{
"name": "CI pipeline",
"expiresInDays": 90,
"allowedIps": ["203.0.113.0/24"]
}

Used By​