GET
/
testsets
/
{testsetId}
/
testcases
import Scorecard from 'scorecard-ai';

const client = new Scorecard({
  bearerToken: process.env['SCORECARD_API_KEY'], // This is the default and can be omitted
});

async function main() {
  // Automatically fetches more pages as needed.
  for await (const testcase of client.testcases.list('246')) {
    console.log(testcase.id);
  }
}

main();
{
  "data": [
    {
      "id": "123",
      "testsetId": "246",
      "jsonData": {
        "question": "What is the capital of France?",
        "idealAnswer": "Paris",
        "provenance": "hand_curated"
      },
      "inputs": {
        "question": "What is the capital of France?"
      },
      "labels": {
        "idealAnswer": "Paris"
      }
    },
    {
      "id": "124",
      "testsetId": "246",
      "jsonData": {
        "question": "What is the largest planet in our solar system?",
        "idealAnswer": "Jupiter",
        "provenance": "synthetic"
      },
      "inputs": {
        "question": "What is the largest planet in our solar system?"
      },
      "labels": {
        "idealAnswer": "Jupiter"
      }
    },
    {
      "id": "125",
      "testsetId": "246",
      "jsonData": {
        "question": "What is the deepest ocean on Earth?",
        "provenance": "user_feedback"
      },
      "inputs": {
        "question": "What is the deepest ocean on Earth?"
      },
      "labels": {},
      "validationErrors": [
        {
          "path": "/data",
          "message": "Required field 'idealAnswer' is missing"
        }
      ]
    }
  ],
  "nextCursor": "126",
  "hasMore": true
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

testsetId
string
required

The ID of the Testset to list Testcases from.

Example:

"246"

Query Parameters

limit
integer
default:20

Maximum number of items to return (1-100). Use with cursor for pagination through large sets.

Required range: x > 0
Example:

20

cursor
string

Cursor for pagination. Pass the nextCursor from the previous response to get the next page of results.

Example:

"123"

Response

200
application/json
Successfully retrieved list of Testcases.
data
object[]
required

A test case in the Scorecard system. Contains JSON data that is validated against the schema defined by its Testset. The inputs and labels fields are derived from the data field based on the Testset's fieldMapping, and include all mapped fields, including those with validation errors. Testcases are stored regardless of validation results, with any validation errors included in the validationErrors field.

nextCursor
string | null
required
hasMore
boolean
required
total
integer
Required range: x >= 0