> For the complete documentation index, see [llms.txt](https://docs.chatlayer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatlayer.ai/~/changes/zWOY8fNiBBrqneKkuGvA/bot-answers/session.md).

# Session

The session is the data that is stored for a particular user. A session can span multiple conversations.

You can configure how long this data is kept in the [data retention](/~/changes/zWOY8fNiBBrqneKkuGvA/bot-answers/settings/data-retention.md) settings.

## Default session data

The following data is available for all sessions. An easy way to preview this data is through the debugger in the 'test your bot' window.

### Read-only session data

```json
{
   "botId":"1457",
   "sessionId":"emulator-f28feb19-9d00-426a-ac65-539d5e1d3a73",
   "version":"DRAFT",
   "channel":"web",
   "user":{
      "firstName":"Guest"
   },
   "preferredLanguage":"en",
   "locale":"en-us",
   "nlp":{
      "expression":"hi",
      "intent":{
         "name":"Greeting",
         "score":1
      },
      "entities":[
         0
      ],
      "intents":[
         {
            "name":"Greeting",
            "score":1
         }
      ],
      "sentiment":{
         "name":"positive",
         "score":0.5183199216644359
   }
   "currentDialogstate":{
      "name":"introduction",
      "id":"25b838ca-0fea-4b97-b91e-31bd8d932cf9",
      "type":"MESSAGE"
   }
   "previousDialogstate":{
      "name":"introduction",
      "id":"25b838ca-0fea-4b97-b91e-31bd8d932cf9",
      "type":"MESSAGE"
   }
}
```

| Property            | Value  | Description                                                                                                            |
| ------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------- |
| botId               | string | ID of the bot                                                                                                          |
| sessionID           | string | ID of the session                                                                                                      |
| version             | string | version of the session                                                                                                 |
| channel             | string | channel of the session                                                                                                 |
| user                | object | object containing information about the user                                                                           |
| preferredLanguage   | string | preferred language of the user                                                                                         |
| locale              | string | preferred locale of the user (for example for date formatting)                                                         |
| nlp                 | object | object containing data about the latest expression, and which intent and entities were detected, with which confidence |
| nlp.sentiment       | object | shows the sentiment analysis score of an expression                                                                    |
| currentDialogstate  | object | show the name, id and type of the current bot dialog the user is in                                                    |
| previousDialogstate | object | show the name, id and type of the previous bot dialog the user was in                                                  |

### User-changeable session data

The builder of the bot can create and save [variables](/~/changes/zWOY8fNiBBrqneKkuGvA/bot-answers/settings/secure-variables-gdpr.md) to the user session. This data can be created by the bot through a conversation, or retrieved through an API call. Objects, as well as strings and other types of values can be saved to the user session.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chatlayer.ai/~/changes/zWOY8fNiBBrqneKkuGvA/bot-answers/session.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
