# Export corrections

GET

/v1/corrections/export

```sh
curl --request GET \
  --url 'https://example.com/v1/corrections/export?format=csv&agentId=example&from=experts&madeBy=me&scopeKind=tenant' \
  --header 'Authorization: Bearer <token>'
```

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`.

## Authorizations

- **[bearerAuth](https://docs.kindgi.com/v0.4.0/reference/api.md#bearerauth)**

## Parameters

### Query Parameters

**format**

string

Allowed values: csv jsonl

`csv` (the default) or `jsonl`.

**runId**

string

\>= 1 characters

Only corrections of this run.

**agentId**

required

string

\>= 1 characters

The agent whose corrections are exported.

**agentVersion**

string

\>= 1 characters

Only corrections of runs of this agent version. Needs `agentId`.

**flowId**

string

\>= 1 characters

Only corrections of runs of this flow.

**status**

Array\<string>

Allowed values: not-fixed open being-fixed with-owner fixed wont-fix removed

Only corrections in these statuses: one, or several, repeated or comma-separated. `not-fixed` is short for `open`, `being-fixed` and `with-owner`. Removed corrections come back only when `removed` is asked for.

**sortedTo**

Array\<string>

Allowed values: none improve developer owner

Only corrections sorted to these (repeated or comma-separated), with `none` for unsorted ones.

**from**

string

Allowed values: experts end-users all

`experts`: corrections under a restricted corrector group. `end-users`: an app’s end users’ (`participantId`), not experts’. `all` (the default): every one.

**madeBy**

string

Allowed values: me

`me`: only the caller’s own corrections.

**since**

string format: date-time

Only corrections made at or after this time.

**until**

string format: date-time

Only corrections made before this time.

**correctorGroupId**

string

\>= 1 characters

Only corrections recorded under this corrector group.

**participantId**

string

\>= 1 characters

Only corrections made for this app end user’s opaque id.

**scopeKind**

Discriminator for the ?scopeKind + ?scopeId + ?inherit triplet. Tenant carries no id (implicit from session); org/project require scopeId.

string

Allowed values: tenant org project

Optional scope discriminator. If absent, no scope filter is applied.

**scopeId**

string

\>= 1 characters

Required IF scopeKind is `org` or `project`. MUST be absent if scopeKind=`tenant` (tenant is implicit from the session). Malformed combinations return 400 scope-invalid.

## Responses

### 200

The corrections, as CSV or JSON lines (by `format`).

string

### 400

Malformed query parameter, no `agentId`, or a `limit` or `cursor`.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 401

Missing / malformed / expired / revoked bearer token.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 403

`permission-denied`: a project scope the caller can’t read.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 500

`persistence-error`: the export couldn’t be recorded, so nothing was sent.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 503

The database was too busy to answer in time (`database-busy`); `Retry-After` (whole seconds) says when to try again.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

## See also

- [Correct a run's output](https://docs.kindgi.com/v0.4.0/guides/improve/correct-a-runs-output.md)
- [Corrections reference](https://docs.kindgi.com/v0.4.0/guides/improve/expert-queue-reference.md)
- [Kindgi 0.4.0](https://docs.kindgi.com/v0.4.0/releases/0.4.0.md)
- [Error code `database-busy`](https://docs.kindgi.com/v0.4.0/reference/errors.md#database-busy)
- [Error code `permission-denied`](https://docs.kindgi.com/v0.4.0/reference/errors.md#permission-denied)
- [Error code `persistence-error`](https://docs.kindgi.com/v0.4.0/reference/errors.md#persistence-error)
- [Every error code](https://docs.kindgi.com/v0.4.0/reference/errors.md)
