BrowserStack AI Evals

Scores API

Create and retrieve evaluation scores for traces and observations.

Scores API

Scores attach evaluation results to traces or observations. They can be created programmatically (via API or SDK), from human annotation, or from automated evaluators.

Create Score

POST /api/public/scores

Authentication: Accepts write-only keys.

Request Body

FieldTypeRequiredDescription
idstringNoScore ID (auto-generated if omitted)
traceIdstringYesID of the trace to score
namestringYesScore name (e.g., "correctness", "faithfulness")
valuenumberYes (NUMERIC/BOOLEAN)Numeric score value
stringValuestringYes (CATEGORICAL)Categorical value
dataTypestringNoNUMERIC, BOOLEAN, CATEGORICAL (default: NUMERIC)
observationIdstringNoID of the observation to attach to (optional)
commentstringNoHuman-readable comment
configIdstringNoScore config ID for constrained scoring
environmentstringNoEnvironment name

Response

{ "id": "score-uuid-1" }

cURL Examples

Numeric score:

curl -X POST https://evals-api.browserstack.com/api/public/scores \
  -u "pk-lf-...:sk-lf-..." \
  -H "Content-Type: application/json" \
  -d '{
    "traceId": "trace-uuid-1",
    "name": "correctness",
    "value": 0.92,
    "comment": "Answer is accurate and well-referenced."
  }'

Categorical score:

curl -X POST https://evals-api.browserstack.com/api/public/scores \
  -u "pk-lf-...:sk-lf-..." \
  -H "Content-Type: application/json" \
  -d '{
    "traceId": "trace-uuid-1",
    "name": "quality",
    "dataType": "CATEGORICAL",
    "stringValue": "good"
  }'

Boolean score on a specific observation:

curl -X POST https://evals-api.browserstack.com/api/public/scores \
  -u "pk-lf-...:sk-lf-..." \
  -H "Content-Type: application/json" \
  -d '{
    "traceId": "trace-uuid-1",
    "observationId": "obs-uuid-1",
    "name": "factual",
    "dataType": "BOOLEAN",
    "value": 1
  }'

List Scores

GET /api/public/scores

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page (default: 50)
namestringFilter by score name
userIdstringFilter by user ID
traceIdstringFilter by trace ID
sourcestringFilter by source: API, EVAL, ANNOTATION
dataTypestringFilter by data type: NUMERIC, BOOLEAN, CATEGORICAL
configIdstringFilter by score config ID
queueIdstringFilter by annotation queue ID
traceTagsstring[]Filter by tags on the parent trace
environmentstringFilter by environment
fromTimestampISO 8601Created at or after
toTimestampISO 8601Created at or before
scoreIdsstring[]Filter by specific score IDs
valuenumberFilter by exact numeric value
operatorstringComparison for value: =, <, >, <=, >=

Response

{
  "data": [
    {
      "id": "score-uuid-1",
      "traceId": "trace-uuid-1",
      "observationId": null,
      "name": "correctness",
      "value": 0.92,
      "stringValue": null,
      "dataType": "NUMERIC",
      "source": "API",
      "comment": "Answer is accurate.",
      "configId": null,
      "environment": "default",
      "createdAt": "2026-04-03T10:05:00.000Z",
      "updatedAt": "2026-04-03T10:05:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 50,
    "totalItems": 1,
    "totalPages": 1
  }
}

cURL Example

curl "https://evals-api.browserstack.com/api/public/scores?name=correctness&page=1&limit=20" \
  -u "pk-lf-...:sk-lf-..."

Get Score

GET /api/public/scores/{scoreId}

Path Parameters

ParameterTypeDescription
scoreIdstringScore ID

Response

Same schema as list response items.

cURL Example

curl "https://evals-api.browserstack.com/api/public/scores/score-uuid-1" \
  -u "pk-lf-...:sk-lf-..."

Delete Score

DELETE /api/public/scores/{scoreId}

Path Parameters

ParameterTypeDescription
scoreIdstringScore ID

cURL Example

curl -X DELETE "https://evals-api.browserstack.com/api/public/scores/score-uuid-1" \
  -u "pk-lf-...:sk-lf-..."

Score Configs

Score configs define named, constrained score dimensions (e.g., a 1–5 rating scale).

List Score Configs

GET /api/public/score-configs
curl "https://evals-api.browserstack.com/api/public/score-configs" \
  -u "pk-lf-...:sk-lf-..."

Get Score Config

GET /api/public/score-configs/{configId}
curl "https://evals-api.browserstack.com/api/public/score-configs/config-uuid-1" \
  -u "pk-lf-...:sk-lf-..."

Score Data Types

dataTypevalue fieldstringValue fieldDescription
NUMERICRequired (float)Numeric score (e.g., 0.0–1.0)
BOOLEANRequired (0 or 1)Pass/fail score
CATEGORICALRequiredText label (e.g., "good", "bad")

Score Sources

sourceDescription
APICreated via REST API or SDK
EVALCreated by an automated evaluator
ANNOTATIONCreated by a human via the annotation queue