User Management
This endpoint group provides functionalities for managing users within a subscription, including creation, updates, deletion, and retrieval.
Endpoints
POST /api/rpc (Method: UserManagerRpc.create)
Description: Creates a new user within the current subscription (invite flow).
Request Body:
{ "method": "UserManagerRpc.create", "params": { "email": "string", "username": "string", "role": "string", "firstName": "string", "lastName": "string" } }Parameters:
Name Type Required Description emailStringYes Globally unique email for the user. usernameStringYes Unique username within a subscription. Must be at least 3 characters long. roleStringYes The role assigned to the user within their subscription. firstNameStringYes lastNameStringYes Response:
{ "success": true, "data": { "_id": "string", "email": "string", "subscriptionId": "string", "serviceCode": "string", "username": "string", "firstName": "string", "lastName": "string", "role": "string", "isActive": "boolean", "isVerified": "boolean", "isPhoneVerified": "boolean", "onboardingCompleted": "boolean", "oauthProfiles": [], "createdAt": "Date", "updatedAt": "Date" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "UserManagerRpc.create", "params": { "email": "[email protected]", "username": "newuser", "role": "member", "firstName": "New", "lastName": "User" } }'
POST /api/rpc (Method: UserManagerRpc.update)
Description: Updates a user's details within the current subscription.
Request Body:
{ "method": "UserManagerRpc.update", "params": { "userId": "string", "updates": { "username": "string", "firstName": "string", "lastName": "string", "role": "string", "isActive": "boolean", "jobTitle": "string", "department": "string" } } }Parameters:
Name Type Required Description userIdStringYes The MongoDB _id of the user to update. updates.usernameStringNo Unique username within a subscription. Must be at least 3 characters long. updates.firstNameStringNo updates.lastNameStringNo updates.roleStringNo The role assigned to the user within their subscription. updates.isActiveBooleanNo Indicates if the user account is active. updates.jobTitleStringNo updates.departmentStringNo Response:
{ "success": true, "data": { "_id": "string", "email": "string", "subscriptionId": "string", "serviceCode": "string", "username": "string", "firstName": "string", "lastName": "string", "role": "string", "isActive": "boolean", "isVerified": "boolean", "isPhoneVerified": "boolean", "onboardingCompleted": "boolean", "oauthProfiles": [], "createdAt": "Date", "updatedAt": "Date" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "UserManagerRpc.update", "params": { "userId": "654321098765432109876543", "updates": { "firstName": "Updated", "role": "admin" } } }'
POST /api/rpc (Method: UserManagerRpc.delete)
Description: Deletes a user from the current subscription.
Request Body:
{ "method": "UserManagerRpc.delete", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes The MongoDB _id of the user to delete. Response:
{ "success": true, "data": { "success": "boolean" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "UserManagerRpc.delete", "params": { "_id": "654321098765432109876543" } }'
POST /api/rpc (Method: UserManagerRpc.findById)
Description: Retrieves a specific user by their ID from the current subscription.
Request Body:
{ "method": "UserManagerRpc.findById", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes The MongoDB _id of the user to retrieve. Response:
{ "success": true, "data": { "_id": "string", "email": "string", "subscriptionId": "string", "serviceCode": "string", "username": "string", "firstName": "string", "lastName": "string", "role": "string", "isActive": "boolean", "isVerified": "boolean", "isPhoneVerified": "boolean", "onboardingCompleted": "boolean", "oauthProfiles": [], "createdAt": "Date", "updatedAt": "Date" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "UserManagerRpc.findById", "params": { "_id": "654321098765432109876543" } }'
POST /api/rpc (Method: UserManagerRpc.getData)
Description: Retrieves a list of all users within the current subscription.
Request Body:
{ "method": "UserManagerRpc.getData", "params": { "filter": {}, "sort": {}, "page": "number", "pageSize": "number" } }Parameters:
Name Type Required Description filterObjectNo sortObjectNo pageNumberNo pageSizeNumberNo Response:
{ "success": true, "data": { "data": [ { "_id": "string", "email": "string", "subscriptionId": "string", "serviceCode": "string", "username": "string", "firstName": "string", "lastName": "string", "role": "string", "isActive": "boolean", "isVerified": "boolean", "isPhoneVerified": "boolean", "onboardingCompleted": "boolean", "oauthProfiles": [], "createdAt": "Date", "updatedAt": "Date" } ], "totalCount": "number", "page": "number", "pageSize": "number" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "UserManagerRpc.getData", "params": { "page": 1, "pageSize": 10 } }'