Skip to main content
POST
/
feedback
/
aggregate
Feedback Aggregate
curl --request POST \
  --url https://api.example.com/feedback/aggregate \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_id": "<string>",
  "after_ms": 1,
  "before_ms": 1,
  "time_bucket_seconds": 1,
  "feedback_types": [
    "<string>"
  ],
  "tags": [
    "<string>"
  ],
  "rating_min": 0.5,
  "rating_max": 0.5,
  "monitor_ids": [
    "<string>"
  ],
  "scorer_ids": [
    "<string>"
  ],
  "span_agent_names": [
    "<string>"
  ],
  "span_types": [],
  "group_by": []
}
'
import requests

url = "https://api.example.com/feedback/aggregate"

payload = {
"project_id": "<string>",
"after_ms": 1,
"before_ms": 1,
"time_bucket_seconds": 1,
"feedback_types": ["<string>"],
"tags": ["<string>"],
"rating_min": 0.5,
"rating_max": 0.5,
"monitor_ids": ["<string>"],
"scorer_ids": ["<string>"],
"span_agent_names": ["<string>"],
"span_types": [],
"group_by": []
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
after_ms: 1,
before_ms: 1,
time_bucket_seconds: 1,
feedback_types: ['<string>'],
tags: ['<string>'],
rating_min: 0.5,
rating_max: 0.5,
monitor_ids: ['<string>'],
scorer_ids: ['<string>'],
span_agent_names: ['<string>'],
span_types: [],
group_by: []
})
};

fetch('https://api.example.com/feedback/aggregate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/feedback/aggregate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_id' => '<string>',
'after_ms' => 1,
'before_ms' => 1,
'time_bucket_seconds' => 1,
'feedback_types' => [
'<string>'
],
'tags' => [
'<string>'
],
'rating_min' => 0.5,
'rating_max' => 0.5,
'monitor_ids' => [
'<string>'
],
'scorer_ids' => [
'<string>'
],
'span_agent_names' => [
'<string>'
],
'span_types' => [

],
'group_by' => [

]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.example.com/feedback/aggregate"

payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"after_ms\": 1,\n \"before_ms\": 1,\n \"time_bucket_seconds\": 1,\n \"feedback_types\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"rating_min\": 0.5,\n \"rating_max\": 0.5,\n \"monitor_ids\": [\n \"<string>\"\n ],\n \"scorer_ids\": [\n \"<string>\"\n ],\n \"span_agent_names\": [\n \"<string>\"\n ],\n \"span_types\": [],\n \"group_by\": []\n}")

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

req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/feedback/aggregate")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"after_ms\": 1,\n \"before_ms\": 1,\n \"time_bucket_seconds\": 1,\n \"feedback_types\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"rating_min\": 0.5,\n \"rating_max\": 0.5,\n \"monitor_ids\": [\n \"<string>\"\n ],\n \"scorer_ids\": [\n \"<string>\"\n ],\n \"span_agent_names\": [\n \"<string>\"\n ],\n \"span_types\": [],\n \"group_by\": []\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/feedback/aggregate")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"after_ms\": 1,\n \"before_ms\": 1,\n \"time_bucket_seconds\": 1,\n \"feedback_types\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"rating_min\": 0.5,\n \"rating_max\": 0.5,\n \"monitor_ids\": [\n \"<string>\"\n ],\n \"scorer_ids\": [\n \"<string>\"\n ],\n \"span_agent_names\": [\n \"<string>\"\n ],\n \"span_types\": [],\n \"group_by\": []\n}"

response = http.request(request)
puts response.read_body
{
  "after_ms": 123,
  "before_ms": 123,
  "time_bucket_seconds": 123,
  "buckets": [
    {
      "total_count": 123,
      "scored_count": 123,
      "time_bucket_start_ms": 123,
      "group": {},
      "tag_counts": {},
      "rating_counts": {},
      "rating_sums": {}
    }
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Body

application/json

Query for aggregate scores by time bucket and dimension.

project_id
string
required
Example:

"entity/project"

after_ms
integer
required

Inclusive lower bound on created_at (milliseconds since epoch).

Required range: x >= 0
before_ms
integer
required

Exclusive upper bound on created_at (milliseconds since epoch).

Required range: x >= 0
time_bucket_seconds
integer | null

Time bucket size in seconds, e.g. 3600 for 1h buckets

Required range: x > 0
feedback_types
string[]

Filter on feedback_type by prefix

tags
string[]

Filter to feedback that includes any of the given tags

rating_min
number | null

Include only rows with a rating >= this value

Required range: 0 <= x <= 1
rating_max
number | null

Include only rows with a rating <= this value

Required range: 0 <= x <= 1
monitor_ids
string[]

Filter to these monitor ids (exact match; suffix with '*' for prefix match).

scorer_ids
string[]

Filter to these scorer ids (exact match; suffix with '*' for prefix match).

span_agent_names
string[]

Filter to feedback whose span_agent_name matches any of these (exact).

span_types
enum<string>[]

Filter by span type (turn vs conversation).

Available options:
agent_turn,
agent_conversation
group_by
enum<string>[]

Allowed: ['scorer_id', 'span_agent_name', 'span_agent_version', 'span_status_code'].

Available options:
scorer_id,
span_agent_name,
span_agent_version,
span_status_code

Response

Successful Response

Sparse time-series of aggregated scorer feedback (empty buckets omitted).

after_ms
integer
required

Resolved inclusive lower bound, unix epoch ms (UTC).

before_ms
integer
required

Resolved exclusive upper bound, unix epoch ms (UTC).

time_bucket_seconds
integer | null

Time bucket size used (seconds). None when unbucketed.

buckets
FeedbackAggregateBucket · object[]