> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.
# Pin Message
> Pin a chat message to the channel.
### Changelog
| Version | Description |
| ------------ | ------------|
| 0.59.0 | Added |
## OpenAPI
````json POST /api/v1/chat.pinMessage
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Messaging"
},
"servers": [
{
"url": "https://apiexplorer.support.rocket.chat"
}
],
"tags": [
{
"name": "Chat"
},
{
"name": "Direct Messages"
},
{
"name": "Auto-Translate"
}
],
"paths": {
"/api/v1/chat.pinMessage": {
"post": {
"tags": [
"Chat"
],
"summary": "Pin Message",
"description": "Pin a chat message to the channel.\n\n### Changelog\n| Version | Description | \n| ------------ | ------------|\n| 0.59.0 | Added |",
"operationId": "post-api-v1-chat.pinMessage",
"parameters": [
{
"$ref": "#/components/parameters/Auth-Token"
},
{
"$ref": "#/components/parameters/UserId"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"messageId": {
"type": "string",
"description": "The message ID that you want to pin."
}
},
"required": [
"messageId"
]
},
"examples": {
"Example": {
"value": {
"messageId": "7aDSXtjMA3KPLxLjt"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"t": {
"type": "string"
},
"rid": {
"type": "string"
},
"ts": {
"type": "string"
},
"msg": {
"type": "string"
},
"u": {
"type": "object",
"properties": {
"_id": {
"type": "string"
},
"username": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"groupable": {
"type": "boolean"
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"author_name": {
"type": "string"
},
"author_icon": {
"type": "string"
},
"ts": {
"type": "string"
},
"attachments": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
},
"_updatedAt": {
"type": "string"
}
}
},
"success": {
"type": "boolean"
}
}
},
"examples": {
"Example 1": {
"value": {
"message": {
"_id": "651f23c0a2f73c7460e18d1a",
"t": "message_pinned",
"rid": "6GFJ3tbmHiyHbahmC",
"ts": "2023-10-05T20:59:44.503Z",
"msg": "",
"u": {
"_id": "5fRTXMt7DMJbpPJfh",
"username": "test.test",
"name": "Testtest"
},
"groupable": "false",
"attachments": [
{
"text": "hola",
"author_name": "roxie",
"author_icon": "/avatar/roxie",
"ts": "2023-10-05T20:30:51.052Z",
"attachments": []
}
],
"_updatedAt": "2023-10-05T20:59:44.521Z"
},
"success": "true"
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/authorizationError"
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"error": {
"type": "string"
},
"errorType": {
"type": "string"
}
}
},
"examples": {
"Example 1": {
"value": {
"success": "false",
"error": "The required \"messageId\" param is missing. [error-messageid-param-not-provided]",
"errorType": "error-messageid-param-not-provided"
}
},
"Example 2": {
"value": {
"success": "false",
"error": "The provided \"messageId\" does not match any existing message. [error-message-not-found]",
"errorType": "error-message-not-found"
}
}
}
}
}
}
}
}
}
},
"components": {
"parameters": {
"Auth-Token": {
"name": "X-Auth-Token",
"in": "header",
"description": "The `authToken` of the authenticated user.",
"required": "true",
"schema": {
"type": "string"
},
"example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
},
"UserId": {
"name": "X-User-Id",
"in": "header",
"description": "The `userId` of the authenticated user.",
"required": "true",
"schema": {
"type": "string"
},
"example": "rbAXPnMktTFbNpwtJ"
}
},
"responses": {
"authorizationError": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"examples": {
"Authorization Error": {
"value": {
"status": "error",
"message": "You must be logged in to do this."
}
}
}
}
}
}
}
}
}
````