> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trellis.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Message Feedback

> Add feedback to a message (thumbs up/down)

Provide feedback on an AI response to help improve future responses.

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from the authenticate endpoint.
</ParamField>

<ParamField path="message_id" type="string" required>
  Unique identifier of the message to provide feedback on.
</ParamField>

<ParamField body="feedback" type="string" required>
  Either `"positive"` (thumbs up) or `"negative"` (thumbs down).
</ParamField>

<ParamField body="note" type="string">
  Optional additional context. Typically used with negative feedback to explain what was wrong.
</ParamField>

## Response

<ResponseField name="id" type="string" required>
  Message ID.
</ResponseField>

<ResponseField name="metadata" type="object" required>
  Updated message metadata.

  <Expandable title="Metadata properties">
    <ResponseField name="feedback" type="string" required>
      The feedback value that was saved.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X PATCH https://api.trellis.sh/v1/chats/messages/msg_002/feedback \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"feedback": "positive"}'
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  response = requests.patch(
      "https://api.trellis.sh/v1/chats/messages/msg_002/feedback",
      headers={
          "Authorization": "Bearer YOUR_TOKEN",
          "Content-Type": "application/json"
      },
      json={"feedback": "positive"}
  )
  result = response.json()
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch(
    "https://api.trellis.sh/v1/chats/messages/msg_002/feedback",
    {
      method: "PATCH",
      headers: {
        Authorization: "Bearer YOUR_TOKEN",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ feedback: "positive" }),
    }
  );
  const result = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "id": "msg_002",
    "metadata": {
      "feedback": "positive"
    }
  }
  ```

  ```json 400 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Feedback must be 'positive' or 'negative'"
  }
  ```

  ```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Message not found"
  }
  ```
</ResponseExample>
