Skip to main content

Update User

This endpoint allows you to update an existing user's information. Only the fields you provide will be modified, while others remain unchanged.

πŸ”Ή Endpoint Details​

PUT /api/v1/users/{id}

πŸ”’ Authentication​

HeaderRequiredDescription
Content-TypeYesMust be application/json
AuthorizationYesFormat: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature

πŸ“ Request Structure​

Path Parameters​

ParameterTypeRequiredDescriptionExample
idstring (UUID)YesUnique identifier of the user550e8400-e29b-41d4-a716-446655440000

Updatable Fields​

FieldTypeRequiredDescriptionExample
firstNamestringNoNew first name"Johnny"
lastNamestringNoNew last name"Doe"
roleenumNoNew user role"editor"
avatarstringNoNew avatar URL"https://example.com/avatars/new.jpg"
userGroupIdstringNoNew group association"123e4567-e89b-12d3-a456-426614174000"

🧩 Request Example​

curl -X PUT "https://openapi.onlive.site/api/v1/users/550e8400-e29b-41d4-a716-446655440000" \
-H "Content-Type: application/json" \
-H "Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature" \
-d '{
"firstName": "Johnny",
"role": "editor",
"avatar": "https://example.com/avatars/johnny.jpg",
"userGroupId": "123e4567-e89b-12d3-a456-426614174000"
}'

πŸ“€ Response Format​

Successful Response (200 OK)​

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"firstName": "Johnny",
"lastName": "Doe",
"email": "[email protected]",
"role": "editor",
"avatar": "https://example.com/avatars/johnny.jpg",
"organizationId": "123e4567-e89b-12d3-a456-426614174000",
"userGroupId": "123e4567-e89b-12d3-a456-426614174000",
"fullName": "Johnny Doe",
"createdAt": "2025-05-22T10:30:00Z",
"updatedAt": "2025-05-22T11:15:00Z"
}

❌ Error Responses​

400 Bad Request​

{
"statusCode": 400,
"message": "Invalid input",
"errors": [
{
"field": "role",
"message": "must be one of: creator, editor, admin"
}
]
}

401 Unauthorized​

{
"statusCode": 401,
"message": "Invalid or missing authorization credentials"
}

404 Not Found​

{
"statusCode": 404,
"message": "User not found"
}

πŸ“˜ Notes​

  • Only include fields you want to update in the request body
  • Email address cannot be updated through this endpoint
  • The fullName is automatically updated when name fields change
  • The updatedAt timestamp is automatically updated
  • Omitted fields retain their current values
  • You can only update users within your organization
  • Role changes may affect user permissions immediately

βœ… Common Use Cases​

  • πŸ“ Profile Update: Change user's personal information
  • πŸ”„ Role Change: Promote or modify user permissions
  • πŸ‘₯ Group Transfer: Move user to different group
  • πŸ–ΌοΈ Avatar Update: Change profile picture
  • πŸ” Access Control: Adjust user roles and permissions

πŸ” Update Restrictions​

  1. Immutable Fields

    • Email address
    • Organization ID
    • Creation timestamp
    • User ID
  2. Role Changes

    • Must have appropriate permissions
    • Limited to available roles
    • Immediate effect on permissions
  3. Group Changes

    • User can belong to only one group
    • Previous group association is replaced
    • Group must exist in same organization

🏷️ Field Validation​

  1. Names

    • Minimum length: 1 character
    • Maximum length: 100 characters
    • Special characters allowed
  2. Avatar URL

    • Must be HTTPS
    • Maximum length: 2048 characters
    • Must be accessible URL
  3. Role

    • Must be valid role: creator, editor, admin
    • Case sensitive
    • Cannot assign root role