Skip to main content
PUT
/
api
/
user
/
update
Update User
curl --request PUT \
  --url https://api.example.com/api/user/update \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "json": "<string>",
  "name": "<string>",
  "surname": "<string>",
  "email": "<string>",
  "description": "<string>"
}
'
{
  "code": 123,
  "status": "<string>",
  "user": {
    "sub": 123,
    "email": "<string>"
  },
  "changes": {},
  "message": "<string>"
}

Endpoint

PUT /api/user/update
This endpoint updates the authenticated user’s profile information. Requires a valid JWT token in the Authorization header.

Authentication

Authorization
string
required
JWT token for authenticating the userExample: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...

Request Body

json
string
required
JSON string containing the user fields to update
The JSON string should contain the following fields:
name
string
required
User’s first name (alphabetic characters only)
surname
string
required
User’s last name (alphabetic characters only)
email
string
required
User’s email address (must be unique)
description
string
User’s profile description (optional)
The following fields are automatically excluded from updates and will be ignored if provided:
  • id - User ID cannot be changed
  • role - User role cannot be changed
  • password - Use a dedicated password change endpoint
  • created_at - Creation timestamp is immutable
  • remember_token - Token is managed internally

Response

code
integer
HTTP status code (200 for success, 400 for unauthorized)
status
string
Status of the request: success or error
user
object
The authenticated user object (from JWT token)
sub
integer
User’s ID from the JWT token
email
string
User’s email from the JWT token
changes
object
Object containing the fields that were updated
message
string
Error message (only present when status is error)

Request Example

curl -X PUT "https://api.example.com/api/user/update" \
  -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d 'json={"name":"John","surname":"Doe","email":"[email protected]","description":"Senior developer"}'

Response Examples

{
  "code": 200,
  "status": "success",
  "user": {
    "sub": 1,
    "email": "[email protected]"
  },
  "changes": {
    "name": "John",
    "surname": "Doe",
    "email": "[email protected]",
    "description": "Senior developer"
  }
}

Validation Rules

The endpoint validates the following rules:
  • name: Required, must contain only alphabetic characters
  • surname: Required, must contain only alphabetic characters
  • email: Required, must be a valid email format, must be unique (excluding current user)
The email uniqueness check excludes the current user’s ID, allowing users to keep their existing email address.

Build docs developers (and LLMs) love