No credential, or one that no longer holds. Send the session cookie or the Authorization: Bearer header.
409
Another account already uses that e-mail.
422
The body did not pass the schema. The details field carries zod's fieldErrors and formErrors, field by field.
No role and no tenants: nobody promotes or invites themselves. That is PATCH /api/users/[id], which only an admin reaches.
PATCH/api/profile/password
Role: Viewer
Changes your own password, requiring the current one.
The current password is required even on an already authenticated session.
Request body
Field
Type
Description
currentPasswordrequired
string
newPasswordrequired
string
Request
curl-s-X PATCH http://localhost:3000/api/profile/password \-H"Authorization: Bearer $TOKEN"\-H"Content-Type: application/json"\-d'{
"currentPassword": "a senha de agora",
"newPassword": "uma senha nova e longa"
}'
Response200
{"ok":true}
Error responses
Code
When it happens
401
The current password provided does not match.
422
The body did not pass the schema. The details field carries zod's fieldErrors and formErrors, field by field.
Changing the password drops the OTHER sessions; this tab's stays valid.
POST/api/profile/avatar
Role: Viewermultipart/form-data
Uploads the profile picture.
Images only, identified by the file's magic bytes. The container's veto (uploadMode: NONE) still holds above the screen's choice.
Request body
Field
Type
Description
filerequired
arquivo
Request
curl-s-X POST http://localhost:3000/api/profile/avatar \-H"Authorization: Bearer $TOKEN"\-F"[email protected]"
No credential, or one that no longer holds. Send the session cookie or the Authorization: Bearer header.
Lost it, make another: there is no way to recover the value. What stays on the row, besides the sha256, are the last four characters, so the screen can say which token your script carries.