RoomsRoom MembersUpdate Member Property

Update Member Property

Overview

This endpoint allows you to update custom properties of a specific member in a room, such as role, location, score, level, or any custom field. This API is for server-side use only and requires proper authentication.


API Endpoint

Update Member Property

Update the custom properties of a specific member in a room.

PUT /rooms/:id/member/:client

Headers

ParameterTypeRequiredDescription
IM-CLIENT-KEYstringClient key
IM-AuthorizationstringClient token

Path Parameters

ParameterTypeRequiredDescription
:idstringRoom unique identifier
:clientstringMember’s client ID

Request Body

ParameterTypeRequiredDescription
propertystringName of the member property field to update
valuemixedNew value for the property

Example Request

Example 1: Set a member as administrator

cURL Example:

curl -X "PUT" "https://your-app.imkit.io/rooms/demo-room/member/user-001" \
     -H 'IM-CLIENT-KEY: {IM-CLIENT-KEY}' \
     -H 'IM-Authorization: {IM-Authorization}' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{"property": "role", "value": "admin"}'

JavaScript Example:

const response = await axios.put(
  `https://your-app.imkit.io/rooms/${roomID}/member/${clientID}`,
  {
    property: "role",
    value: "admin",
  },
  {
    headers: {
      "IM-CLIENT-KEY": `${IM_CLIENT_KEY}`,
      "IM-Authorization": `${TOKEN}`,
      "Content-Type": "application/json; charset=utf-8",
    },
  }
);

Example 2: Update a custom property

JavaScript Example:

const response = await axios.put(
  `https://your-app.imkit.io/rooms/${roomID}/member/${clientID}`,
  {
    property: "score",
    value: 100,
  },
  {
    headers: {
      "IM-CLIENT-KEY": `${IM_CLIENT_KEY}`,
      "IM-Authorization": `${TOKEN}`,
      "Content-Type": "application/json; charset=utf-8",
    },
  }
);

Response

Success Response (200 OK)

ParameterTypeDescription
RCnumberResponse code (0 indicates success)
RMstringResponse message
resultobjectComplete room information after the update

Example Response

{
  "RC": 0,
  "RM": "OK",
  "result": {
    "_id": "demo-room",
    "name": "Demo",
    "roomType": "group",
    "members": [
      {
        "_id": "user-001",
        "nickname": "User 001",
        "avatarUrl": "http://example.com/avatar.jpg",
        "isRobot": false,
        "id": "user-001",
        "lastLoginTimeMS": 1583057133276
      }
    ],
    "id": "demo-room",
    "createdTimeMS": 1525001412492
  }
}

Error Response

When a request fails, you will receive an error response containing error details. Common error scenarios include:

  • Invalid client key or authorization token
  • The specified room or member does not exist
  • Internal server error

Use Cases

Role Management

  • Assign administrator: Set property to "role" and value to "admin" to assign the administrator role

Custom Properties

  • Set score: Set property to "score" to track a member’s score in the room
  • Set level: Set property to "level" to manage member levels
  • Set location: Set property to "location" to record member location information

Notes

  • Role setting: When property is set to "role" and value is set to "admin", the system automatically generates an assignAdmin system message in the room
  • Custom properties: In addition to role, any custom property can be set, such as location (location), score (score), level (level), etc.
  • The property field directly maps to the field name in the member properties object, and the type of value should match the field definition
© 2026 FUNTEK Software Inc. All rights reserved.