---
title: "Rotate database credentials"
method: POST
path: "/api/v1/databases/{databaseId}/rotate-credentials"
tags: ["Databases"]
---

# Rotate database credentials

`POST /api/v1/databases/{databaseId}/rotate-credentials`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/databases/{databaseId}/rotate-credentials`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Resets the database role password through the provider and returns the new connection URI; the previous URI stops authenticating immediately. Rotation drops any live connections or pools still using the old credentials — plan to reconnect. Rotation is idempotent: if a rotation reports a persistence failure, rotating again issues a fresh working connection string.

## Path parameters

- `databaseId` string, required

## Response `200`

The new connection URI after rotation.

- object
  - `connectionUri` string, required

## Other responses

- `401`: Authentication is missing or invalid.
- `404`: The resource was not found.
- `409`: Another rotation is already in progress for this database; retry shortly.
- `429`: Too many requests; retry after the indicated delay.

---

[API](https://skmtc.dev/khotan/apis/khotan-api.md) - [All operations](https://skmtc.dev/khotan/apis/khotan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/khotan/apis/khotan-api/revisions/90b512a53e42?raw)
