---
title: "Rotate API key"
method: POST
path: "/api/v2/organizations/api-keys/{id}/rotate"
tags: ["Api-Keys"]
---

# Rotate API key

`POST /api/v2/organizations/api-keys/{id}/rotate`

## Request

- Base URL: `https://api.kiloiot.io`
- URL: `https://api.kiloiot.io/api/v2/organizations/api-keys/{id}/rotate`
- Auth: API key in header `X-API-Key` and API key in header `X-Organization-Id`

Rotate an API key, generating a new secret while keeping the same scopes.

**Required scope:** `api-keys:write`

## Path parameters

- `id` string, required

## Query parameters

- `organizationId` string, required

## Response `200`

OK

- object
  - `id` string
  - `key` string
  - `prefix` string

## Other responses

- `401`: Missing or invalid API key
- `403`: Insufficient permissions (missing required scope)

---

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