|
| 1 | +--- |
| 2 | +date: 2026-06-10 |
| 3 | +title: "Scores API v3" |
| 4 | +description: Cursor-based pagination, a typed value field, and list-based filters with numeric ranges on the new GET /api/public/v3/scores endpoint. |
| 5 | +author: Niklas |
| 6 | +--- |
| 7 | + |
| 8 | +import { ChangelogHeader } from "@/components/changelog/ChangelogHeader"; |
| 9 | + |
| 10 | +<ChangelogHeader /> |
| 11 | + |
| 12 | +<Callout type="info"> |
| 13 | + The previous `/api/public/v2/scores` endpoints are deprecated. On deployments |
| 14 | + fully migrated to [Langfuse v4](/docs/v4), they return a 404 error — switch |
| 15 | + to `/api/public/v3/scores`. |
| 16 | +</Callout> |
| 17 | + |
| 18 | +The new `GET /api/public/v3/scores` endpoint makes querying scores faster and simpler: cursor-based pagination, a single typed `value` field, and filters that accept lists of values and numeric ranges. |
| 19 | + |
| 20 | +``` |
| 21 | +GET /api/public/v3/scores?dataType=NUMERIC&name=hallucination,toxicity&valueMax=0.5 |
| 22 | +``` |
| 23 | + |
| 24 | +Common cases this simplifies: |
| 25 | + |
| 26 | +- **Compare experiment runs** by fetching the scores of one or more dataset runs in a single request, e.g. `experimentId=run-a,run-b`. |
| 27 | +- **Pull only failing evals** by combining `name`, `dataType=NUMERIC`, and `valueMax` in a single request instead of filtering client-side. |
| 28 | +- **Audit annotations per reviewer** with the new `authorUserId` filter, e.g. `source=ANNOTATION&authorUserId=user-123`. |
| 29 | + |
| 30 | +**One typed `value` field.** The v2 split between a numeric `value` and a separate `stringValue` is gone. v3 returns a single `value` whose type follows the `dataType`: a number for `NUMERIC`, a boolean for `BOOLEAN`, and a string for `CATEGORICAL`, `TEXT`, and `CORRECTION`. No more decoding booleans from `1`/`0` or looking up category strings. |
| 31 | + |
| 32 | +**Cursor-based pagination.** Pass `limit` (max 100) and follow the `cursor` from the response `meta` to fetch the next page; it's absent on the final page. This replaces v2's `page` parameter. For recurring full exports to your data warehouse, use the [scheduled blob storage export](/docs/api-and-data-platform/features/export-to-blob-storage) instead of paginating through the API. |
| 33 | + |
| 34 | +**List filters and value ranges.** Most filters now take comma-separated lists — `id`, `name`, `source`, `dataType`, `environment`, `configId`, `queueId`, `authorUserId`, `traceId`, `sessionId`, `observationId`, and `experimentId` (previously `datasetRunId`). Values within one parameter are OR-ed, parameters are AND-ed: `name=hallucination,toxicity&source=EVAL` returns eval scores named either `hallucination` or `toxicity`. The v2 `operator`/`value` pair is replaced by an exact-match `value` list (for `NUMERIC`, `BOOLEAN`, and `CATEGORICAL` scores) plus `valueMin`/`valueMax` range bounds for numeric scores. |
| 35 | + |
| 36 | +**Selective field retrieval.** Responses always include the core fields — `id`, `projectId`, `name`, `value`, `dataType`, `source`, `timestamp`, `environment`, `createdAt`, and `updatedAt` — and stay lean by default; opt into additional field groups via the `fields` parameter: |
| 37 | + |
| 38 | +``` |
| 39 | +GET /api/public/v3/scores?fields=details,subject,annotation |
| 40 | +``` |
| 41 | + |
| 42 | +- `details` — `comment`, `configId`, `metadata` |
| 43 | +- `subject` — what the score is attached to, as a discriminated object (`kind`: `trace`, `observation`, `session`, or `experiment`) replacing v2's flat `traceId`/`observationId`/`sessionId`/`datasetRunId` fields |
| 44 | +- `annotation` — `authorUserId`, `queueId` |
| 45 | + |
| 46 | +**Migrating from v2.** v3 queries scores directly instead of joining traces, which keeps response times predictable at any volume. Filters therefore target score properties: for trace-level questions like "scores for traces of user X", the [Metrics API](/docs/metrics/features/metrics-api) replaces the v2 `userId` and `traceTags` filters and the `trace` field group. Every filter is now an explicit, typed parameter, replacing v2's JSON-stringified `filter` argument, and fetching a single score works through the `id` filter, replacing the get-by-id endpoint. Invalid filter combinations are rejected with HTTP 400. |
| 47 | + |
| 48 | +The full parameter reference is in the [API docs](https://api.reference.langfuse.com/#tag/scores/GET/api/public/v3/scores). |
0 commit comments