POST/api/v1/datasets/{datasetId}/cases

Append cases (input/expected pairs) to a dataset

Bulk-inserts test cases under the given dataset. Each case carries an input string and an optional expected output for grading. Validates that the caller owns the dataset project before writing.

Authentication

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

Parameters

datasetId in pathrequired
string

Request body required

Example

{
  "cases": [
    {
      "input": "string",
      "expected": "string"
    }
  ]
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "cases"
      ],
      "properties": {
        "cases": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "input"
            ],
            "properties": {
              "input": {
                "type": "string"
              },
              "expected": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}

Response

All status codes

201Cases inserted
404Dataset not found or not in caller project

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/datasets/{datasetId}/cases \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "cases": [ { "input": "string", "expected": "string" } ] }'

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/datasets/{datasetId}/cases",
  body: {
    "cases": [
      {
        "input": "string",
        "expected": "string"
      }
    ]
  },
});
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/datasets/{datasetId}/cases",
    body={
    "cases": [
        {
            "input": "string",
            "expected": "string"
        }
    ]
},
)
print(response)

Go

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/evalguard/evalguard-go"
)

func main() {
	client := evalguard.NewClient(os.Getenv("EVALGUARD_API_KEY"))
	resp, err := client.Request(context.Background(), "POST", "/api/v1/datasets/{datasetId}/cases", map[string]any{"cases": []any{map[string]any{"input": "string", "expected": "string"}}})
	if err != nil { panic(err) }
	fmt.Println(resp)
}

Errors

404

Other Datasets endpoints