Skip to main content
PUT
Update the profile information for the currently authenticated user. This endpoint allows users to modify their personal information, preferences, and user metadata.
This endpoint requires authentication. Include the Bearer token in the Authorization header.

Request Body

string
New email address. If changed, email verification will be required.
string
New phone number in E.164 format. If changed, phone verification will be required.
string
New password. Must meet security requirements (minimum 8 characters).
object
User metadata object containing profile information and preferences.
string
Optional nonce for additional security (prevents replay attacks).

Response

Returns the updated user object with the same structure as the GET /user endpoint.
string
Unique user identifier (UUID)
string
Updated email address
string
Updated phone number
object
Updated user metadata
string
ISO timestamp when user account was last updated

Error Responses

Implementation Examples

React Profile Edit Form

React Avatar Upload Component

Node.js Backend Handler

Verification Requirements

When updating email or phone number, verification is required:

Email Change Flow

1

Update Request

User submits new email address via PUT /user
2

Verification Email

System sends verification email to new address
3

Email Confirmation

User clicks verification link in email
4

Email Confirmed

New email is confirmed and becomes active

Phone Change Flow

1

Update Request

User submits new phone number via PUT /user
2

OTP Sent

System sends OTP to new phone number
3

OTP Verification

User enters OTP code for verification
4

Phone Confirmed

New phone number is confirmed and becomes active

Security Features

  • Authentication Required: All updates require valid JWT token
  • Email Verification: New email addresses must be verified
  • Phone Verification: New phone numbers must be verified
  • Password Strength: Enforced password complexity requirements
  • Rate Limiting: Prevents abuse of profile updates
  • Audit Logging: All profile changes are logged

Best Practices

  • Validate all input data on both client and server
  • Sanitize user inputs to prevent XSS attacks
  • Implement proper email and phone format validation
  • Enforce strong password requirements
  • Limit metadata size to prevent abuse
  • Provide real-time validation feedback
  • Show clear success and error messages
  • Implement auto-save for non-critical fields
  • Allow partial updates without requiring all fields
  • Provide preview functionality for changes
  • Always verify email and phone changes
  • Log all profile modifications for audit trails
  • Implement rate limiting for update requests
  • Use HTTPS for all profile update requests
  • Consider implementing change confirmation for sensitive updates

Testing

Unit Tests

Get User Profile

Retrieve current user profile

Verify Email

Verify new email address

Verify Phone

Verify new phone number

Change Password

Change user password