---
title: "POST /api/public/scores"
method: POST
path: "/api/public/scores"
tags: ["Score"]
---

# POST /api/public/scores

`POST /api/public/scores`

Add a score to the database, upserts on id

## Request body

- CreateScoreRequest
  - `id` string, nullable
  - `traceId` string, nullable
  - `sessionId` string, nullable
  - `observationId` string, nullable
  - `datasetRunId` string, nullable
  - `name` string, required — The name of the score. Always overrides "output" for correction scores.
  - `value` union, required — The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. For corrections pass value as string and set data type to CORRECTION
    - number, double
    - string
  - `comment` string, nullable
  - `metadata` unknown
  - `dataType` 'NUMERIC' | 'CATEGORICAL' | 'BOOLEAN' | 'CORRECTION'
  - `configId` string, nullable — Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values
  - `source` 'API' | 'ANNOTATION' — Source values accepted when creating a score via the public API. EVAL is reserved for internal evaluator outputs and is intentionally not exposed here.

## Response `204`

## Other responses

- `400`
- `401`
- `403`
- `405`

## Changes

- **2026-04-23** `bfb57f56e395` — 1 info
  - added the new optional request property `source`
- **2025-12-23** `ef21e3866530` — 1 info
  - added the new `CORRECTION` enum value to the request property `dataType`
- **2025-05-07** `d12d267f42ff` — 1 info
  - added the new optional request property `datasetRunId`
- **2025-04-28** `a406b7f62fe0` — 3 info
  - added the new optional request property `sessionId`
  - the request property `traceId` became nullable
  - the request property `traceId` became optional
- **2025-04-07** `51b565ddd5fc` — 1 info
  - added the new optional request property `metadata`

[Full history](https://skmtc.dev/langfuse/apis/client/changes/api/public/scores/post.md)

---

[API](https://skmtc.dev/langfuse/apis/client.md) · [All operations](https://skmtc.dev/langfuse/apis/client/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/langfuse/client/revisions/c996110ed6ba/schema)
