Skip to main content

Create User V2

info

Advanced API is available in the Business Plan


https://api.deadsimplechat.com/consumer/api/v2/user

Create User V2

The Create user v2 endpoint allows creation of users, and you can also assign the user roles and make the user member of the chat room at the time of creation.

info

The auth query parameter is your private key. You can find it in your Dashboard under Developer -> Private Key.

Create User V2 DetailsDescription
Query Parameters
authstringGo to Dashboard -> Developer -> Private Key is your auth Key
Body
uniqueUserIdentifierstringA unique identification for the user across all chat rooms. It can be an ID you use in your application for this user. This is also useful for logging the user into the chat room.
usernamestringUsername of the user.
firstNamestringFirst name of the user.
lastNamestringLast name of the user.
emailstringEmail address to associate with the user.
metastringAny metadata you want to attach to the user.
externalProfilePicURLstringURL of the profile picture you want to associate with the user. The URL should be HTTPS.
membershipDetailsobjectContains details about the user's membership in a specific chat room. This object contains two fields: roleName (a string which can be one of the following values: admin, moderator, guest, user) and roomId (a string indicating the room's unique ID). It is optional and can be used to specify user's role in a room.

Notes:

  • The uniqueUserIdentifier is distinct from the externalUserId used in the basic API. No two users within the same account can have the same uniqueUserIdentifier.
  • All string fields should be sanitized before use to prevent potential security issues.

Responses

200

JSON
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWNjZXNzIjp0cnVlLCJ1c2VyIjp7Il9pZCI6IjY1MGIzNGJmMWQ2NjAzMWNmNmMyMjA1NyIsInVuaXF1ZVVzZXJJZGVudGlmaWVyIjoiMzA0YWE4ZjAtYzQyNC00MDcyLWJjMTUtZDY1MDE2NDVkOGFhIiwidXNlcm5hbWUiOiJBbGV4YW5lMzkiLCJmaXJzdE5hbWUiOiJNZWtoaSIsImxhc3ROYW1lIjoiU2tpbGVzIiwiZW1haWwiOiJqb3NlM0B5YWhvby5jb20iLCJtZXRhIjoibWV0YWRhdGFfaW5mbyIsInByb2ZpbGVQaWMiOiJodHRwczovL2Nkbi5mYWtlcmNsb3VkLmNvbS9hdmF0YXJzL2dvbnphbG9yb2JhaW5hXzEyOC5qcGciLCJwYXJlbnRDdXN0b21lckFjY291bnQiOiI2NDhlMWZkMTgxY2VhMjBiZDhiMTU4MWIiLCJwcm92aXNpb25lZCI6dHJ1ZSwiY3JlYXRlZCI6IjIwMjMtMDktMjBUMTg6MDY6NTUuNTI4WiIsInVwZGF0ZWQiOiIyMDIzLTA5LTIwVDE4OjA2OjU1LjUyOFoiLCJfX3YiOjB9LCJtZW1iZXJzaGlwRGV0YWlscyI6eyJyb2xlTmFtZSI6InVzZXIiLCJyb29tSWQiOiIyMUN4SlVsblgifSwiYWNjZXNzVG9rZW5JZCI6ImFjODAwNTgwLWVmZjktNGIyMC04YjhkLTY1NTlhZDI4MzYzYiIsImlhdCI6MTY5NTIzMzIxNX0.lu-3-N-SvanC6HRnvdcuoHN3IcPYCn4CM6qaV658eXY",
"success": true,
"user": {
"_id": "650b34bf1d66031cf6c22057",
"uniqueUserIdentifier": "304aa8f0-c424-4072-bc15-d6501645d8aa",
"username": "Alexane39",
"firstName": "Mekhi",
"lastName": "Skiles",
"email": "jose3@yahoo.com",
"meta": "metadata_info",
"profilePic": "https://cdn.fakercloud.com/avatars/gonzalorobaina_128.jpg",
"parentCustomerAccount": "648e1fd181cea20bd8b1581b",
"provisioned": true,
"created": "2023-09-20T18:06:55.528Z",
"updated": "2023-09-20T18:06:55.528Z",
"__v": 0
},
"membershipDetails": {
"roleName": "user",
"roomId": "21CxJUlnX"
}
}

400

Error responses will provide the nature of the error, such as invalid API key or validation errors.

JSON
{
"success": false,
"message": "Error message text here.",
"error": "Detailed error message or object (if available)"
}

Note: In case of errors, the error messages or objects returned will provide insights into what went wrong during the request.