RealTimeX
Start For Free

RealTimeX

API Documentation

IntroductionAuthenticationBase URLHeadersError codes
List usersLoginGet userUpdate userDelete userGet my profileUpdate my profileBlock / unblock
Sample requestsSample responsesStatus codesAppendixChangelog

API Reference

Update My Profile

Overview

Partially update the signed-in chat participant's own profile. Identity comes from the Bearer token — no path id is required.

Editable fields:

  • name
  • profileImage
  • metadata

Provide at least one of name or profileImage. Use this from chat settings for display name and avatar. For another user's email or role, use Update User. For Platform client branding, use Platform → Update Profile.

When to use this endpoint?

Use Update My Profile when:

  • The chat participant renames themselves in settings (name only).
  • They change their chat avatar URL (profileImage only).
  • They store chat preferences in metadata (theme, locale, and so on).
  • Chat settings saves several of the fields above in one request.

Part of the Chat User APIs. An empty body or a body without name / profileImage returns 400.

Editable Fields

FieldTypeRequiredDescription
namestringOptionalNew display name. At least one of name or profileImage must be present.
profileImagestring | nullOptionalAvatar image URL. Send null to clear if supported by your client.
metadataobjectOptionalArbitrary key-value map for preferences and app-specific data.

Single-Field Updates

Examples for updating one concern at a time:

Name only

json
{
  "name": "New Name"
}

Profile image only

json
{
  "profileImage": "https://example.com/profile-image.png"
}

Metadata (with a name or image also required by validation)

json
{
  "metadata": {
    "theme": "dark"
  }
}
PATCH{baseUrl}/api/{apiVersion}/user/profile/me

Authentication

Required (Bearer token)

Tenant-scoped

Yes (tenant DB — requires x-client-id)

Request Headers

HeaderValueDescription
AuthorizationBearer <access_token>Chat user Access Token (Bearer) for the signed-in messaging participant.
is-tenanttrueTargets the tenant DB ("true", needs x-client-id).
x-client-id{{clientId}}Tenant (client) id. Required when is-tenant=true.
Content-Typeapplication/jsonJSON request body.

Request Payload

Combined example updating name, avatar, and metadata:

json
{
  "name": "New Name",
  "profileImage": "https://example.com/profile-image.png",
  "metadata": {
    "theme": "dark"
  }
}

Success Response (HTTP 200 OK)

On success, the API returns the updated profile summary.

json
{
  "success": true,
  "message": "Profile updated successfully",
  "data": {
    "_id": "6a58...90d",
    "name": "New Name",
    "email": "will.smith@example.com",
    "role": "user",
    "profileImage": "https://example.com/profile-image.png"
  },
  "error": null
}

Common Errors

Profile update fails when nothing is provided to update or the token is missing.

HTTP 400 Bad Request — Nothing to update

json
{
  "success": false,
  "message": "Provide at least one of: name, profileImage",
  "data": null,
  "error": null
}

HTTP 401 Unauthorized — No token

json
{
  "success": false,
  "message": "No token, authorization denied",
  "data": null,
  "error": "Unauthorized"
}
CodeReason
400 Bad RequestProvide at least one of name or profileImage.
401 UnauthorizedAccess Token is missing, invalid, or expired.
500 Internal Server ErrorAn unexpected error occurred while updating the profile.

Best Practices

  • Upload the avatar to storage first, then send the public URL as profileImage.
  • Prefer single-field saves from chat settings for clearer UX.
  • Refresh the chat shell avatar and name from the success response.
  • Always send tenant headers with the chat user Bearer token over HTTPS.

Chat profile updated

Update the chat header and sidebar from the response, or call Get My Profile again if your client prefers a separate reload.

PreviousGet my profileNextBlock / unblock

On this page

OverviewWhen to use this endpoint?Editable FieldsSingle-Field UpdatesRequest HeadersRequest PayloadSuccess ResponseCommon ErrorsBest Practices