---
title: "Rotate User Password"
method: POST
path: "/postgres/{postgres_cluster_id}/users/{username}/rotate_password"
tags: ["Postgres Clusters"]
---

# Rotate User Password

`POST /postgres/{postgres_cluster_id}/users/{username}/rotate_password`

Rotate a specific Postgres user's password within a cluster, optionally terminating the user's existing sessions.

## Path parameters

- `postgres_cluster_id` string, required
- `username` string, required

## Request body

- RotatePostgresPasswordRequest
  - `kill_sessions` boolean — Terminate the user's existing sessions after rotating.

## Response `200`

Rotated user credentials

- RotatePostgresPasswordResponse
  - `data` PostgresUserCredentials
    - `password` string — User password.
    - `username` string — User name.

## Other responses

- `400` — Username is reserved, a system user, or malformed
- `404` — 'Cluster not found' for the cluster; 'User not found' for the user
- `410` — 'This cluster has been deleted' or 'This cluster is being deleted'
- `422` — kill_sessions must be true or false

---

[API](https://skmtc.net/machines/apis/machines-api.md) · [All operations](https://skmtc.net/machines/apis/machines-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/machines/machines-api/versions/633ddedda749/schema)
