Skip to content
POST/api/v1/evals/{runId}/results

Submit per-case results for an external eval run

Used by SDK clients to batch-upsert case results for a run (idempotent on (eval_run_id, case_index)). Caller must be a member of the run's org.

Authentication

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

Parameters

runId in pathrequired
string

Request body required

Example

{
  "results": [
    {
      "test_case_index": 0,
      "input": "string",
      "expected": "string",
      "output": "string",
      "scores": {},
      "latency_ms": 0,
      "cost": 0,
      "passed": false,
      "score": 0
    }
  ]
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "results"
      ],
      "properties": {
        "results": {
          "type": "array",
          "minItems": 1,
          "maxItems": 1000,
          "items": {
            "type": "object",
            "required": [
              "test_case_index",
              "input",
              "output",
              "scores",
              "latency_ms",
              "passed"
            ],
            "properties": {
              "test_case_index": {
                "type": "integer",
                "minimum": 0
              },
              "input": {
                "type": "string",
                "maxLength": 100000
              },
              "expected": {
                "type": "string",
                "maxLength": 100000
              },
              "output": {
                "type": "string",
                "maxLength": 100000
              },
              "scores": {
                "type": "object",
                "additionalProperties": true
              },
              "latency_ms": {
                "type": "number"
              },
              "cost": {
                "type": "number"
              },
              "passed": {
                "type": "boolean"
              },
              "score": {
                "type": "number"
              }
            }
          }
        }
      }
    }
  }
}

Response

201 example

{
  "success": true
}

All status codes

201Results stored (upserted).
400(no description)
401(no description)
403NOT_ORG_MEMBER.
404(no description)
429(no description)

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/evals/{runId}/results \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "results": [ { "test_case_index": 0, "input": "string", "expected": "string", "output": "string", "scores": {}, "latency_ms": 0, "cost": 0, "passed": false, "score": 0 } ] }'

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/evals/{runId}/results",
  body: {
    "results": [
      {
        "test_case_index": 0,
        "input": "string",
        "expected": "string",
        "output": "string",
        "scores": {},
        "latency_ms": 0,
        "cost": 0,
        "passed": false,
        "score": 0
      }
    ]
  },
});
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/evals/{runId}/results",
    body={
    "results": [
        {
            "test_case_index": 0,
            "input": "string",
            "expected": "string",
            "output": "string",
            "scores": {},
            "latency_ms": 0,
            "cost": 0,
            "passed": False,
            "score": 0
        }
    ]
},
)
print(response)

Go

package main

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

func main() {
	body := strings.NewReader(`{"results":[{"test_case_index":0,"input":"string","expected":"string","output":"string","scores":{},"latency_ms":0,"cost":0,"passed":false,"score":0}]}`)
	req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/evals/{runId}/results", 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 Evals endpoints