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

Login Client User

Overview

Sign a participant into your chat app by creating or resolving their chat user with name, email, and optional role or metadata. No Bearer token is required — tenant context comes from x-client-id.

On success, data is the chat user id. Use it for conversations, messages, profile, and other User endpoints in this section. This is not Platform client login (Auth → Login Client).

When to use this endpoint?

Use Login Client User when:

  • A visitor opens your embedded or standalone chat and needs a chat identity.
  • You onboard a messaging participant without the Platform register / password flow.
  • You need a stable user id before listing chats, opening a thread, or sending the first message.
  • You attach chat-side metadata (locale, device, department) at first login.

Part of the Chat User APIs. Always send valid tenant headers — an invalid x-client-id or is-tenant value is rejected.

POST{baseUrl}/api/{apiVersion}/user/login/client-user

Authentication

Not required

Tenant-scoped

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

Request Headers

HeaderValueDescription
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

Send identity fields for the chat participant. name and email are required; role and metadata are optional.

FieldTypeRequiredDescription
namestringRequiredDisplay name for the user.
emailstringRequiredUser email — used as a unique identity within the tenant.
rolestringOptionalTenant role slug (for example user). Defaults apply when omitted.
metadataobjectOptionalArbitrary key-value map for app-specific attributes (department, plan, external ids).
json
{
  "name": "Will Smith",
  "email": "will.smith@example.com",
  "role": "user",
  "metadata": {
    "department": "sales"
  }
}

Success Response (HTTP 201 Created)

On success, data is the new (or resolved) user id string.

json
{
  "success": true,
  "message": "User created successfully",
  "data": "694b76ab3d833c4b8a3f57d8",
  "error": null
}

Common Errors

Login / create fails when tenant headers are invalid or permissions block user creation.

HTTP 400 Bad Request — Invalid tenant

json
{
  "success": false,
  "message": "Invalid tenant ID or isTenant header",
  "data": null,
  "error": null
}

HTTP 403 Forbidden — Insufficient permissions

json
{
  "success": false,
  "message": "Access denied: insufficient permissions",
  "data": null,
  "error": null
}

HTTP 403 Forbidden — Error: banned by workspace admin

json
{
  "success": false,
  "message": "Your account has been banned by the workspace admin",
  "data": null,
  "error": null
}
CodeReason
400 Bad RequestInvalid tenant ID or is-tenant header, or missing required fields.
403 ForbiddenAccess denied: insufficient permissions to create the user.
500 Internal Server ErrorAn unexpected error occurred while provisioning the user.

Workflow

  1. 1

    Send chat identity

    From your chat app, send the participant’s name, email, optional role, and optional metadata.

  2. 2

    Chat user is ready

    RealtimeX creates or resolves the chat user in the tenant DB and returns their user id.

  3. 3

    Enter the chat session

    Store the returned id and use it as the signed-in chat participant for conversations, messages, profile, and block flows.

Best Practices

  • Persist the returned chat user id in your chat session storage; do not re-create on every reload when the same email is already known.
  • Default role to user for typical messaging participants unless your product needs custom roles.
  • Keep metadata keys stable so chat people-picker filters stay reliable.
  • Always send is-tenant and x-client-id over HTTPS.

Chat user ready

Store the returned id, then load chats with Conversation / Messages APIs, or open Get My Profile to hydrate the chat header.

PreviousList usersNextGet user

On this page

OverviewWhen to use this endpoint?WorkflowRequest HeadersRequest PayloadSuccess ResponseCommon ErrorsBest Practices