account.setPassword

bearer

Change the caller's password

Verifies the current password, sets a new one, and returns a fresh token pair (the calling session stays signed in; all other sessions are revoked). JWT session only.

Parameters

Passed by name in the params object.

Name Type Required Description
current_password string yes The caller's current password (re-authentication)
new_password string yes The new password to set

Result

Returns tokenPairResult:

Field Type Description
access_expires_at * string RFC3339 expiry of the access token
access_token * string Short-lived bearer token (15-minute TTL); send as Authorization: Bearer <token>
refresh_token * string Long-lived token used with auth.refresh to obtain a new pair
user * userDTO

Errors

Code Message When
2002 validation_failed Malformed request; see error.data.

See the error reference for the full catalog, including the authentication codes.

Example

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "account.setPassword",
  "params": {
    "current_password": "correct-horse-battery-staple",
    "new_password": "Tr0ub4dour\u00263-fresh"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwMThmM2E1Yy0xYzdhLTdlM2IifQ.c2ln",
    "refresh_token": "eyJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJyZWZyZXNoIn0.c2ln",
    "access_expires_at": "2026-03-14T09:41:53Z",
    "user": {
      "id": "018f3a5c-1c7a-7e3b-9c2a-3f4b5a6c7d8e",
      "email": "ada.lovelace@example.com",
      "is_admin": false
    }
  }
}

curl

curl -s https://peinture.gumeniuk.com/rpc \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"account.setPassword","params":{"current_password":"correct-horse-battery-staple","new_password":"Tr0ub4dour\u00263-fresh"}}'

JavaScript

const res = await fetch("https://peinture.gumeniuk.com/rpc", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${token}`,
  },
  body: JSON.stringify({
    jsonrpc: "2.0", id: 1, method: "account.setPassword", params: {"current_password":"correct-horse-battery-staple","new_password":"Tr0ub4dour\u00263-fresh"},
  }),
});
const { result, error } = await res.json();

Go

body := []byte(`{"jsonrpc":"2.0","id":1,"method":"account.setPassword","params":{"current_password":"correct-horse-battery-staple","new_password":"Tr0ub4dour\u00263-fresh"}}`)
req, _ := http.NewRequest("POST", "https://peinture.gumeniuk.com/rpc", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)

Try it

Sends a real request to /rpc from your browser. Paste a bearer token above — a JWT access token or a personal access token (pnt_…).