---
title: "Create or update a log score"
method: POST
path: "/api/logs/{log_id}/scores/"
tags: ["scores"]
---

# Create or update a log score

`POST /api/logs/{log_id}/scores/`

Create a score for a specific log/span. The backend keeps one score per `(log, evaluator, scorer)` and updates the existing score if the same combination is submitted again.

## Path parameters

- `log_id` string, required

## Headers

- `Authorization` string, required

## Request body

- object
  - `evaluator_id` string — Evaluator ID. Provide either `evaluator_id` or `evaluator_slug`.
  - `evaluator_slug` string — Custom evaluator slug. Provide either `evaluator_id` or `evaluator_slug`.
  - `timestamp` string, date-time — Log timestamp. Supplying it can avoid an additional log lookup.
  - `environment` string — Score environment.
  - `prompt_id` string
  - `prompt_version_number` integer
  - `dataset_id` string
  - `automation_id` string
  - `scorer` string — Optional score producer for general score creation. Log-scoped routes derive this from the authenticated user.
  - `numerical_value` number, double, nullable — Numeric score value. Use for `numerical` and `percentage` evaluators.
  - `string_value` string, nullable — Text score value. Use for `text` and legacy `comment` evaluators.
  - `boolean_value` boolean, nullable — Boolean score value. Use for `boolean` evaluators.
  - `categorical_value` string[], nullable — Categorical score values. Use for `single_select`, `multi_select`, and legacy `categorical` evaluators.
  - `json_value` string, nullable — JSON score value encoded as a string. Use for `json` evaluators.
  - `explanation` string — Optional explanation for the score.

## Response `200`

Updated existing score for this log/evaluator/scorer.

- ScoresCreateSpanScoreResponse200
  - `id` string, required — Score ID.
  - `created_at` string, date-time, required — When the score was created.
  - `type` 'llm' | 'human' | 'code' | 'function' | 'human_numerical' | 'human_boolean' | 'human_categorical' | 'human_text' | 'custom' — Evaluator execution type. Legacy rows may contain legacy type values.
  - `environment` string — Environment associated with the score.
  - `numerical_value` number, double, nullable — Numeric score value. Use for `numerical` and `percentage` evaluators.
  - `string_value` string, nullable — Text score value. Use for `text` and legacy `comment` evaluators.
  - `boolean_value` boolean, nullable — Boolean score value. Use for `boolean` evaluators.
  - `categorical_value` string[], nullable — Categorical score values. Use for `single_select`, `multi_select`, and legacy `categorical` evaluators.
  - `json_value` string, nullable — JSON score value encoded as a string. Use for `json` evaluators.
  - `is_passed` boolean, nullable — Whether the score passes the evaluator conditions.
  - `cost` number, double, nullable — Evaluation cost in USD, when available.
  - `evaluator_id` string, nullable — Evaluator ID associated with the score.
  - `evaluator_slug` string, nullable — Evaluator slug associated with the score.
  - `evaluator_name` string, nullable — Human-readable evaluator name, when available.
  - `scorer` string, nullable — Who or what produced the score. For log-scoped score writes, the backend derives this from the authenticated user.
  - `log_id` string, nullable — Associated log/span ID.
  - `prompt_id` string, nullable — Associated prompt ID, when available.
  - `prompt_version_number` integer, nullable — Associated prompt version number, when available.
  - `dataset_id` string, nullable — Associated dataset ID, when available.
  - `automation_id` string, nullable — Associated automation ID, when available.
  - `status` string, nullable — Evaluation status, when available.
  - `error_message` string, nullable — Evaluation error message, when available.
  - `explanation` string — Optional explanation for the score.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized - Missing or invalid authentication
- `404` — Not Found

## Changes

> 6 revisions in range; 3 could not be searched.

- **2026-07-31** `c26d550029f8` — 6 breaking, 3 warning, 11 info
  - added the new required request property `organization`
  - the request property `categorical_value` became not nullable
  - the request property `json_value` became not nullable
  - the request property `numerical_value` became not nullable
  - …16 more

[Change history](https://skmtc.dev/keywordsai/apis/api-reference/changes/api/logs/:log_id/scores/post.md)

---

[API](https://skmtc.dev/keywordsai/apis/api-reference.md) · [All operations](https://skmtc.dev/keywordsai/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/keywordsai/api-reference/revisions/c61efaf24756/schema)
