CreateApiKeyDTO
Package: @nauth-toolkit/core
Type: DTO (Request)
Create an API key for the authenticated user. Expiry is mandatory; IP allowlist is optional.
- NestJS
- Express
- Fastify
import { CreateApiKeyDTO } from '@nauth-toolkit/nestjs';
import { CreateApiKeyDTO } from '@nauth-toolkit/core';
import { CreateApiKeyDTO } from '@nauth-toolkit/core';
Properties
| Property | Type | Required | Description with validation inline |
|---|---|---|---|
name | string | No | Optional label. Max 255 chars. |
expiresInDays | number | null | Yes | Expiry in days, or null for never (if allowed). Positive integer when set. |
allowedIps | string[] | No | IPs / IPv4 CIDR ranges. Empty = any IP. |
Example
{
"name": "CI pipeline",
"expiresInDays": 90,
"allowedIps": ["203.0.113.0/24"]
}