# Generate an API key

`expires_in_days` is optional — omit it and the key defaults to a 90-day lifetime (`API_KEY_DEFAULT_TTL_DAYS`).
`name` is optional too — a label to help you recognise the key in the list.

Endpoint: POST /auth/api-keys
Version: 1.0.0
Security: HTTPBearer

## Security:

  - `HTTPBearer` (unknown)
    http bearer

## Request fields (application/json):

  - `expires_in_days` (any)
    Key lifetime in days. Defaults to API_KEY_DEFAULT_TTL_DAYS (90).

  - `name` (any)
    Optional label to recognise this key in the list.

## Response 201:

  - `201` (unknown)
    Successful Response

## Response 201 fields (application/json):

  - `id` (integer, required)

  - `api_key` (string, required)
    Shown once. It cannot be recovered later.

  - `name` (any)

  - `expires_at` (string, required)

  - `created_at` (string, required)

## Response 422:

  - `422` (unknown)
    Validation Error

## Response 422 fields (application/json):

  - `detail` (array)

  - `detail.loc` (array, required)

  - `detail.msg` (string, required)

  - `detail.type` (string, required)

  - `detail.input` (any)

  - `detail.ctx` (object)

