MessagesMessagesUnpin Message

Unpin a Message

Overview

This endpoint allows chatroom owners or administrators to unpin the currently pinned message, removing it from the top of the chatroom.


API Endpoint

Unpin a Message

Unpin the currently pinned message and remove it from the top of the chatroom.

DELETE /messages/:id/pin

Headers

ParameterTypeRequiredDescription
IM-CLIENT-KEYstringClient Key
IM-AuthorizationstringClient Token

Path Parameters

ParameterTypeRequiredDescription
:idstringMessage unique ID

This API does not require a Request Body.

Example Request

cURL Example:

curl -X "DELETE" "https://your-app.imkit.io/messages/5f890cf37d980e06f6aaf349/pin" \
     -H 'IM-CLIENT-KEY: {IM-CLIENT-KEY}' \
     -H 'IM-Authorization: {IM-Authorization}'

JavaScript Example:

const response = await axios.delete(
  `https://your-app.imkit.io/messages/${messageID}/pin`,
  {
    headers: {
      "IM-CLIENT-KEY": `${IM_CLIENT_KEY}`,
      "IM-Authorization": `${TOKEN}`,
    },
  }
);

Response

Success Response (200 OK)

ParameterTypeDescription
RCnumberResponse code (0 indicates success)
RMstringResponse message
result._idstringMessage unique ID
result.messagestringMessage content
result.roomstringAssociated chatroom ID
result.senderobjectMessage sender information
result.messageTypestringMessage type
result.pinnedbooleanWhether the message is pinned (false after unpinning)
result.messageTimeMSnumberMessage sent timestamp (milliseconds)
result.updatedAtMSnumberLast updated timestamp (milliseconds)

Example Response

{
  "RC": 0,
  "RM": "OK",
  "result": {
    "_id": "5f890cf37d980e06f6aaf349",
    "message": "重要公告:明天下午兩點開會",
    "room": "demo-room",
    "sender": {
      "_id": "aaa",
      "nickname": "AAA",
      "avatarUrl": "http://loremflickr.com/240/240/style?1569804629",
      "isRobot": false,
      "id": "aaa",
      "lastLoginTimeMS": 1602817267900
    },
    "messageType": "text",
    "appID": "SampleApp",
    "pinned": false,
    "id": "5f890cf37d980e06f6aaf349",
    "messageTimeMS": 1602817267923,
    "updatedAtMS": 1602817300000,
    "createdAtMS": 1602817267925
  }
}

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 message does not exist
  • The current user is not the chatroom owner or administrator
  • Internal server error

Use Cases

Message Management

  • Remove Outdated Announcements: Unpin messages that are no longer relevant to keep the chatroom organized
  • Replace Pinned Content: Unpin an old message to pin a new important message

Notes

  • Permission Restriction: Only chatroom owners or admins can perform the unpin operation
  • To pin a message, use the Pin a Message API
© 2026 FUNTEK Software Inc. All rights reserved.