# Review

## Create Extract Review

`ExtractReview Extract.Review.Create(ReviewCreateParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/extract/{job_id}/review`

Beta: answers 403 until extract review is enabled for the caller and their organization.

Turn review on for an extract job.

Fields read below `confidence_threshold`, and required fields left empty, are
flagged for a person to check. Every setting has a default, so the body can be
left out. A job still running can be named: it waits for review once it
completes. A job that failed or was cancelled without a review, or that cannot
be reviewed, answers 409 with `code: job_not_reviewable`; a field in
`fields_in_scope` the job's schema does not have answers 400.

Answers 201 with the new review, or 200 with the job's existing review, whose
settings stay as they are.

### Parameters

- `ReviewCreateParams parameters`

  - `required string jobID`

    Path param

  - `string? organizationID`

    Query param

  - `string? projectID`

    Query param

  - `Double confidenceThreshold`

    Body param: Fields read below this confidence are flagged.

  - `IReadOnlyList<string> fieldsInScope`

    Body param: JSON Pointers of the fields the threshold applies to; empty means all.

  - `IReadOnlyList<string>? requiredFields`

    Body param: JSON Pointers of fields flagged when empty; defaults to the schema's required.

### Returns

- `class ExtractReview:`

  An extract job's review: its settings, flags, field actions and decision,
  with the result as read and as reviewed.

  - `required string ID`

    Unique identifier of the review.

  - `required Double ConfidenceThreshold`

    Fields read below this confidence are flagged.

  - `required DateTimeOffset CreatedAt`

    When review was turned on.

  - `required DateTimeOffset? DecidedAt`

    When it was approved or rejected.

  - `required string? DecidedBy`

    ID of the user who approved or rejected it.

  - `required string? DecidedReason`

    Why it was rejected.

  - `required IReadOnlyDictionary<string, FieldActionsItem> FieldActions`

    The latest action per field, keyed by JSON Pointer.

    - `required Action Action`

      confirm, correct or clear.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset At`

      When they acted.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required IReadOnlyList<string> FieldsInScope`

    JSON Pointers of the fields the threshold applies to; empty means all.

  - `required IReadOnlyList<Flag> Flags`

    Fields the review asks a person to check.

    - `required Boolean Handled`

      Whether someone confirmed, corrected or cleared it.

    - `required string Path`

      JSON Pointer of the field.

    - `required Reason Reason`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"BelowThreshold`

      - `"required_empty"RequiredEmpty`

    - `Cell? Cell`

      Where in a list the least confident value is.

      - `required Long Row`

        Index of the row, from 0.

      - `string? Column`

        Property of the row, when rows are objects.

    - `Double? Confidence`

      The field's confidence; for a list, its least confident value.

  - `required string JobID`

    The extract job reviewed.

  - `required IReadOnlyList<string> OpenFlags`

    JSON Pointers of flagged fields nobody checked.

  - `required IReadOnlyDictionary<string, JsonElement>? OriginalResult`

    The result as the model read it.

  - `required IReadOnlyList<string> RequiredFields`

    JSON Pointers of fields flagged when empty.

  - `required DateTimeOffset RetainUntil`

    When the job and its document may be deleted.

  - `required IReadOnlyDictionary<string, JsonElement> ReviewedResult`

    The result with the field actions.

  - `required Long Revision`

    Bumped by every change; actions name the one they saw.

  - `required string? SourceFileID`

    The file the job read, or the file behind the parse job it read; null for a URL.

  - `required Status Status`

    pending until approved or rejected.

    - `"approved"Approved`

    - `"pending"Pending`

    - `"rejected"Rejected`

  - `required DateTimeOffset UpdatedAt`

    When the review last changed.

### Example

```csharp
ReviewCreateParams parameters = new() { JobID = "job_id" };

var extractReview = await client.Extract.Review.Create(parameters);

Console.WriteLine(extractReview);
```

#### Response

