---
title: "Create an API key for the current user"
method: POST
path: "/zot/auth/apikey"
---

# Create an API key for the current user

`POST /zot/auth/apikey`

## Request

- The document declares no server URL.
- Auth: none declared
- TypeScript: <https://skmtc.dev/project-zot/apis/open-container-initiative-distribution-specification/docs/zot/auth/apikey/post.ts> (a function with typed inputs; its response is checked against the schema)

Can create an api key for a logged in user, based on the provided label and scopes.
If apikeyMaxLifetime is set, a longer or missing expiration date is set to now + apikeyMaxLifetime.

## Request body

- ApiAPIKeyPayload
  - `expirationDate` string
  - `label` string
  - `scopes` string[]

## Response `201`

created

- string

## Other responses

- `400`: bad request
- `401`: unauthorized
- `403`: forbidden
- `413`: request entity too large
- `500`: internal server error

## Changes

- **2026-11-10** `8464398f1180`: 1 info
  - added the non-success response with the status `403`
- **2026-04-18** `c909f7333892`: 1 info
  - added the non-success response with the status `413`
- **2023-10-20** `c56ae3fa3f7d`: 1 info
  - endpoint added
- **2021-10-21** `81b68c5e4fde`: 1 breaking
  - api path removed without deprecation

[Operation history](https://skmtc.dev/project-zot/apis/open-container-initiative-distribution-specification/changes/zot/auth/apikey/post.md)

---

[API](https://skmtc.dev/project-zot/apis/open-container-initiative-distribution-specification.md) - [All operations](https://skmtc.dev/project-zot/apis/open-container-initiative-distribution-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/project-zot/apis/open-container-initiative-distribution-specification/revisions/7937343ee83f?raw)
