---
title: "Create Api Key"
method: POST
path: "/api/v1/auth/keys"
tags: ["Auth"]
---

# Create Api Key

`POST /api/v1/auth/keys`

## Request

- Base URL: `https://api.freeastroapi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.freeastroapi.com/api/v1/auth/keys`
- Auth: none declared

Create a new API key for the authenticated user

## Headers

- `authorization` string

## Request body

- CreateKeyRequest
  - `name` string, required

## Response `200`

Successful Response

- KeyResponse
  - `id` string, required
  - `name` string, required
  - `prefix` string, required
  - `created_at` string, required
  - `expires_at` string, nullable
  - `last_used_at` string, nullable
  - `is_active` boolean
  - `key` string, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/freeastroapi/apis/astroservice-api.md) · [All operations](https://skmtc.dev/freeastroapi/apis/astroservice-api/llms.txt) · [OpenAPI document](https://skmtc.dev/freeastroapi/apis/astroservice-api/revisions/0c9b4a759522?raw)
