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

# Create Api Key Endpoint

`POST /api/v1/auth/api-keys`

## Request

- Base URL: `https://calorieapiadmin.com`
- URL: `https://calorieapiadmin.com/api/v1/auth/api-keys`
- Auth: none declared

Create a new API key for the authenticated user (requires JWT token).

## Headers

- `authorization` string, nullable

## Request body

- ApiKeyCreate: Schema for creating API key.
  - `name` string, required

## Response `200`

Successful Response

- ApiKeyResponse: Schema for API key response.
  - `id` integer, required
  - `name` string, required
  - `key` string, nullable
  - `is_active` boolean, required
  - `created_at` string, date-time, nullable
  - `last_used_at` string, date-time, nullable
  - `usage_count` integer
  - `product` string

## Other responses

- `422`: Validation Error

---

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