> ## 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.

# Close Omnichannel Room

> If you are an Omnichannel user (agent, manager), use this endpoint to close the room.

## OpenAPI

````json POST /api/v1/livechat/room.closeByUser
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Omnichannel"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "Omnichannel Users"
    },
    {
      "name": "Omnichannel Agents"
    },
    {
      "name": "Omnichannel Monitors"
    },
    {
      "name": "Omnichannel Visitors"
    },
    {
      "name": "Omnichannel Contacts"
    },
    {
      "name": "Omnichannel Rooms"
    },
    {
      "name": "Omnichannel Departments"
    },
    {
      "name": "Omnichannel Custom Fields"
    },
    {
      "name": "Omnichannel Business Hours"
    },
    {
      "name": "Omnichannel Priorities"
    },
    {
      "name": "Omnichannel Tags"
    },
    {
      "name": "Omnichannel Units"
    },
    {
      "name": "SLA Policies"
    },
    {
      "name": "Canned Responses"
    },
    {
      "name": "Omnichannel Transcript"
    },
    {
      "name": "Omnichannel Statistics"
    },
    {
      "name": "Omnichannel Agent Stats"
    },
    {
      "name": "Omnichannel Dashboards"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Omnichannel Inquiries"
    },
    {
      "name": "Omnichannel Webhooks"
    },
    {
      "name": "Livechat"
    },
    {
      "name": "Livechat Appearance"
    },
    {
      "name": "Livechat Triggers"
    },
    {
      "name": "Livechat Messages"
    },
    {
      "name": "Livechat Page Visited"
    }
  ],
  "paths": {
    "/api/v1/livechat/room.closeByUser": {
      "post": {
        "summary": "Close Omnichannel Room",
        "description": "If you are an Omnichannel user (agent, manager), use this endpoint to close the room.",
        "operationId": "post-api-v1-livechat-room.closeByUser",
        "parameters": [
          {
            "$ref": "#/components/parameters/AuthToken"
          },
          {
            "$ref": "#/components/parameters/UserId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/trueSuccess"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Invalid parameter": {
                    "value": {
                      "success": "false",
                      "error": "must have required property 'rid' [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  },
                  "Room already closed": {
                    "value": {
                      "success": "false",
                      "error": "error-room-already-closed"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        },
        "tags": [
          "Omnichannel Rooms"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "rid"
                ],
                "properties": {
                  "rid": {
                    "type": "string",
                    "description": "Enter the room ID.",
                    "example": "8ceKgWvo5qT5TrCRN"
                  },
                  "comment": {
                    "type": "string",
                    "description": "Add a description for closing the room. It is required when the [`Request comment when closing conversation`](https://docs.rocket.chat/docs/omnichannel-admins-guide) setting is enabled."
                  },
                  "forceClose": {
                    "type": "boolean",
                    "description": "Use this parameter to forcefully close a room. Before using this parameter, make sure to enable the [`Force Close Conversation API`](https://docs.rocket.chat/v1/docs/omnichannel-admins-guide#api) setting in **Manage > Workspace > Settings > Omnichannel > API**. Exercise caution when using this parameter and reserve it for situations involving misconfigured rooms."
                  },
                  "tags": {
                    "type": "array",
                    "description": "Add [tags](https://docs.rocket.chat/docs/tags).",
                    "items": {
                      "type": "string"
                    }
                  },
                  "generateTranscriptPdf": {
                    "type": "boolean",
                    "description": "Enter whether you want to generate a conversation transcript PDF."
                  },
                  "transcriptEmail": {
                    "type": "object",
                    "properties": {
                      "sendToVisitor": {
                        "type": "boolean",
                        "description": "Enter whether you want to send the transcript to the visitor."
                      },
                      "requestData": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string",
                            "description": "Enter the visitor's email ID to whom you want to send the transcript."
                          },
                          "subject": {
                            "type": "string",
                            "description": "Enter a subject for the email."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "Example": {
                  "value": {
                    "rid": "8ceKgWvo5qT5TrCRN",
                    "comment": "close via API",
                    "tags": [
                      "abc",
                      "abc"
                    ],
                    "transcriptEmail": {
                      "sendToVisitor": "true",
                      "requestData": {
                        "email": "test@example.com",
                        "subject": "transcript"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "AuthToken": {
        "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": {
      "trueSuccess": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                }
              }
            },
            "examples": {
              "Success": {
                "value": {
                  "success": "true"
                }
              }
            }
          }
        }
      },
      "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."
                }
              }
            }
          }
        }
      }
    }
  }
}
````

