---
title: "Creates a new Auth Key for a user."
method: POST
path: "/api/Account/create-auth-key"
tags: ["Account"]
---

# Creates a new Auth Key for a user.

`POST /api/Account/create-auth-key`

## Request

- Base URL: `http://localhost:5000`
- URL: `http://localhost:5000/api/Account/create-auth-key`
- Auth: API key in header `x-api-key`

## Request body

- RotateAuthKeyRequestDto
  - `keyLength` integer, required
  - `name` string, required
  - `expiresUtc` string, nullable

## Response `200`

OK

- AuthKeyDto
  - `id` integer
  - `key` string, nullable, required
  - `name` string, nullable, required
  - `createdAtUtc` string, date-time
  - `expiresAtUtc` string, date-time, nullable
  - `lastAccessedAtUtc` string, date-time, nullable
  - `provider` 0 | 1: Members: - `0` — User - `1` — System

## Changes

- **2026-01-10** `13d135cff824`: 3 warning, 3 info
  - removed the optional property `lastAccessedAt` from the response with the `200` status (media type: text/plain)
  - removed the optional property `lastAccessedAt` from the response with the `200` status (media type: application/json)
  - removed the optional property `lastAccessedAt` from the response with the `200` status (media type: text/json)
  - added the optional property `lastAccessedAtUtc` to the response with the `200` status (media type: text/plain)
  - …2 more
- **2025-12-13** `ba8553c39654`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kareadita/apis/kavita/changes/api/Account/create-auth-key/post.md)

---

[API](https://skmtc.dev/kareadita/apis/kavita.md) - [All operations](https://skmtc.dev/kareadita/apis/kavita/llms.txt) - [OpenAPI document](https://skmtc.dev/kareadita/apis/kavita/revisions/d266465eeb67?raw)
