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

# Submit feedback on an agent run

POST https://api.middesk.com/v1/runs/{id}/feedback
Content-Type: application/json

Records a rating on an agent run artifact. The rating can be POSITIVE or NEGATIVE. Attribution defaults to the authenticated user; API-key callers are attributed to their account instead.

Reference: https://docs.middesk.com/api-reference/agents/runs/submit-agent-run-feedback

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `id` (string, required) — Agent run ID

### Body (application/json)

This endpoint expects an object.

- `rating` (enum, required) — Rating value to record for this artifact.
  - Allowed values: `POSITIVE`, `NEGATIVE`
- `artifact_id` (string, required) — Identifier of the artifact to rate.
- `comment` (string, optional, nullable) — Optional free-text comment explaining the rating. Whitespace is stripped server-side; empty or whitespace-only strings are normalized to null.

## Response

### 201

feedback recorded successfully

- `object` (string, required) — Object type identifier.
- `id` (string, required) — Unique identifier for the feedback record.
- `run_id` (string, required) — Identifier of the agent run the feedback is attached to.
- `rating` (enum, required) — Rating value submitted by the reviewer.
  - Allowed values: `POSITIVE`, `NEGATIVE`
- `artifact_id` (string, required) — Identifier of the artifact within the run that was rated.
- `comment` (string, required, nullable) — Optional free-text comment submitted with the rating.
- `reviewer` (AgentsRunFeedbackReviewer, required) — The actor that submitted the feedback. Sidepanel/session callers attribute to a User; API-key callers attribute to the Account.
- `superseded_prior` (boolean, required) — True if a prior active rating from the same reviewer for the same (run, artifact) tuple was superseded by this new rating.
- `created_at` (datetime, required) — Timestamp when the feedback was created.

## Errors

### 404 Submit Agent Run Feedback Request Not Found Error

agent run not found

- `errors` (list of ErrorResponseErrorsItem, required)

### 422 Submit Agent Run Feedback Request Unprocessable Entity Error

request payload is missing or invalid

- `errors` (list of ErrorResponseErrorsItem, required)

## Types

### AgentsRunFeedbackReviewer

The actor that submitted the feedback. Sidepanel/session callers attribute to a User; API-key callers attribute to the Account.

- `type` (enum, required) — Class of the reviewer record.
  - Allowed values: `User`, `Account`
- `id` (string, required) — Identifier of the reviewer record.

### ErrorResponseErrorsItem

- `message` (string, required)
- `parameter` (string, optional) — Request parameter associated with the error, when applicable

## Examples

**Request**

```json
{
  "rating": "POSITIVE",
  "artifact_id": "artifact_id"
}
```

**Response**

```json
{
  "object": "run_feedback",
  "id": "id",
  "run_id": "run_id",
  "rating": "POSITIVE",
  "artifact_id": "artifact_id",
  "comment": "comment",
  "reviewer": {
    "type": "User",
    "id": "id"
  },
  "superseded_prior": true,
  "created_at": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.middesk.com/v1/runs/id/feedback"

payload = {
    "rating": "POSITIVE",
    "artifact_id": "artifact_id"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.middesk.com/v1/runs/id/feedback';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"rating":"POSITIVE","artifact_id":"artifact_id"}'
};

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.middesk.com/v1/runs/id/feedback"

	payload := strings.NewReader("{\n  \"rating\": \"POSITIVE\",\n  \"artifact_id\": \"artifact_id\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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.middesk.com/v1/runs/id/feedback")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"rating\": \"POSITIVE\",\n  \"artifact_id\": \"artifact_id\"\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.middesk.com/v1/runs/id/feedback")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"rating\": \"POSITIVE\",\n  \"artifact_id\": \"artifact_id\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.middesk.com/v1/runs/id/feedback', [
  'body' => '{
  "rating": "POSITIVE",
  "artifact_id": "artifact_id"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.middesk.com/v1/runs/id/feedback");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"rating\": \"POSITIVE\",\n  \"artifact_id\": \"artifact_id\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "rating": "POSITIVE",
  "artifact_id": "artifact_id"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.middesk.com/v1/runs/id/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()
```