account.setEmail
bearer
Change the caller's email address
Verifies the current password and updates the email. No confirmation email is sent. 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) |
email |
string | yes | The new email address |
Result
Returns userResult:
| Field | Type | Description |
|---|---|---|
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.setEmail",
"params": {
"current_password": "correct-horse-battery-staple",
"email": "ada@analyticalengine.example"
}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"user": {
"id": "018f3a5c-1c7a-7e3b-9c2a-3f4b5a6c7d8e",
"email": "ada@analyticalengine.example",
"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.setEmail","params":{"current_password":"correct-horse-battery-staple","email":"ada@analyticalengine.example"}}'
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.setEmail", params: {"current_password":"correct-horse-battery-staple","email":"ada@analyticalengine.example"},
}),
});
const { result, error } = await res.json();
Go
body := []byte(`{"jsonrpc":"2.0","id":1,"method":"account.setEmail","params":{"current_password":"correct-horse-battery-staple","email":"ada@analyticalengine.example"}}`)
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)