```json
{
  "id": "id",
  "confidence_threshold": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "decided_at": "2019-12-27T18:11:19.117Z",
  "decided_by": "decided_by",
  "decided_reason": "decided_reason",
  "field_actions": {
    "foo": {
      "action": "clear",
      "actor_id": "actor_id",
      "at": "2019-12-27T18:11:19.117Z",
      "value": {}
    }
  },
  "fields_in_scope": [
    "string"
  ],
  "flags": [
    {
      "handled": true,
      "path": "path",
      "reason": "below_threshold",
      "cell": {
        "row": 0,
        "column": "column"
      },
      "confidence": 0
    }
  ],
  "job_id": "job_id",
  "open_flags": [
    "string"
  ],
  "original_result": {
    "foo": "bar"
  },
  "required_fields": [
    "string"
  ],
  "retain_until": "2019-12-27T18:11:19.117Z",
  "reviewed_result": {
    "foo": "bar"
  },
  "revision": 0,
  "source_file_id": "source_file_id",
  "status": "approved",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Get Extract Review

`ExtractReview Extract.Review.Get(ReviewGetParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v2/extract/{job_id}/review`

Beta: answers 403 until extract review is enabled for the caller and their organization.

Get an extract job's review: its flags, field actions and decision, with the
result as the model read it and as reviewed. A job without a review answers 404.

### Parameters

- `ReviewGetParams parameters`

  - `required string jobID`

  - `string? organizationID`

  - `string? projectID`

### Returns

- `class ExtractReview:`

  An extract job's review: its settings, flags, field actions and decision,
  with the result as read and as reviewed.

  - `required string ID`

    Unique identifier of the review.

  - `required Double ConfidenceThreshold`

    Fields read below this confidence are flagged.

  - `required DateTimeOffset CreatedAt`

    When review was turned on.

  - `required DateTimeOffset? DecidedAt`

    When it was approved or rejected.

  - `required string? DecidedBy`

    ID of the user who approved or rejected it.

  - `required string? DecidedReason`

    Why it was rejected.

  - `required IReadOnlyDictionary<string, FieldActionsItem> FieldActions`

    The latest action per field, keyed by JSON Pointer.

    - `required Action Action`

      confirm, correct or clear.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset At`

      When they acted.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required IReadOnlyList<string> FieldsInScope`

    JSON Pointers of the fields the threshold applies to; empty means all.

  - `required IReadOnlyList<Flag> Flags`

    Fields the review asks a person to check.

    - `required Boolean Handled`

      Whether someone confirmed, corrected or cleared it.

    - `required string Path`

      JSON Pointer of the field.

    - `required Reason Reason`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"BelowThreshold`

      - `"required_empty"RequiredEmpty`

    - `Cell? Cell`

      Where in a list the least confident value is.

      - `required Long Row`

        Index of the row, from 0.

      - `string? Column`

        Property of the row, when rows are objects.

    - `Double? Confidence`

      The field's confidence; for a list, its least confident value.

  - `required string JobID`

    The extract job reviewed.

  - `required IReadOnlyList<string> OpenFlags`

    JSON Pointers of flagged fields nobody checked.

  - `required IReadOnlyDictionary<string, JsonElement>? OriginalResult`

    The result as the model read it.

  - `required IReadOnlyList<string> RequiredFields`

    JSON Pointers of fields flagged when empty.

  - `required DateTimeOffset RetainUntil`

    When the job and its document may be deleted.

  - `required IReadOnlyDictionary<string, JsonElement> ReviewedResult`

    The result with the field actions.

  - `required Long Revision`

    Bumped by every change; actions name the one they saw.

  - `required string? SourceFileID`

    The file the job read, or the file behind the parse job it read; null for a URL.

  - `required Status Status`

    pending until approved or rejected.

    - `"approved"Approved`

    - `"pending"Pending`

    - `"rejected"Rejected`

  - `required DateTimeOffset UpdatedAt`

    When the review last changed.

### Example

```csharp
ReviewGetParams parameters = new() { JobID = "job_id" };

var extractReview = await client.Extract.Review.Get(parameters);

Console.WriteLine(extractReview);
```

#### Response

```json
{
  "id": "id",
  "confidence_threshold": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "decided_at": "2019-12-27T18:11:19.117Z",
  "decided_by": "decided_by",
  "decided_reason": "decided_reason",
  "field_actions": {
    "foo": {
      "action": "clear",
      "actor_id": "actor_id",
      "at": "2019-12-27T18:11:19.117Z",
      "value": {}
    }
  },
  "fields_in_scope": [
    "string"
  ],
  "flags": [
    {
      "handled": true,
      "path": "path",
      "reason": "below_threshold",
      "cell": {
        "row": 0,
        "column": "column"
      },
      "confidence": 0
    }
  ],
  "job_id": "job_id",
  "open_flags": [
    "string"
  ],
  "original_result": {
    "foo": "bar"
  },
  "required_fields": [
    "string"
  ],
  "retain_until": "2019-12-27T18:11:19.117Z",
  "reviewed_result": {
    "foo": "bar"
  },
  "revision": 0,
  "source_file_id": "source_file_id",
  "status": "approved",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Change Extract Review Fields

`ExtractReview Extract.Review.ChangeFields(ReviewChangeFieldsParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/extract/{job_id}/review/fields`

Beta: answers 403 until extract review is enabled for the caller and their organization.

Confirm, correct, clear, restore or undo fields of a completed job.

The changes apply in order, in one write. A job without a review gets one with
the default settings, at revision 0. A path that is not a field of the job, or a
value the field's schema refuses, answers 400 and changes nothing.
A job that has not completed answers 409 with `code: job_not_reviewable`. A `revision` other than the review's latest answers 409 with `code: stale_revision` and the latest `revision`.

### Parameters

- `ReviewChangeFieldsParams parameters`

  - `required string jobID`

    Path param

  - `required IReadOnlyList<Change> changes`

    Body param: Changes to apply, in order.

    - `required Change Change`

      confirm, correct to `value`, clear, restore the model's value, or undo.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

      - `"restore"Restore`

      - `"undo"Undo`

    - `required string Path`

      JSON Pointer of the field.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required Long revision`

    Body param: The review's revision as the caller last read it.

  - `string? organizationID`

    Query param

  - `string? projectID`

    Query param

### Returns

- `class ExtractReview:`

  An extract job's review: its settings, flags, field actions and decision,
  with the result as read and as reviewed.

  - `required string ID`

    Unique identifier of the review.

  - `required Double ConfidenceThreshold`

    Fields read below this confidence are flagged.

  - `required DateTimeOffset CreatedAt`

    When review was turned on.

  - `required DateTimeOffset? DecidedAt`

    When it was approved or rejected.

  - `required string? DecidedBy`

    ID of the user who approved or rejected it.

  - `required string? DecidedReason`

    Why it was rejected.

  - `required IReadOnlyDictionary<string, FieldActionsItem> FieldActions`

    The latest action per field, keyed by JSON Pointer.

    - `required Action Action`

      confirm, correct or clear.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset At`

      When they acted.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required IReadOnlyList<string> FieldsInScope`

    JSON Pointers of the fields the threshold applies to; empty means all.

  - `required IReadOnlyList<Flag> Flags`

    Fields the review asks a person to check.

    - `required Boolean Handled`

      Whether someone confirmed, corrected or cleared it.

    - `required string Path`

      JSON Pointer of the field.

    - `required Reason Reason`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"BelowThreshold`

      - `"required_empty"RequiredEmpty`

    - `Cell? Cell`

      Where in a list the least confident value is.

      - `required Long Row`

        Index of the row, from 0.

      - `string? Column`

        Property of the row, when rows are objects.

    - `Double? Confidence`

      The field's confidence; for a list, its least confident value.

  - `required string JobID`

    The extract job reviewed.

  - `required IReadOnlyList<string> OpenFlags`

    JSON Pointers of flagged fields nobody checked.

  - `required IReadOnlyDictionary<string, JsonElement>? OriginalResult`

    The result as the model read it.

  - `required IReadOnlyList<string> RequiredFields`

    JSON Pointers of fields flagged when empty.

  - `required DateTimeOffset RetainUntil`

    When the job and its document may be deleted.

  - `required IReadOnlyDictionary<string, JsonElement> ReviewedResult`

    The result with the field actions.

  - `required Long Revision`

    Bumped by every change; actions name the one they saw.

  - `required string? SourceFileID`

    The file the job read, or the file behind the parse job it read; null for a URL.

  - `required Status Status`

    pending until approved or rejected.

    - `"approved"Approved`

    - `"pending"Pending`

    - `"rejected"Rejected`

  - `required DateTimeOffset UpdatedAt`

    When the review last changed.

### Example

```csharp
ReviewChangeFieldsParams parameters = new()
{
    JobID = "job_id",
    Changes =
    [
        new()
        {
            Change = Change.Correct,
            Path = "/total",
            Value = JsonSerializer.SerializeToElement(1250.5),
        },
    ],
    Revision = 0,
};

var extractReview = await client.Extract.Review.ChangeFields(parameters);

Console.WriteLine(extractReview);
```

#### Response

```json
{
  "id": "id",
  "confidence_threshold": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "decided_at": "2019-12-27T18:11:19.117Z",
  "decided_by": "decided_by",
  "decided_reason": "decided_reason",
  "field_actions": {
    "foo": {
      "action": "clear",
      "actor_id": "actor_id",
      "at": "2019-12-27T18:11:19.117Z",
      "value": {}
    }
  },
  "fields_in_scope": [
    "string"
  ],
  "flags": [
    {
      "handled": true,
      "path": "path",
      "reason": "below_threshold",
      "cell": {
        "row": 0,
        "column": "column"
      },
      "confidence": 0
    }
  ],
  "job_id": "job_id",
  "open_flags": [
    "string"
  ],
  "original_result": {
    "foo": "bar"
  },
  "required_fields": [
    "string"
  ],
  "retain_until": "2019-12-27T18:11:19.117Z",
  "reviewed_result": {
    "foo": "bar"
  },
  "revision": 0,
  "source_file_id": "source_file_id",
  "status": "approved",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Approve Extract Review

`ExtractReview Extract.Review.Approve(ReviewApproveParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/extract/{job_id}/review/approve`

Beta: answers 403 until extract review is enabled for the caller and their organization.

Approve the reviewed result.

While flagged fields nobody checked remain, answers 409 with `code: open_flags`
and their `paths`, unless `sign_off` confirms them as part of approving.
A job that has not completed answers 409 with `code: job_not_reviewable`. A `revision` other than the review's latest answers 409 with `code: stale_revision` and the latest `revision`.

### Parameters

- `ReviewApproveParams parameters`

  - `required string jobID`

    Path param

  - `required Long revision`

    Body param: The review's revision as the caller last read it.

  - `string? organizationID`

    Query param

  - `string? projectID`

    Query param

  - `Boolean signOff`

    Body param: Confirm the flagged fields nobody checked as part of approving.

### Returns

- `class ExtractReview:`

  An extract job's review: its settings, flags, field actions and decision,
  with the result as read and as reviewed.

  - `required string ID`

    Unique identifier of the review.

  - `required Double ConfidenceThreshold`

    Fields read below this confidence are flagged.

  - `required DateTimeOffset CreatedAt`

    When review was turned on.

  - `required DateTimeOffset? DecidedAt`

    When it was approved or rejected.

  - `required string? DecidedBy`

    ID of the user who approved or rejected it.

  - `required string? DecidedReason`

    Why it was rejected.

  - `required IReadOnlyDictionary<string, FieldActionsItem> FieldActions`

    The latest action per field, keyed by JSON Pointer.

    - `required Action Action`

      confirm, correct or clear.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset At`

      When they acted.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required IReadOnlyList<string> FieldsInScope`

    JSON Pointers of the fields the threshold applies to; empty means all.

  - `required IReadOnlyList<Flag> Flags`

    Fields the review asks a person to check.

    - `required Boolean Handled`

      Whether someone confirmed, corrected or cleared it.

    - `required string Path`

      JSON Pointer of the field.

    - `required Reason Reason`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"BelowThreshold`

      - `"required_empty"RequiredEmpty`

    - `Cell? Cell`

      Where in a list the least confident value is.

      - `required Long Row`

        Index of the row, from 0.

      - `string? Column`

        Property of the row, when rows are objects.

    - `Double? Confidence`

      The field's confidence; for a list, its least confident value.

  - `required string JobID`

    The extract job reviewed.

  - `required IReadOnlyList<string> OpenFlags`

    JSON Pointers of flagged fields nobody checked.

  - `required IReadOnlyDictionary<string, JsonElement>? OriginalResult`

    The result as the model read it.

  - `required IReadOnlyList<string> RequiredFields`

    JSON Pointers of fields flagged when empty.

  - `required DateTimeOffset RetainUntil`

    When the job and its document may be deleted.

  - `required IReadOnlyDictionary<string, JsonElement> ReviewedResult`

    The result with the field actions.

  - `required Long Revision`

    Bumped by every change; actions name the one they saw.

  - `required string? SourceFileID`

    The file the job read, or the file behind the parse job it read; null for a URL.

  - `required Status Status`

    pending until approved or rejected.

    - `"approved"Approved`

    - `"pending"Pending`

    - `"rejected"Rejected`

  - `required DateTimeOffset UpdatedAt`

    When the review last changed.

### Example

```csharp
ReviewApproveParams parameters = new()
{
    JobID = "job_id",
    Revision = 0,
};

var extractReview = await client.Extract.Review.Approve(parameters);

Console.WriteLine(extractReview);
```

#### Response

```json
{
  "id": "id",
  "confidence_threshold": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "decided_at": "2019-12-27T18:11:19.117Z",
  "decided_by": "decided_by",
  "decided_reason": "decided_reason",
  "field_actions": {
    "foo": {
      "action": "clear",
      "actor_id": "actor_id",
      "at": "2019-12-27T18:11:19.117Z",
      "value": {}
    }
  },
  "fields_in_scope": [
    "string"
  ],
  "flags": [
    {
      "handled": true,
      "path": "path",
      "reason": "below_threshold",
      "cell": {
        "row": 0,
        "column": "column"
      },
      "confidence": 0
    }
  ],
  "job_id": "job_id",
  "open_flags": [
    "string"
  ],
  "original_result": {
    "foo": "bar"
  },
  "required_fields": [
    "string"
  ],
  "retain_until": "2019-12-27T18:11:19.117Z",
  "reviewed_result": {
    "foo": "bar"
  },
  "revision": 0,
  "source_file_id": "source_file_id",
  "status": "approved",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Reject Extract Review

`ExtractReview Extract.Review.Reject(ReviewRejectParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/extract/{job_id}/review/reject`

Beta: answers 403 until extract review is enabled for the caller and their organization.

Reject the result, with a reason. A job that failed or was cancelled can be rejected,
which closes a review turned on while it ran. A job still queued or running answers
409 with `code: job_not_reviewable`. A `revision` other than the review's latest answers 409 with `code: stale_revision` and the latest `revision`.

### Parameters

- `ReviewRejectParams parameters`

  - `required string jobID`

    Path param

  - `required string reason`

    Body param: Why the result was rejected.

  - `required Long revision`

    Body param: The review's revision as the caller last read it.

  - `string? organizationID`

    Query param

  - `string? projectID`

    Query param

### Returns

- `class ExtractReview:`

  An extract job's review: its settings, flags, field actions and decision,
  with the result as read and as reviewed.

  - `required string ID`

    Unique identifier of the review.

  - `required Double ConfidenceThreshold`

    Fields read below this confidence are flagged.

  - `required DateTimeOffset CreatedAt`

    When review was turned on.

  - `required DateTimeOffset? DecidedAt`

    When it was approved or rejected.

  - `required string? DecidedBy`

    ID of the user who approved or rejected it.

  - `required string? DecidedReason`

    Why it was rejected.

  - `required IReadOnlyDictionary<string, FieldActionsItem> FieldActions`

    The latest action per field, keyed by JSON Pointer.

    - `required Action Action`

      confirm, correct or clear.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset At`

      When they acted.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required IReadOnlyList<string> FieldsInScope`

    JSON Pointers of the fields the threshold applies to; empty means all.

  - `required IReadOnlyList<Flag> Flags`

    Fields the review asks a person to check.

    - `required Boolean Handled`

      Whether someone confirmed, corrected or cleared it.

    - `required string Path`

      JSON Pointer of the field.

    - `required Reason Reason`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"BelowThreshold`

      - `"required_empty"RequiredEmpty`

    - `Cell? Cell`

      Where in a list the least confident value is.

      - `required Long Row`

        Index of the row, from 0.

      - `string? Column`

        Property of the row, when rows are objects.

    - `Double? Confidence`

      The field's confidence; for a list, its least confident value.

  - `required string JobID`

    The extract job reviewed.

  - `required IReadOnlyList<string> OpenFlags`

    JSON Pointers of flagged fields nobody checked.

  - `required IReadOnlyDictionary<string, JsonElement>? OriginalResult`

    The result as the model read it.

  - `required IReadOnlyList<string> RequiredFields`

    JSON Pointers of fields flagged when empty.

  - `required DateTimeOffset RetainUntil`

    When the job and its document may be deleted.

  - `required IReadOnlyDictionary<string, JsonElement> ReviewedResult`

    The result with the field actions.

  - `required Long Revision`

    Bumped by every change; actions name the one they saw.

  - `required string? SourceFileID`

    The file the job read, or the file behind the parse job it read; null for a URL.

  - `required Status Status`

    pending until approved or rejected.

    - `"approved"Approved`

    - `"pending"Pending`

    - `"rejected"Rejected`

  - `required DateTimeOffset UpdatedAt`

    When the review last changed.

### Example

```csharp
ReviewRejectParams parameters = new()
{
    JobID = "job_id",
    Reason = "The invoice total does not match the line items.",
    Revision = 0,
};

var extractReview = await client.Extract.Review.Reject(parameters);

Console.WriteLine(extractReview);
```

#### Response

```json
{
  "id": "id",
  "confidence_threshold": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "decided_at": "2019-12-27T18:11:19.117Z",
  "decided_by": "decided_by",
  "decided_reason": "decided_reason",
  "field_actions": {
    "foo": {
      "action": "clear",
      "actor_id": "actor_id",
      "at": "2019-12-27T18:11:19.117Z",
      "value": {}
    }
  },
  "fields_in_scope": [
    "string"
  ],
  "flags": [
    {
      "handled": true,
      "path": "path",
      "reason": "below_threshold",
      "cell": {
        "row": 0,
        "column": "column"
      },
      "confidence": 0
    }
  ],
  "job_id": "job_id",
  "open_flags": [
    "string"
  ],
  "original_result": {
    "foo": "bar"
  },
  "required_fields": [
    "string"
  ],
  "retain_until": "2019-12-27T18:11:19.117Z",
  "reviewed_result": {
    "foo": "bar"
  },
  "revision": 0,
  "source_file_id": "source_file_id",
  "status": "approved",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Reopen Extract Review

`ExtractReview Extract.Review.Reopen(ReviewReopenParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/extract/{job_id}/review/reopen`

Beta: answers 403 until extract review is enabled for the caller and their organization.

Put an approved or rejected review back to pending. Its field actions stay.

A `revision` other than the review's latest answers 409 with `code: stale_revision` and the latest `revision`.

### Parameters

- `ReviewReopenParams parameters`

  - `required string jobID`

    Path param

  - `required Long revision`

    Body param: The review's revision as the caller last read it.

  - `string? organizationID`

    Query param

  - `string? projectID`

    Query param

### Returns

- `class ExtractReview:`

  An extract job's review: its settings, flags, field actions and decision,
  with the result as read and as reviewed.

  - `required string ID`

    Unique identifier of the review.

  - `required Double ConfidenceThreshold`

    Fields read below this confidence are flagged.

  - `required DateTimeOffset CreatedAt`

    When review was turned on.

  - `required DateTimeOffset? DecidedAt`

    When it was approved or rejected.

  - `required string? DecidedBy`

    ID of the user who approved or rejected it.

  - `required string? DecidedReason`

    Why it was rejected.

  - `required IReadOnlyDictionary<string, FieldActionsItem> FieldActions`

    The latest action per field, keyed by JSON Pointer.

    - `required Action Action`

      confirm, correct or clear.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset At`

      When they acted.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required IReadOnlyList<string> FieldsInScope`

    JSON Pointers of the fields the threshold applies to; empty means all.

  - `required IReadOnlyList<Flag> Flags`

    Fields the review asks a person to check.

    - `required Boolean Handled`

      Whether someone confirmed, corrected or cleared it.

    - `required string Path`

      JSON Pointer of the field.

    - `required Reason Reason`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"BelowThreshold`

      - `"required_empty"RequiredEmpty`

    - `Cell? Cell`

      Where in a list the least confident value is.

      - `required Long Row`

        Index of the row, from 0.

      - `string? Column`

        Property of the row, when rows are objects.

    - `Double? Confidence`

      The field's confidence; for a list, its least confident value.

  - `required string JobID`

    The extract job reviewed.

  - `required IReadOnlyList<string> OpenFlags`

    JSON Pointers of flagged fields nobody checked.

  - `required IReadOnlyDictionary<string, JsonElement>? OriginalResult`

    The result as the model read it.

  - `required IReadOnlyList<string> RequiredFields`

    JSON Pointers of fields flagged when empty.

  - `required DateTimeOffset RetainUntil`

    When the job and its document may be deleted.

  - `required IReadOnlyDictionary<string, JsonElement> ReviewedResult`

    The result with the field actions.

  - `required Long Revision`

    Bumped by every change; actions name the one they saw.

  - `required string? SourceFileID`

    The file the job read, or the file behind the parse job it read; null for a URL.

  - `required Status Status`

    pending until approved or rejected.

    - `"approved"Approved`

    - `"pending"Pending`

    - `"rejected"Rejected`

  - `required DateTimeOffset UpdatedAt`

    When the review last changed.

### Example

```csharp
ReviewReopenParams parameters = new()
{
    JobID = "job_id",
    Revision = 0,
};

var extractReview = await client.Extract.Review.Reopen(parameters);

Console.WriteLine(extractReview);
```

#### Response

```json
{
  "id": "id",
  "confidence_threshold": 0,
  "created_at": "2019-12-27T18:11:19.117Z",
  "decided_at": "2019-12-27T18:11:19.117Z",
  "decided_by": "decided_by",
  "decided_reason": "decided_reason",
  "field_actions": {
    "foo": {
      "action": "clear",
      "actor_id": "actor_id",
      "at": "2019-12-27T18:11:19.117Z",
      "value": {}
    }
  },
  "fields_in_scope": [
    "string"
  ],
  "flags": [
    {
      "handled": true,
      "path": "path",
      "reason": "below_threshold",
      "cell": {
        "row": 0,
        "column": "column"
      },
      "confidence": 0
    }
  ],
  "job_id": "job_id",
  "open_flags": [
    "string"
  ],
  "original_result": {
    "foo": "bar"
  },
  "required_fields": [
    "string"
  ],
  "retain_until": "2019-12-27T18:11:19.117Z",
  "reviewed_result": {
    "foo": "bar"
  },
  "revision": 0,
  "source_file_id": "source_file_id",
  "status": "approved",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## List Extract Review Events

`ReviewListEventsPageResponse Extract.Review.ListEvents(ReviewListEventsParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v2/extract/{job_id}/review/events`

Beta: answers 403 until extract review is enabled for the caller and their organization.

List a review's history, newest first.

### Parameters

- `ReviewListEventsParams parameters`

  - `required string jobID`

  - `string? organizationID`

  - `Long pageSize`

    Events per page.

  - `string? pageToken`

    Token from the previous page.

  - `string? projectID`

### Returns

- `class ReviewListEventsPageResponse:`

  A page of a review's history, newest first.

  - `required IReadOnlyList<ExtractReviewEvent> Items`

    The list of items.

    - `required string ID`

      Unique identifier of the entry.

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset CreatedAt`

      When it happened.

    - `required Kind Kind`

      What happened.

      - `"approved"Approved`

      - `"created"Created`

      - `"field_cleared"FieldCleared`

      - `"field_confirmed"FieldConfirmed`

      - `"field_corrected"FieldCorrected`

      - `"field_restored"FieldRestored`

      - `"field_undone"FieldUndone`

      - `"flags_signed_off"FlagsSignedOff`

      - `"rejected"Rejected`

      - `"reopened"Reopened`

    - `Detail? Detail`

      The settings for `created`, the reason for `rejected`, and the fields for `flags_signed_off`; null for the rest.

      - `class ExtractReviewCreatedDetail:`

        What a `created` entry records: where review was turned on, and its settings.

        - `required Double ConfidenceThreshold`

          Fields read below this confidence are flagged.

        - `required IReadOnlyList<string> FieldsInScope`

          JSON Pointers of the fields the threshold applies to; empty means all.

        - `required Origin Origin`

          Turned on as the job ran, from History, by a first edit, or by the API.

          - `"api"Api`

          - `"edit"Edit`

          - `"history"History`

          - `"run"Run`

        - `required IReadOnlyList<string> RequiredFields`

          JSON Pointers of fields flagged when empty.

      - `class ExtractReviewRejectedDetail:`

        What a `rejected` entry records.

        - `required string Reason`

          Why the result was rejected.

      - `class ExtractReviewSignedOffDetail:`

        What a `flags_signed_off` entry records.

        - `required IReadOnlyList<string> Paths`

          JSON Pointers of the flagged fields confirmed as part of approving.

    - `string? Path`

      JSON Pointer of the field it changed.

    - `JsonElement ValueAfter`

      The field's value after the change.

    - `JsonElement ValueBefore`

      The field's value before the change.

  - `string? NextPageToken`

    A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

  - `Long? TotalSize`

    The total number of items available. This is only populated when specifically requested. The value may be an estimate and can be used for display purposes only.

### Example

```csharp
ReviewListEventsParams parameters = new() { JobID = "job_id" };

var page = await client.Extract.Review.ListEvents(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "actor_id": "actor_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "kind": "approved",
      "detail": {
        "confidence_threshold": 0,
        "fields_in_scope": [
          "string"
        ],
        "origin": "api",
        "required_fields": [
          "string"
        ]
      },
      "path": "path",
      "value_after": {},
      "value_before": {}
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Domain Types

### Extract Review

- `class ExtractReview:`

  An extract job's review: its settings, flags, field actions and decision,
  with the result as read and as reviewed.

  - `required string ID`

    Unique identifier of the review.

  - `required Double ConfidenceThreshold`

    Fields read below this confidence are flagged.

  - `required DateTimeOffset CreatedAt`

    When review was turned on.

  - `required DateTimeOffset? DecidedAt`

    When it was approved or rejected.

  - `required string? DecidedBy`

    ID of the user who approved or rejected it.

  - `required string? DecidedReason`

    Why it was rejected.

  - `required IReadOnlyDictionary<string, FieldActionsItem> FieldActions`

    The latest action per field, keyed by JSON Pointer.

    - `required Action Action`

      confirm, correct or clear.

      - `"clear"Clear`

      - `"confirm"Confirm`

      - `"correct"Correct`

    - `required string ActorID`

      ID of the user who acted.

    - `required DateTimeOffset At`

      When they acted.

    - `JsonElement Value`

      The corrected value, for `correct`.

  - `required IReadOnlyList<string> FieldsInScope`

    JSON Pointers of the fields the threshold applies to; empty means all.

  - `required IReadOnlyList<Flag> Flags`

    Fields the review asks a person to check.

    - `required Boolean Handled`

      Whether someone confirmed, corrected or cleared it.

    - `required string Path`

      JSON Pointer of the field.

    - `required Reason Reason`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"BelowThreshold`

      - `"required_empty"RequiredEmpty`

    - `Cell? Cell`

      Where in a list the least confident value is.

      - `required Long Row`

        Index of the row, from 0.

      - `string? Column`

        Property of the row, when rows are objects.

    - `Double? Confidence`

      The field's confidence; for a list, its least confident value.

  - `required string JobID`

    The extract job reviewed.

  - `required IReadOnlyList<string> OpenFlags`

    JSON Pointers of flagged fields nobody checked.

  - `required IReadOnlyDictionary<string, JsonElement>? OriginalResult`

    The result as the model read it.

  - `required IReadOnlyList<string> RequiredFields`

    JSON Pointers of fields flagged when empty.

  - `required DateTimeOffset RetainUntil`

    When the job and its document may be deleted.

  - `required IReadOnlyDictionary<string, JsonElement> ReviewedResult`

    The result with the field actions.

  - `required Long Revision`

    Bumped by every change; actions name the one they saw.

  - `required string? SourceFileID`

    The file the job read, or the file behind the parse job it read; null for a URL.

  - `required Status Status`

    pending until approved or rejected.

    - `"approved"Approved`

    - `"pending"Pending`

    - `"rejected"Rejected`

  - `required DateTimeOffset UpdatedAt`

    When the review last changed.

### Extract Review Event

- `class ExtractReviewEvent:`

  One entry in a review's history.

  - `required string ID`

    Unique identifier of the entry.

  - `required string ActorID`

    ID of the user who acted.

  - `required DateTimeOffset CreatedAt`

    When it happened.

  - `required Kind Kind`

    What happened.

    - `"approved"Approved`

    - `"created"Created`

    - `"field_cleared"FieldCleared`

    - `"field_confirmed"FieldConfirmed`

    - `"field_corrected"FieldCorrected`

    - `"field_restored"FieldRestored`

    - `"field_undone"FieldUndone`

    - `"flags_signed_off"FlagsSignedOff`

    - `"rejected"Rejected`

    - `"reopened"Reopened`

  - `Detail? Detail`

    The settings for `created`, the reason for `rejected`, and the fields for `flags_signed_off`; null for the rest.

    - `class ExtractReviewCreatedDetail:`

      What a `created` entry records: where review was turned on, and its settings.

      - `required Double ConfidenceThreshold`

        Fields read below this confidence are flagged.

      - `required IReadOnlyList<string> FieldsInScope`

        JSON Pointers of the fields the threshold applies to; empty means all.

      - `required Origin Origin`

        Turned on as the job ran, from History, by a first edit, or by the API.

        - `"api"Api`

        - `"edit"Edit`

        - `"history"History`

        - `"run"Run`

      - `required IReadOnlyList<string> RequiredFields`

        JSON Pointers of fields flagged when empty.

    - `class ExtractReviewRejectedDetail:`

      What a `rejected` entry records.

      - `required string Reason`

        Why the result was rejected.

    - `class ExtractReviewSignedOffDetail:`

      What a `flags_signed_off` entry records.

      - `required IReadOnlyList<string> Paths`

        JSON Pointers of the flagged fields confirmed as part of approving.

  - `string? Path`

    JSON Pointer of the field it changed.

  - `JsonElement ValueAfter`

    The field's value after the change.

  - `JsonElement ValueBefore`

    The field's value before the change.
