---
title: "Create an API key (shown once, in this answer: no copy is kept)"
method: POST
path: "/api/auth/api-key/create"
tags: ["Accounts"]
---

# Create an API key (shown once, in this answer: no copy is kept)

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

## Request

- Base URL: `https://agentdrives.com`
- URL: `https://agentdrives.com/api/auth/api-key/create`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

## Request body

- object
  - `name` string

## Response `200`

Key

- object
  - `id` string, required
  - `name` string, nullable
  - `start` string, nullable
  - `key` string, required: Send as x-api-key

## Other responses

- `403`: session_required: sent with an API key. Keys are made from a signed-in session (a cookie or the Bearer token of a code sign-in), never with another key

## Changes

- **2026-10-20** `94dcaabff4b2`: 4 info
  - added the optional property `name` to the response with the `200` status
  - added the optional property `start` to the response with the `200` status
  - the response property `id` became required for the status `200`
  - the response property `key` became required for the status `200`

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

---

[API](https://skmtc.dev/agentdrives/apis/agentdrives-api.md) · [All operations](https://skmtc.dev/agentdrives/apis/agentdrives-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentdrives/apis/agentdrives-api/revisions/94dcaabff4b2?raw)
