---
title: "Create a new API key"
method: POST
path: "/admin/api-keys"
tags: ["Admin API Keys"]
---

# Create a new API key

`POST /admin/api-keys`

## Request body

- CreateApiKeyDtoClass
  - `name` string, required — Name for the API key
  - `description` string — Description of the API key purpose
  - `expiresAt` string — Expiration date in ISO format

## Response `201`

- CreateApiKeyResponseDto
  - `id` string, required — Unique identifier
  - `name` string, required — Name of the API key
  - `description` string — Description
  - `keyPrefix` string, required — Key prefix for identification (first 8 chars)
  - `isActive` boolean, required — Whether the key is active
  - `lastUsedAt` string — Last time the key was used
  - `expiresAt` string — Expiration date
  - `createdAt` string, required — Creation timestamp
  - `updatedAt` string, required — Update timestamp
  - `rawKey` string, required — The raw API key - ONLY SHOWN ONCE

---

[API](https://skmtc.dev/miaai/apis/backend-template-api.md) · [All operations](https://skmtc.dev/miaai/apis/backend-template-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/miaai/backend-template-api/revisions/2a8d88a5124f/schema)
