# client.corrections

> client.corrections — the corrections operations.

`client.corrections` — the `corrections` operations.

On `AsyncKindgi` every method is the same, awaited.

## `client.corrections.list()`

```python signature
list(
    *,
    limit: int | None = None,
    cursor: str | None = None,
    run_id: str | UUID | None = None,
    agent_id: str | UUID | None = None,
    agent_version: str | None = None,
    flow_id: str | UUID | None = None,
    status: Literal['not-fixed', 'open', 'being-fixed', 'with-owner', 'fixed', 'wont-fix', 'removed'] | list[Literal['not-fixed', 'open', 'being-fixed', 'with-owner', 'fixed', 'wont-fix', 'removed']] | None = None,
    sorted_to: Literal['none', 'improve', 'developer', 'owner'] | list[Literal['none', 'improve', 'developer', 'owner']] | None = None,
    from_: Literal['experts', 'end-users', 'all'] | None = None,
    made_by: Literal['me'] | None = None,
    since: str | None = None,
    until: str | None = None,
    corrector_group_id: str | UUID | None = None,
    participant_id: str | UUID | None = None,
    scope_kind: Literal['tenant', 'org', 'project'] | None = None,
    scope_id: str | UUID | None = None,
    timeout: float | None = None,
) -> CorrectionCollectionPage
```

List corrections. `GET /v1/corrections`

Corrections (not superseded, and not removed unless `status` asks for `removed`), newest first, cursor-paginated. Filter by run, agent (and version), flow, status, sorting, who made them, when, corrector group or participant; `?scopeKind + ?scopeId` narrow to a project. Each one comes back only when the caller may read its project.

## `client.corrections.create()`

```python signature
create(
    body: CreateCorrectionBody | Mapping[str, Any] | None = None,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
    **fields: Any,
) -> Correction
```

Correct a run. `POST /v1/corrections`

Records whether a finished run's decisions and answer were right, and what was right instead, optionally under a corrector group that applies to the run's project or agent (unclassified corrections count with weight 1). Each item's `pointer` (a JSON Pointer) must resolve in the run's output. It's sorted at save: an end user's correction stays open and unsorted; `decisions: "wrong"` goes to the agent's owner (`with-owner`); a wrong answer goes to Improve (`open`); nothing wrong is `fixed` as `recorded-right`. The first correction of a run also stores a copy of the run's input and output. `madeBy` is the authenticated caller, never the body. A second correction by the same caller for the same run and `participantId` supersedes the earlier one. Needs `write` on the run's project.

## `client.corrections.export()`

```python signature
export(
    *,
    format: Literal['csv', 'jsonl'] | None = None,
    run_id: str | UUID | None = None,
    agent_id: str | UUID,
    agent_version: str | None = None,
    flow_id: str | UUID | None = None,
    status: Literal['not-fixed', 'open', 'being-fixed', 'with-owner', 'fixed', 'wont-fix', 'removed'] | list[Literal['not-fixed', 'open', 'being-fixed', 'with-owner', 'fixed', 'wont-fix', 'removed']] | None = None,
    sorted_to: Literal['none', 'improve', 'developer', 'owner'] | list[Literal['none', 'improve', 'developer', 'owner']] | None = None,
    from_: Literal['experts', 'end-users', 'all'] | None = None,
    made_by: Literal['me'] | None = None,
    since: str | None = None,
    until: str | None = None,
    corrector_group_id: str | UUID | None = None,
    participant_id: str | UUID | None = None,
    scope_kind: Literal['tenant', 'org', 'project'] | None = None,
    scope_id: str | UUID | None = None,
    timeout: float | None = None,
) -> Iterator[bytes]
```

Export corrections. `GET /v1/corrections/export`

Every correction of an agent the list's filters match, streamed as CSV (`format=csv`, the default: RFC 4180, UTF-8, a header row) or JSON lines (`format=jsonl`: one correction per line, as the list sends it). Each comes only when the caller may read its project, and a project scope the caller can't read is a 403 before anything is sent. The run's own text isn't exported, only its id. A CSV field that starts with `=`, `+`, `-`, `@`, a tab or a carriage return gets a leading `'`, so a spreadsheet doesn't run it. Recorded in the audit log: `corrections-export-started` before the first row (when it can't be written, a 500 and nothing is sent), and `corrections-exported` when the stream ends, with the rows sent and `succeeded` or `failed`.

## `client.corrections.get()`

```python signature
get(
    correction_id: str | UUID,
    /,
    *,
    timeout: float | None = None,
) -> CorrectionWithCopies
```

Fetch a correction with its copies. `GET /v1/corrections/{correctionId}`

Returns the correction (live or not) with the stored copy of the run's input and output.

## `client.corrections.change()`

```python signature
change(
    correction_id: str | UUID,
    body: ChangeCorrectionBody | Mapping[str, Any] | None = None,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
    **fields: Any,
) -> Correction
```

Re-sort a correction or change its status. `PATCH /v1/corrections/{correctionId}`

A re-sort, a status, or both (the re-sort first), by the change table: re-sorting from `open`, `being-fixed` or `with-owner` (to `owner` sets `with-owner`; away from `owner`, `open`); `being-fixed` from `open` or `with-owner`, with `link`; `open` from `being-fixed` or `wont-fix` (`with-owner` for one sorted to the owner); `wont-fix` from anything but `removed`, with `reason`, and it drops `fixedIn`. `fixed` is set only by a pin or a deploy. Anything else is `409 correction-status-change-not-allowed`. Needs `publish` on the correction's agent (or flow), or, for one more than one project serves, `write` on the correction's project.

## `client.corrections.remove()`

```python signature
remove(
    correction_id: str | UUID,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
) -> RemoveCorrectionResult
```

Remove a correction. `POST /v1/corrections/{correctionId}/remove`

Its status becomes `removed`, and it can't come back. It lists only when `status=removed` is asked for; retention policy decides when it is purged. Needs to be its author, or `admin` on its project.

## `client.corrections.counts()`

```python signature
counts(
    *,
    agent_id: str | UUID | None = None,
    scope_kind: Literal['project'],
    scope_id: str | UUID,
    timeout: float | None = None,
) -> CorrectionCounts
```

Count corrections by status. `GET /v1/corrections/counts`

How many of a project's corrections (or one agent's in it) are in each status. Needs `?scopeKind=project&scopeId=<project>` and `read` on the project. Only a project scope is taken: the list filters each row by what the caller reads, and a count can't.
