> This page is for version v4.0.
> For other versions, use one of these documentation indexes:
> - v5.0 (default): https://humanloop.com/docs/v5/llms.txt
> - v4.0: https://humanloop.com/docs/v4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://humanloop.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/docs/_mcp/server.

# Feedback

POST https://api.humanloop.com/v4/feedback
Content-Type: application/json

Submit an array of feedback for existing `data_ids`

Reference: https://humanloop.com/docs/v4/api/feedback/feedback

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a FeedbackFeedbackRequest.

- `FeedbackFeedbackRequest`
  - list of FeedbackRequest
  - FeedbackRequest

## Response

### 200

Successful Response

- `FeedbackFeedbackResponse`
  - list of FeedbackResponse
  - FeedbackResponse

## Errors

### 422 Feedback Feedback Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### FeedbackRequest

- `type` (FeedbackRequestType, required) — The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'.
- `value` (FeedbackRequestValue, optional) — The feedback value to be set. This field should be left blank when unsetting 'rating', 'correction' or 'comment', but is required otherwise.
- `data_id` (string, optional) — ID to associate the feedback to a previously logged datapoint.
- `user` (string, optional) — A unique identifier to who provided the feedback.
- `created_at` (datetime, optional) — User defined timestamp for when the feedback was created.
- `unset` (boolean, optional) — If true, the value for this feedback is unset.

### FeedbackResponse

- `type` (FeedbackResponseType, required) — The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'.
- `id` (string, required) — String ID of user feedback. Starts with `ann_`, short for annotation.
- `value` (FeedbackResponseValue, optional) — The feedback value to set. This would be the appropriate text for 'correction' or 'comment', or a label to apply for 'rating', 'action', or 'issue'.
- `data_id` (string, optional) — ID to associate the feedback to a previously logged datapoint.
- `user` (string, optional) — A unique identifier to who provided the feedback.
- `created_at` (datetime, optional) — User defined timestamp for when the feedback was created.

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### FeedbackRequestType

The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'.

- enum
  - Allowed values: `rating`, `action`, `issue`, `correction`, `comment`
- string

### FeedbackRequestValue

The feedback value to be set. This field should be left blank when unsetting 'rating', 'correction' or 'comment', but is required otherwise.

- boolean
- double
- list of string
- string

### FeedbackResponseType

The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'.

- enum
  - Allowed values: `rating`, `action`, `issue`, `correction`, `comment`
- string

### FeedbackResponseValue

The feedback value to set. This would be the appropriate text for 'correction' or 'comment', or a label to apply for 'rating', 'action', or 'issue'.

- boolean
- double
- list of string
- string

### ValidationErrorLocItem

- string
- integer

## Examples

**Request**

```json
[
  {
    "type": "rating"
  }
]
```

**Response**

```json
[
  {
    "type": "rating",
    "value": true,
    "data_id": "data_id",
    "user": "user",
    "created_at": "2024-01-15T09:30:00Z",
    "id": "id"
  }
]
```

**SDK Code**

```python
import requests

url = "https://api.humanloop.com/v4/feedback"

payload = [{ "type": "rating" }]
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.humanloop.com/v4/feedback';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"type":"rating"}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.humanloop.com/v4/feedback"

	payload := strings.NewReader("[\n  {\n    \"type\": \"rating\"\n  }\n]")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.humanloop.com/v4/feedback")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"type\": \"rating\"\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.humanloop.com/v4/feedback")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"type\": \"rating\"\n  }\n]")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.humanloop.com/v4/feedback', [
  'body' => '[
  {
    "type": "rating"
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.humanloop.com/v4/feedback");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"type\": \"rating\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [["type": "rating"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v4/feedback")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```