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

const client = new Scorecard({
  apiKey: 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.

The response is of type object.