> ## 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 Chat or Perform Handover

> Close a chat session or perform handover. The appropriate endpoint URL including the `appId` for  closing chat or perfoming handover in your workspace is displayed under **App Info > Details > APIs > POST incoming** section of the Rasa app.

### Changelog
| Version      | Description |
| ---------------- | ------------|
|5.0.0     | Added       |

## OpenAPI

````json POST /api/apps/public/{app-id}/incoming
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Miscellaneous"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "paths": {
    "/api/apps/public/{app-id}/incoming": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "app-id",
          "in": "path",
          "required": "true",
          "description": "The app id. Navigate to App Info > Details > APIs > POST incoming to get the complete URL for this endpoint."
        }
      ],
      "post": {
        "summary": "Close Chat or Perform Handover",
        "tags": [
          "Rasa App"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "msg": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Close chat": {
                    "value": {
                      "msg": " Close chat request handled successfully"
                    }
                  },
                  "Perform handover": {
                    "value": {
                      "msg": " Perform Handover request handled successfully"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        },
        "operationId": "post-api-apps-public-app-id-incoming",
        "description": "Close a chat session or perform handover. The appropriate endpoint URL including the `appId` for  closing chat or perfoming handover in your workspace is displayed under **App Info > Details > APIs > POST incoming** section of the Rasa app.\n\n### Changelog\n| Version      | Description |\n| ---------------- | ------------|\n|5.0.0     | Added       |",
        "parameters": [
          {
            "$ref": "#/components/parameters/Auth-Token"
          },
          {
            "$ref": "#/components/parameters/UserId"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "action",
                  "sessionId"
                ],
                "properties": {
                  "action": {
                    "type": "string",
                    "description": "The action can either be `handover` or `close-chat`. "
                  },
                  "sessionId": {
                    "type": "string",
                    "description": "The ID of the Rasa session."
                  },
                  "actionData": {
                    "type": "object",
                    "properties": {
                      "targetDepartment": {
                        "type": "string",
                        "description": "The targeted department."
                      }
                    }
                  }
                }
              },
              "examples": {
                "Example": {
                  "value": {
                    "action": "close-chat",
                    "sessionId": "2Sfq8wXw4fYPMf6r4"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "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."
                }
              }
            }
          }
        }
      }
    },
    "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"
      }
    }
  }
}
````

