Users must exist in CometChat before they can make or receive calls. This page explains how to create and authenticate users for the Calls SDK.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.
Why User Sync?
CometChat needs to know about your users to:- Route calls — Connect callers to the right recipients
- Identify participants — Display names and avatars in calls
- Track history — Associate call logs with specific users
- Manage permissions — Control who can call whom
Creating Users
Choose the method that best fits your workflow:Dashboard
Add users manually via the CometChat Dashboard. Ideal for quick testing or small teams.
SDK
Create users programmatically via SDK methods. Perfect for auto-provisioning during sign-up.
REST API
Create users using the REST API. Best for batch imports or backend workflows.
User Requirements
Required Fields
| Field | Type | Description |
|---|---|---|
uid | String | Unique user identifier. Alphanumeric, max 100 characters. Must be unique across your app. |
Optional Fields
| Field | Type | Description |
|---|---|---|
name | String | Display name shown in calls and participant lists |
avatar | String | URL to profile image |
metadata | Object | Custom JSON data for your application |
role | String | User role (default, admin, etc.) |
tags | Array | Tags for categorization and filtering |
Example User Object
Authentication Flow
Create User (One-time)
Create the user in CometChat when they sign up for your app. This only needs to happen once per user.Server-side (recommended):
Generate Auth Token
Generate an authentication token for the user on your server. This token is used to log in the user on the client.Server-side:Response:
Login User (Client-side)
Use the auth token to log in the user via the SDK. This establishes a session for making calls.JavaScript:
Authentication Methods
Auth Token (Recommended for Production)
Generate tokens server-side using the REST API. This is the secure method for production apps. Pros:- Secure — API key never exposed to clients
- Controlled — You decide when tokens are issued
- Auditable — Token generation can be logged
- User logs into your app
- Your server generates a CometChat auth token
- Token is sent to the client
- Client uses token to log into CometChat
Auth Key (Development Only)
Use the Auth Key directly in client code for quick testing. Never use in production. JavaScript:Sync Strategies
Just-in-Time Provisioning
Create CometChat users when they first need calling functionality:Batch Import
Import existing users via REST API when integrating CometChat:Webhook Sync
Use webhooks to keep CometChat users in sync with your database:- User signs up → Create CometChat user
- User updates profile → Update CometChat user
- User deletes account → Delete CometChat user
User Lifecycle
Creating Users
Users can be created via:- REST API (server-side)
- SDK
createUsermethod - Dashboard (manual)
Updating Users
Update user details when they change in your app:Deleting Users
Remove users when they leave your platform:Soft Delete: By default, deleted users are soft-deleted and can be restored. Use
permanent=true query parameter for permanent deletion.Best Practices
Do
- Generate auth tokens server-side
- Use consistent UIDs across your app
- Keep user data in sync
- Handle token expiration gracefully
Don’t
- Expose API keys in client code
- Use Auth Key in production
- Create duplicate users
- Store auth tokens long-term
Next Steps
Compatibility
Check platform and browser support
REST API Reference
Full API documentation for user management