Skip to main content
GET
/
projects
/
{projectId}
/
metrics
JavaScript
import Scorecard from 'scorecard-ai';

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

// Automatically fetches more pages as needed.
for await (const metric of client.metrics.list('314')) {
  console.log(metric);
}
import os
from scorecard_ai import Scorecard

client = Scorecard(
api_key=os.environ.get("SCORECARD_API_KEY"), # This is the default and can be omitted
)
page = client.metrics.list(
project_id="314",
)
page = page.data[0]
print(page)
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api2.scorecard.io/api/v2/projects/{projectId}/metrics"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
curl https://api2.scorecard.io/api/v2/projects/$PROJECT_ID/metrics \
-H "Authorization: Bearer $SCORECARD_API_KEY"
{
  "data": [
    {
      "id": "456",
      "name": "Response Accuracy",
      "description": "Evaluates if the response is factually accurate",
      "outputType": "boolean",
      "evalType": "ai",
      "guidelines": "Check if the response contains factually correct information",
      "promptTemplate": "Please evaluate if the following response is factually accurate: {{response}}",
      "evalModelName": "gpt-4o",
      "temperature": 0.1
    },
    {
      "id": "457",
      "name": "Response Quality",
      "description": "Human review of quality",
      "outputType": "float",
      "evalType": "human",
      "guidelines": "Rate the coherence of the response (0-1).",
      "passingThreshold": 0.8
    }
  ],
  "nextCursor": null,
  "hasMore": false
}
{
"code": "UNAUTHORIZED",
"message": "Invalid or missing authentication token",
"details": {}
}
{
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred while processing your request.",
"details": {}
}

Authorizations

Authorization
string
header
required

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

Path Parameters

projectId
string
required

The ID of the Project to list Metrics for.

Example:

"314"

Query Parameters

limit
integer
default:20

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

Example:

20

cursor
string

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

Example:

"123"

Response

Successfully retrieved Metrics.

data
(AI int metric · object | Human int metric · object | Heuristic int metric · object | AI float metric · object | Human float metric · object | Heuristic float metric · object | AI boolean metric · object | Human boolean metric · object | Heuristic boolean metric · object)[]
required

A Metric defines how to evaluate system outputs against expected results.

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