Skip to content
POST/api/v1/traces/curate

Curate traces into a dataset

Filters/dedupes trace_spans and promotes them into an existing dataset's cases. Requires projectId + datasetId (dataset must belong to the project). editor role. Returns 201.

Authentication

Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.

Request body required

Example

{
  "projectId": "00000000-0000-0000-0000-000000000000",
  "datasetId": "00000000-0000-0000-0000-000000000000",
  "filters": {},
  "limit": 100,
  "deduplicate": true,
  "minQuality": "golden"
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "projectId",
        "datasetId"
      ],
      "properties": {
        "projectId": {
          "type": "string",
          "format": "uuid"
        },
        "datasetId": {
          "type": "string",
          "format": "uuid"
        },
        "filters": {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "ok",
                "error",
                "unset"
              ]
            },
            "minScore": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "maxScore": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "startDate": {
              "type": "string",
              "format": "date-time"
            },
            "endDate": {
              "type": "string",
              "format": "date-time"
            },
            "model": {
              "type": "string",
              "maxLength": 200
            },
            "serviceName": {
              "type": "string",
              "maxLength": 200
            },
            "minDuration": {
              "type": "number",
              "minimum": 0
            },
            "maxDuration": {
              "type": "number",
              "minimum": 0
            }
          },
          "default": {}
        },
        "limit": {
          "type": "number",
          "minimum": 1,
          "maximum": 1000,
          "default": 100
        },
        "deduplicate": {
          "type": "boolean",
          "default": true
        },
        "minQuality": {
          "type": "string",
          "enum": [
            "golden",
            "good",
            "uncertain",
            "poor"
          ]
        }
      }
    }
  }
}

Response

201 example

{
  "success": true
}

All status codes

201Created.
400(no description)
401(no description)
403Forbidden - insufficient role for this operation.
404(no description)
429(no description)

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/traces/curate \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "projectId": "00000000-0000-0000-0000-000000000000", "datasetId": "00000000-0000-0000-0000-000000000000", "filters": {}, "limit": 100, "deduplicate": true, "minQuality": "golden" }'

TypeScript

import { EvalGuard } from "@evalguard/sdk";

const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });

const response = await client.request({
  method: "POST",
  path: "/api/v1/traces/curate",
  body: {
    "projectId": "00000000-0000-0000-0000-000000000000",
    "datasetId": "00000000-0000-0000-0000-000000000000",
    "filters": {},
    "limit": 100,
    "deduplicate": true,
    "minQuality": "golden"
  },
});
console.log(response);

Python

from evalguard import EvalGuard
import os

client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])

response = client.request(
    method="POST",
    path="/api/v1/traces/curate",
    body={
    "projectId": "00000000-0000-0000-0000-000000000000",
    "datasetId": "00000000-0000-0000-0000-000000000000",
    "filters": {},
    "limit": 100,
    "deduplicate": True,
    "minQuality": "golden"
},
)
print(response)

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{"projectId":"00000000-0000-0000-0000-000000000000","datasetId":"00000000-0000-0000-0000-000000000000","filters":{},"limit":100,"deduplicate":true,"minQuality":"golden"}`)
	req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/traces/curate", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401403404429

Other Traces endpoints