Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
User object.
The typical flow:
- User registers in your app → Create user in CometChat
- User logs into your app → Log user into CometChat
User deletion is only available via the REST API — there is no client-side SDK method for it.
Creating a User
User creation should ideally happen on your backend via the REST API. For client-side creation (development only), usecreateUser():
- Dart
Parameters
| Parameter | Type | Description |
|---|---|---|
user | User | A User object containing the details of the user to be created. The uid and name fields are required. |
authKey | String | Your CometChat Auth Key. Use only for development — never expose in production client code. |
onSuccess | Function(User user) | Callback triggered on successful user creation, returning the created User object. |
onError | Function(CometChatException excep) | Callback triggered on failure, returning a CometChatException with error details. |
User object. See User Class for all available fields.
Response
Response
On Success — A
User object containing all details of the created user:User Object:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
uid | string | Unique identifier of the user | "usr1" |
name | string | Display name of the user | "Kevin" |
link | string | Profile link | null |
avatar | string | Avatar URL | null |
metadata | object | Custom metadata | {} |
status | string | Online status | "offline" |
role | string | User role | "default" |
statusMessage | string | Status message | null |
tags | array | List of tags associated with the user | [] |
hasBlockedMe | boolean | Whether this user has blocked the current user | false |
blockedByMe | boolean | Whether the current user has blocked this user | false |
lastActiveAt | number | Epoch timestamp of last activity | 0 |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | string | Error code identifier | "ERR_UID_NOT_FOUND" |
message | string | Human-readable error message | "The specified UID does not exist." |
details | string | Additional technical details | "Please provide a valid UID for the user." |
Updating a User
Like creation, user updates should ideally happen on your backend via the REST API. For client-side updates (development only), useupdateUser():
- Dart
User object has the correct UID set.
Parameters
| Parameter | Type | Description |
|---|---|---|
user | User | A User object with the uid of the user to update and the fields to change. |
apiKey | String | Your CometChat Auth Key. Use only for development — never expose in production client code. |
onSuccess | Function(User retUser) | Callback triggered on successful update, returning the updated User object. |
onError | Function(CometChatException excep) | Callback triggered on failure, returning a CometChatException with error details. |
User object. See User Class for all available fields.
Response
Response
On Success — A
User object containing all details of the updated user:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
uid | string | Unique identifier of the user | "usr1" |
name | string | Display name of the user | "Kevin Fernandez" |
link | string | Profile link | null |
avatar | string | Avatar URL | null |
metadata | object | Custom metadata | {} |
status | string | Online status | "offline" |
role | string | User role | "default" |
statusMessage | string | Status message | null |
tags | array | List of tags associated with the user | [] |
hasBlockedMe | boolean | Whether this user has blocked the current user | false |
blockedByMe | boolean | Whether the current user has blocked this user | false |
lastActiveAt | number | Epoch timestamp of last activity | 0 |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | string | Error code identifier | "ERR_UID_NOT_FOUND" |
message | string | Human-readable error message | "The specified UID does not exist." |
details | string | Additional technical details | "Please provide a valid UID for the user." |
Updating Logged-in User
UseupdateCurrentUserDetails() to update the current user without an Auth Key. Note: You cannot update the user’s role with this method.
- Dart
Parameters
| Parameter | Type | Description |
|---|---|---|
user | User | A User object with the fields to update. The uid is ignored — only the logged-in user is updated. |
onSuccess | Function(User retUser) | Callback triggered on successful update, returning the updated User object. |
onError | Function(CometChatException excep) | Callback triggered on failure, returning a CometChatException with error details. |
User object.
Response
Response
On Success — A
User object containing all details of the updated user:User Object:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
uid | string | Unique identifier of the user | "cometchat-uid-1" |
name | string | Display name of the user | "Updated Name" |
link | string | Profile link | null |
avatar | string | Avatar URL | "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp" |
metadata | object | Custom metadata | {} |
status | string | Online status | "online" |
role | string | User role | "default" |
statusMessage | string | Status message | null |
tags | array | List of tags associated with the user | [] |
hasBlockedMe | boolean | Whether this user has blocked the current user | false |
blockedByMe | boolean | Whether the current user has blocked this user | false |
lastActiveAt | number | Epoch timestamp of last activity | 1745554700 |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | string | Error code identifier | "ERR_UID_NOT_FOUND" |
message | string | Human-readable error message | "The specified UID does not exist." |
details | string | Additional technical details | "Please provide a valid UID for the user." |
updateCurrentUserDetails() method one can only update the logged-in user irrespective of the UID passed. Also, it is not possible to update the role of a logged-in user.
Deleting a User
User deletion is only available via the REST API.User Class
| Field | Editable | Information |
|---|---|---|
| uid | specified on user creation. Not editable after that | Unique identifier of the user |
| name | Yes | Display name of the user |
| avatar | Yes | URL to profile picture of the user |
| link | Yes | URL to profile page |
| role | Yes | User role of the user for role based access control |
| metadata | Yes | Additional information about the user as JSON |
| status | No | Status of the user. Could be either online/offline |
| statusMessage | Yes | Any custom status message that needs to be set for a user |
| lastActiveAt | No | The unix timestamp of the time the user was last active. |
| hasBlockedMe | No | A boolean that determines if the user has blocked the logged in user |
| blockedByMe | No | A boolean that determines if the logged in user has blocked the user |
| tags | Yes | A list of tags to identify specific users |
Next Steps
Retrieve Users
Fetch and filter user lists with pagination.
User Presence
Monitor real-time online/offline status.
Block Users
Block and unblock users.
Authentication
Log users into CometChat.