---
title: "Record run feedback"
description: "Record feedback for a run to LangSmith. Requires an authenticated caller.\n\nThis is a simple wrapper for the LangSmith create_feedback API, so the\ncredentials can be stored and managed in the service rather than the client.\nSee: https://api.smith.langchain.com/redoc#tag/feedback/operation/create_feedback_api_v1_feedback_post"
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › History & Feedback

`POST /feedback`

Record feedback for a run to LangSmith. Requires an authenticated caller.

This is a simple wrapper for the LangSmith create_feedback API, so the
credentials can be stored and managed in the service rather than the client.
See: https://api.smith.langchain.com/redoc#tag/feedback/operation/create_feedback_api_v1_feedback_post

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Header parameters

- `X-On-Behalf-Of` (`feedback.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`feedback.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`
- `X-App-Id` (`feedback.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`

## Request body

_Required._

- `run_id` (`feedback.run_id`; string, required) — Run ID to record feedback for.
- `key` (`feedback.key`; string, required) — Feedback key.
- `score` (`feedback.score`; number, required) — Feedback score.
- `kwargs` (`feedback.kwargs`; object, optional) — Additional feedback kwargs, passed to LangSmith.
  - default `{}`

## Example request

```json
{
  "run_id": "847c6285-8fc9-4560-a83f-4e6285809254",
  "key": "human-feedback-stars",
  "score": 0.8,
  "kwargs": {
    "comment": "In-line human feedback"
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://truememory-api.mvstg.com/feedback \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "run_id": "847c6285-8fc9-4560-a83f-4e6285809254",
  "key": "human-feedback-stars",
  "score": 0.8,
  "kwargs": {
    "comment": "In-line human feedback"
  }
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/feedback';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    run_id: '847c6285-8fc9-4560-a83f-4e6285809254',
    key: 'human-feedback-stars',
    score: 0.8,
    kwargs: {comment: 'In-line human feedback'}
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/feedback"

payload = {
    "run_id": "847c6285-8fc9-4560-a83f-4e6285809254",
    "key": "human-feedback-stars",
    "score": 0.8,
    "kwargs": { "comment": "In-line human feedback" }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Successful Response

#### Example

```json
{
  "status": "success"
}
```

- `status` (`feedback.response.200.status`; string, optional)
  - default `"success"`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`feedback.response.422.detail`; array<object>, optional)
  - `loc` (`feedback.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`feedback.response.422.detail.msg`; string, required)
  - `type` (`feedback.response.422.detail.type`; string, required)
  - `input` (`feedback.response.422.detail.input`; unknown, optional)
  - `ctx` (`feedback.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/feedback/create/index.md
