# div score

> Set or delete a score on a trace or one of its spans.

## Synopsis

```text
div score <trace> <name> <value> [flags]
div score <trace> --delete <score>
```

Sets this key's score of `<name>` on a trace. Scoring the same name on the same trace and span again replaces the value and keeps the score's id. Needs the `traces:write` scope. Keys from [`div login`](https://docs.divergentlabs.xyz/compute/cli/login.md) have it.

`<value>` is a number (`0.9`, `4`), `true` or `false`, or any other text, which is a category (`good`, `needs-work`).

## Flags

| Flag | Description |
| --- | --- |
| `--span <span>` | Score this span of the trace instead of the whole trace. `<span>` is a span id, 16 hex characters. |
| `--comment <text>` | A note kept with the score, up to 2,000 characters. |
| `--categorical` | Read the value as a category even if it looks like a number or a boolean. |
| `--delete` | Delete the score named by the second argument, whoever gave it. |
| `--json` | Print the score as JSON. |
| `--token <key>` | API key to use. |
| `--api-url <url>` | API URL to use. |

## Output

The score's id on stdout, and what was set on stderr:

```text
9b2c6f1e-4c55-4e0a-8a7e-2f0d1c3b5a61
helpfulness = 0.9 on trace 4bf92f3577b34da6a3ce929d0e0e4736 (new)
```

## Exit codes

| Code | Meaning |
| --- | --- |
| `0` | Success. |
| `1` | The API rejected the request, such as a trace that does not exist, or `trace_scores_cap` for a trace with 200 scores. |
| `2` | Invalid arguments, such as a missing value. |

## Examples

```bash
div score 4bf92f3577b34da6a3ce929d0e0e4736 helpfulness 0.9
div score 4bf92f3577b34da6a3ce929d0e0e4736 correct false --span 00f067aa0ba902b7
div score 4bf92f3577b34da6a3ce929d0e0e4736 stars 4 --categorical
div score 4bf92f3577b34da6a3ce929d0e0e4736 --delete 9b2c6f1e-4c55-4e0a-8a7e-2f0d1c3b5a61
```
