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

Get User Details

Overview

Fetch a single chat user by their userId — for contact profiles, header chips, and participant details inside the messaging UI.

Returns core identity fields, role, and active status. When the path userId matches the signed-in user (same login user id), the payload also includes refreshToken. When you fetch someone else, that field is omitted.

When to use this endpoint?

Use Get User Details when:

  • Opening a contact profile sheet from a conversation or people picker.
  • Showing name / email on a chat header or message author popover.
  • Hydrating a group participant chip with a full user record.
  • Confirming a user still exists before starting a DM.

Part of the Chat User APIs (not Platform → Users). If path userId matches the logged-in user, refreshToken is included. For shell avatar/name without that token field, you can also use Get My Profile.

Response Data

The data object typically includes:

FieldDescription
_idUnique user id (same as the path userId).
nameDisplay name.
emailUser email address.
isActiveWhether the account is active in the tenant.
roleTenant role slug (for example user).
createdAt / updatedAtISO timestamps for when the record was created and last updated.
refreshTokenPresent only when the logged-in user id equals the path userId (fetching yourself). Omitted for other users.
GET{baseUrl}/api/{apiVersion}/user/:userId

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.

Path Parameters

ParameterExampleDescription
userId694b7ab37f8f05a7ac678b6bThe target user's _id (24-char Mongo ObjectId).

Success Response (HTTP 200 OK)

Both cases return HTTP 200. The shape of data depends on whether the path userId is the same as the logged-in user from the Access Token.

CaseConditionIncludes refreshToken?
Same login user id and user idPath userIdequals the signed-in user's idYes — data.refreshToken is returned
Different login user id and user idPath userId is another chat userNo — profile fields only (no refreshToken)

Success — Same login user id and user id

You requested your own id. The response includes refreshToken along with the profile fields.

json
{
  "success": true,
  "message": "User fetched successfully",
  "data": {
    "_id": "694b7ab37f8f05a7ac678b6b",
    "name": "Gomez",
    "email": "gomez@example.com",
    "isActive": true,
    "role": "user",
    "createdAt": "2025-12-24T05:31:31.606Z",
    "updatedAt": "2025-12-24T05:31:31.723Z",
    "refreshToken": <refresh_token>
  },
  "error": null
}

Success — Different login user id and user id

You requested another user's id (contact profile). refreshToken is not included.

json
{
  "success": true,
  "message": "User fetched successfully",
  "data": {
    "_id": "694b...8b6b",
    "name": "Gomez",
    "email": "gomez@example.com",
    "isActive": true,
    "role": "user",
    "createdAt": "2025-12-24T05:31:31.606Z",
    "updatedAt": "2025-12-24T05:31:31.723Z"
  },
  "error": null
}

Common Errors

Get fails when the token is missing, the user does not exist, or tenant headers are wrong.

HTTP 401 Unauthorized — No token

json
{
  "success": false,
  "message": "No token, authorization denied",
  "data": null,
  "error": "Unauthorized"
}

HTTP 404 Not Found — User missing

json
{
  "success": false,
  "message": "User not found",
  "data": null,
  "error": "User not found"
}
CodeReason
401 UnauthorizedAccess Token is missing, invalid, or expired.
404 Not FoundNo user exists for the given userId in this tenant.
500 Internal Server ErrorAn unexpected error occurred while fetching the user.

Best Practices

  • Validate userId is a 24-character ObjectId before calling the API.
  • Cache contact profiles briefly in the chat client; refetch when opening the profile sheet.
  • Treat refreshToken as sensitive — store it only when present (self-fetch). Never expect it on contact profiles.
  • Prefer Get My Profile for the signed-in shell avatar/name; use this endpoint when you need self refreshTokenor another user's public profile.
  • Always send tenant headers with the chat user Bearer token over HTTPS.

Contact profile ready

Render the contact in your chat profile sheet. From there, start a DM, add them to a group, or use Block / Unblock for safety actions.

PreviousLoginNextUpdate user

On this page

OverviewWhen to use this endpoint?Response DataRequest HeadersPath ParametersSuccess ResponseCommon ErrorsBest Practices