# Variables

The Variables endpoint can be used to retrieve all or a subset of a specific conversation variables.

{% hint style="warning" %}
This endpoint is not mean to be used to continuously retrieve conversation exchange state in realtime by polling. Requests made to the same conversation id are throttled to a 15 minutes window.
{% endhint %}

### Request

The following request can be used to retrieve a bot audiences:

```bash
curl --location --request GET 'https://publicapi.xenioo.com/peoples/conversations/variables/<ID>/<FIELDS>' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
```

The ID parameter can be either a conversation id or a user id while the FIELDS parameter can be either a wildcard (\*) or a comma separated list of variable names.

To request all variables for a conversations with ID equal to 12345, the call would look like this:

```bash
curl --location --request GET 'https://publicapi.xenioo.com/peoples/conversations/variables/12345/*' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
```

To request instead just the user email, it would look like this:

```bash
curl --location --request GET 'https://publicapi.xenioo.com/peoples/conversations/variables/12345/user_email' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
```

Or, instead, to request user email and phone number, it would look like this:

```bash
curl --location --request GET 'https://publicapi.xenioo.com/peoples/conversations/variables/12345/user_email,user_phone_number' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' 
```

### Response

If the call is successful, the complete list of selected variables will be returned.&#x20;

```bash
{
    "first_name":"...",
    "last_contact_day":"...",
    [...]
}
```

### Response Codes

This endpoint will reply with the following standard HTTP codes.

| Code | Meaning                                                                                                                                                     |
| ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | Ok. The request has been successfully fulfilled.                                                                                                            |
| 400  | Bad Request. The call does not contain the data required to be fulfilled or you attempted to access the same conversation during the 15 minutes throttling. |
| 401  | Unauthorized. The account associated to the token is not authorized                                                                                         |
