# How to Track Human Feedback

Keeping track of user feedback is a critical aspect of improving the quality of any AI system. With AI Assistants, there are two ways you can track feedback:

* [In the Simulator](#track-feedback-in-the-simulator): track your own feedback while developing your Assistants.
* [Via the API](#track-feedback-via-api): track feedback from your users once the Assistant is integrated into your application.

> \[!NOTE]
>
> The Feedback API currently supports **tracking** and **reading** feedback only. We recommend starting to track feedback now so it can be retroactively analyzed with upcoming analytical features.

## Track Feedback in the Simulator

As you are developing with AI Assistants, you can use the [Simulator](/docs/alpha/ai-assistants/simulator) to test your Assistant and understand what's happening behind the scenes.

When you encounter particularly good or bad responses, you can provide feedback about the response using the "thumbs up" and "thumbs down" controls below the message.

![AI Assistant message with thumbs up and down feedback options.](https://docs-resources.prod.twilio.com/5176009dc4accc8a782a28fbd96fc85ca1cc6b69b5868e3f552642fd79b8d20f.png)

## Track Feedback via API

When your Assistant is integrated into your own application, your customers are the best judges of the quality of its responses.

You can store user feedback collected from your application using the Feedback API. Feedback is represented in a `score` from `0` (worst possible message) to `1` (best possible message). You can use this as a binary, such as `thumbs down` = `0` and `thumbs up` = `1`, or introduce your own scale.

Additionally, you can include an optional `text` property with any notes attached to the feedback, such as whether an issue was resolved.

| Property     | Type                                                                          | Example            |
| ------------ | ----------------------------------------------------------------------------- | ------------------ |
| `session_id` | ID of the Assistant session where the user provided feedback.                 | "demo-session"     |
| `score`      | The score of the feedback `score` from 0 (worst) to 1 (best).                 | 1                  |
| `text`       | Notes to attach to the Feedback record, such as whether an issue was resolved | "problem resolved" |

Track feedback for entire session

```bash
ASSISTANT_SID=<your-assistant-sid>
curl -X POST -H 'Content-Type:application/json' \
  https://assistants.twilio.com/v1/Assistants/$ASSISTANT_SID/Feedbacks \
  -d '{"session_id":"demo", "score": 1, "text": "problem resolved" }' \
  -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "assistant_id": "aia_asst_11111111-aaaa-bbbb-cccc-222222222222",
  "created_at": "",
  "id": null,
  "message_id": "",
  "score": 1,
  "session_id": "example",
  "text": "problem resolved",
  "updated_at": ""
}
```

## View Feedback via API

The following API endpoint displays all feedback received for a specific Assistant via the Simulator or the API. Feedback is not currently viewable in the Twilio Console.

Get all feedback

```bash
ASSISTANT_SID=<your-assistant-sid>
curl -X GET -H 'Content-Type:application/json' \
  https://assistants.twilio.com/v1/Assistants/$ASSISTANT_SID/Feedbacks \
  -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
[
  {
    "assistant_id": "aia_asst_11111111-aaaa-bbbb-cccc-222222222222",
    "message_id": "7ea35776-9b68-4b39-a2f6-d60e3d25580f",
    "score": 0,
    "session_id": "example"
  },
  {
    "assistant_id": "aia_asst_11111111-aaaa-bbbb-cccc-222222222222",
    "message_id": "",
    "score": 1,
    "session_id": "example",
    "text": "problem resolved"
  }
]
```
