
# Change password

`POST /fapi/v1/me/password` · called from the environment's sign-in host

Changes the signed-in user's password. The current password is checked; the new password must pass the environment's password policy, the breached password check and the password history rule. On success every other session and refresh token of the user is revoked, this session stays signed in, and a security notification is sent to the user's email addresses. Requires the authenticated user's `__Host-idp_session` cookie. A first-party app on another origin can instead send its front API access token (`Authorization: DPoP <token>` with a DPoP proof; see [Front API access token](/docs/api/fapi/front-api-token)).

## Request

Headers:

| Header | Required | Description |
| --- | --- | --- |
| `Idp-Client` | yes | SDK identifier. |
| `Origin` | yes | Must be exactly `https://<sign-in host>`. |

Body:

```json
{"current_password": "…", "new_password": "…"}
```

## Response

`204 No Content`.

## Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | No valid session cookie. |
| 401 | `step_up_required` | Session was not verified in the last 5 minutes; re-verify with `max_age=300` in the `WWW-Authenticate` header. Nothing is checked or counted. |
| 401 | `invalid_credentials` | The current password is wrong. Repeated failures lock the password the same way as sign-in does. |
| 403 | `origin_not_allowed` | `Origin` is missing or wrong. |
| 422 | `password_policy_violation` | The new password breaks the policy; `errors[]` lists each broken rule for `/new_password` (`too_short`, `too_long`, `context_term`, `custom_term`, `repeated_chars`, `invalid_text`, `reused`). |
| 422 | `breached_password` | The new password appears in a known data breach. |
| 503 | `temporarily_unavailable` | The server is busy; retry after `Retry-After` seconds. |

## Example

```bash
curl -X POST https://example.keenauth.app/fapi/v1/me/password \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)" \
  -H "Origin: https://example.keenauth.app" \
  -H "Content-Type: application/json" \
  -d '{"current_password": "…", "new_password": "…"}' \
  -b cookies.txt
```

## Personal data

This endpoint carries personal data: credentials. [Personal data in the KeenAuth APIs](/docs/policies/personal-data) describes what is stored, how long it is kept and how it is deleted. Do not send special categories of personal data (health, biometric data, religion, political opinions, sexual orientation) in any field.
