---
schema_version: "1"
id: 310670278d006f1230098ddae0b7f31e4255c830460cca2455e9e1e60e14c974
title: End a Bot Session
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/bot-api/einstein-bot/guides/sdk/sdk-basic-bot-client-end-session.md
canonical_url: https://developer.salesforce.com/docs/service/einstein-bot-api/guide/sdk-basic-bot-client-end-session.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3c126f72f06892f449a2bd23d8ccb338921669a5221574029e90232e255648fb
products:
  - Einstein Bots API and SDK
  - Enstein Bot API and SDK
---
# End a Bot Session

If the bot has no more actions to take, the customer can end the session.

```java
// Build the request to end the bot session.
BotEndSessionRequest botEndSessionRequest = BotRequest
    .withEndSession(EndSessionReason.USERREQUEST).build();

// Retrieve the RuntimeSessionId from the sessionId returned by the bot when
// the session starts.
RuntimeSessionId runtimeSessionId = new RuntimeSessionId(sessionId);

// Send the request to the bot to end the session.
BotResponse endSessionResponse = client
    .endChatSession(config, runtimeSessionId, botEndSessionRequest);
```

Here’s an example of a text output from the bot’s response when the session ends.

```bash
// Response output
The chat session ended with reason: ClientRequest
```
