PUT /users/{id}

Update user

Users

Description

Update information for a specific user.

Authentication Required: User must be authenticated.

Authorization: Users can only update their own profile.

Email Verification: If the email address is changed, the user's email will be marked as unverified and a verification email will be sent to the new email address. The user must verify the new email to restore access to features.

Parameters

id integer path required
User ID

Request Body

required

application/json

userobject
first_namestring
Example: John
last_namestring
Example: Doe
emailstring (email)
passwordstring (password)
Example: newsecurepassword123
feature_flagsarray [string]
User's feature flags (optional, editable)
Example: ["affiliate"]
notificationsarray [string]
User's notification preferences (optional, editable)
Example: ["email_new_transaction","push_new_transaction"]
localestringenum: en, fr
User's preferred language (optional, editable)
Example: en
expo_push_tokenstring
Expo push notification token for mobile app notifications. Must be in format ExponentPushToken[...] or ExpoPushToken[...] (optional, editable)
Example: ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]

Responses

200 User updated successfully
application/json
statusstring
Example: success
messagestring
Example: User updated successfully
dataobject
Example:
{
  "status": "success",
  "message": "User updated successfully",
  "data": {
    "id": 1,
    "email": "[email protected]",
    "first_name": "John",
    "last_name": "Doe",
    "roles": [],
    "feature_flags": [
      "affiliate"
    ],
    "notifications": [
      "email_new_transaction",
      "push_new_transaction"
    ],
    "status": "active",
    "locale": "en",
    "created_at": "2024-01-15T10:30:00Z"
  }
}
401 Authentication required
application/json
Example:
{
  "status": "error",
  "message": "Not authenticated or insufficient permissions"
}
404 User not found
application/json
Example:
{
  "status": "error",
  "message": "User not found"
}
422 Validation error
application/json
statusstring
Example: error
messagestring
Example: Failed to update user
errorsarray [object]
Example: [{"path":"email","message":"Email has already been taken"},{"path":"password","message":"Password is too short (minimum is 8 characters)"}]
pathstring
The property path that failed validation
messagestring
The full error message