---
title: "Rotate Api Key"
method: POST
path: "/v1/tenants/keys/{key_id}/rotate"
tags: ["tenants"]
---

# Rotate Api Key

`POST /v1/tenants/keys/{key_id}/rotate`

## Request

- Base URL: `https://api.bitpoort.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.bitpoort.com/v1/tenants/keys/{key_id}/rotate`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Rotate an API key: expire the old one immediately and issue a new key.

Returns the new raw key (shown only once). The old key becomes invalid
immediately via ``expires_at = NOW()``.

## Path parameters

- `key_id` integer, required

## Query parameters

- `ttl_days` integer

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

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