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/settings/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)
409Conflict — CONFLICT, IMMUTABLE_RUN.
429(no description)
500Internal Server Error — DB_ERROR.

Code samples

cURL

# {runId} is shown with an EXAMPLE value — replace it with real values.
curl -X POST \
  https://evalguard.ai/api/v1/evals/00000000-0000-0000-0000-000000000000/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

// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:
// {runId} is shown with an EXAMPLE value — replace it with real values.

const res = await fetch("https://evalguard.ai/api/v1/evals/00000000-0000-0000-0000-000000000000/results", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "results": [
      {
        "test_case_index": 0,
        "input": "string",
        "expected": "string",
        "output": "string",
        "scores": {},
        "latency_ms": 0,
        "cost": 0,
        "passed": false,
        "score": 0
      }
    ]
  }),
});
console.log(res.status, await res.json());

Python

# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:
# {runId} is shown with an EXAMPLE value — replace it with real values.

import os
import requests

headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}
headers["Content-Type"] = "application/json"

response = requests.request(
    "POST",
    "https://evalguard.ai/api/v1/evals/00000000-0000-0000-0000-000000000000/results",
    headers=headers,
    json={
    "results": [
        {
            "test_case_index": 0,
            "input": "string",
            "expected": "string",
            "output": "string",
            "scores": {},
            "latency_ms": 0,
            "cost": 0,
            "passed": False,
            "score": 0
        }
    ]
},
)
print(response.status_code, response.json())

Go

package main

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

// {runId} is shown with an EXAMPLE value — replace it with real values.
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/00000000-0000-0000-0000-000000000000/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

400401403404409429500

Other Evals endpoints