The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

End a Session

If the bot has no more actions to take, the customer can end the session with this DELETE endpoint. If the service client doesn’t end the chat session, the session stays open for 3 days and then times out. The <session-id> is the ID of the active session you want to end. The <HOST_URL> is the Runtime Base URL field found in the Add Connection dialog when you add the connected app to the bot. See Get Started with Einstein Bots API.

This section describes the endpoint for API version 5 only and can’t be used with earlier versions.

This example shows you how to send a request to end a bot session with this endpoint. Here the host URL is

The delete request header X-Session-End-Reason is required and must have one of these values.

  • UserRequest
  • Transfer
  • Expiration
  • Error
  • Other

After the client requests to end the session, the bot responds with a session-ended message. Here, the messages object in the response body has the sessionEnded message type.

Now that the chat session has ended, you can clean up any resources allocated to the service client.