# Review

## Create Extract Review

`client.extract.review.create(stringjobID, ReviewCreateParamsparams?, RequestOptionsoptions?): ExtractReview`

**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

- `jobID: string`

- `params: ReviewCreateParams`

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `confidence_threshold?: number`

    Body param: Fields read below this confidence are flagged.

  - `fields_in_scope?: Array<string>`

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

  - `required_fields?: Array<string> | null`

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

### Returns

- `ExtractReview`

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

  - `id: string`

    Unique identifier of the review.

  - `confidence_threshold: number`

    Fields read below this confidence are flagged.

  - `created_at: string`

    When review was turned on.

  - `decided_at: string | null`

    When it was approved or rejected.

  - `decided_by: string | null`

    ID of the user who approved or rejected it.

  - `decided_reason: string | null`

    Why it was rejected.

  - `field_actions: Record<string, FieldActions>`

    The latest action per field, keyed by JSON Pointer.

    - `action: "clear" | "confirm" | "correct"`

      confirm, correct or clear.

      - `"clear"`

      - `"confirm"`

      - `"correct"`

    - `actor_id: string`

      ID of the user who acted.

    - `at: string`

      When they acted.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `fields_in_scope: Array<string>`

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

  - `flags: Array<Flag>`

    Fields the review asks a person to check.

    - `handled: boolean`

      Whether someone confirmed, corrected or cleared it.

    - `path: string`

      JSON Pointer of the field.

    - `reason: "below_threshold" | "required_empty"`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"`

      - `"required_empty"`

    - `cell?: Cell | null`

      Where in a list the least confident value is.

      - `row: number`

        Index of the row, from 0.

      - `column?: string | null`

        Property of the row, when rows are objects.

    - `confidence?: number | null`

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

  - `job_id: string`

    The extract job reviewed.

  - `open_flags: Array<string>`

    JSON Pointers of flagged fields nobody checked.

  - `original_result: Record<string, unknown> | null`

    The result as the model read it.

  - `required_fields: Array<string>`

    JSON Pointers of fields flagged when empty.

  - `retain_until: string`

    When the job and its document may be deleted.

  - `reviewed_result: Record<string, unknown>`

    The result with the field actions.

  - `revision: number`

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

  - `source_file_id: string | null`

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

  - `status: "approved" | "pending" | "rejected"`

    pending until approved or rejected.

    - `"approved"`

    - `"pending"`

    - `"rejected"`

  - `updated_at: string`

    When the review last changed.

### Example

```typescript
import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const extractReview = await client.extract.review.create('job_id');

console.log(extractReview.id);
```

#### 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

`client.extract.review.get(stringjobID, ReviewGetParamsquery?, RequestOptionsoptions?): ExtractReview`

**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

- `jobID: string`

- `query: ReviewGetParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `ExtractReview`

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

  - `id: string`

    Unique identifier of the review.

  - `confidence_threshold: number`

    Fields read below this confidence are flagged.

  - `created_at: string`

    When review was turned on.

  - `decided_at: string | null`

    When it was approved or rejected.

  - `decided_by: string | null`

    ID of the user who approved or rejected it.

  - `decided_reason: string | null`

    Why it was rejected.

  - `field_actions: Record<string, FieldActions>`

    The latest action per field, keyed by JSON Pointer.

    - `action: "clear" | "confirm" | "correct"`

      confirm, correct or clear.

      - `"clear"`

      - `"confirm"`

      - `"correct"`

    - `actor_id: string`

      ID of the user who acted.

    - `at: string`

      When they acted.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `fields_in_scope: Array<string>`

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

  - `flags: Array<Flag>`

    Fields the review asks a person to check.

    - `handled: boolean`

      Whether someone confirmed, corrected or cleared it.

    - `path: string`

      JSON Pointer of the field.

    - `reason: "below_threshold" | "required_empty"`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"`

      - `"required_empty"`

    - `cell?: Cell | null`

      Where in a list the least confident value is.

      - `row: number`

        Index of the row, from 0.

      - `column?: string | null`

        Property of the row, when rows are objects.

    - `confidence?: number | null`

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

  - `job_id: string`

    The extract job reviewed.

  - `open_flags: Array<string>`

    JSON Pointers of flagged fields nobody checked.

  - `original_result: Record<string, unknown> | null`

    The result as the model read it.

  - `required_fields: Array<string>`

    JSON Pointers of fields flagged when empty.

  - `retain_until: string`

    When the job and its document may be deleted.

  - `reviewed_result: Record<string, unknown>`

    The result with the field actions.

  - `revision: number`

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

  - `source_file_id: string | null`

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

  - `status: "approved" | "pending" | "rejected"`

    pending until approved or rejected.

    - `"approved"`

    - `"pending"`

    - `"rejected"`

  - `updated_at: string`

    When the review last changed.

### Example

```typescript
import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const extractReview = await client.extract.review.get('job_id');

console.log(extractReview.id);
```

#### 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

`client.extract.review.changeFields(stringjobID, ReviewChangeFieldsParamsparams, RequestOptionsoptions?): ExtractReview`

**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

- `jobID: string`

- `params: ReviewChangeFieldsParams`

  - `changes: Array<Change>`

    Body param: Changes to apply, in order.

    - `change: "clear" | "confirm" | "correct" | 2 more`

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

      - `"clear"`

      - `"confirm"`

      - `"correct"`

      - `"restore"`

      - `"undo"`

    - `path: string`

      JSON Pointer of the field.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `revision: number`

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

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

### Returns

- `ExtractReview`

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

  - `id: string`

    Unique identifier of the review.

  - `confidence_threshold: number`

    Fields read below this confidence are flagged.

  - `created_at: string`

    When review was turned on.

  - `decided_at: string | null`

    When it was approved or rejected.

  - `decided_by: string | null`

    ID of the user who approved or rejected it.

  - `decided_reason: string | null`

    Why it was rejected.

  - `field_actions: Record<string, FieldActions>`

    The latest action per field, keyed by JSON Pointer.

    - `action: "clear" | "confirm" | "correct"`

      confirm, correct or clear.

      - `"clear"`

      - `"confirm"`

      - `"correct"`

    - `actor_id: string`

      ID of the user who acted.

    - `at: string`

      When they acted.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `fields_in_scope: Array<string>`

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

  - `flags: Array<Flag>`

    Fields the review asks a person to check.

    - `handled: boolean`

      Whether someone confirmed, corrected or cleared it.

    - `path: string`

      JSON Pointer of the field.

    - `reason: "below_threshold" | "required_empty"`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"`

      - `"required_empty"`

    - `cell?: Cell | null`

      Where in a list the least confident value is.

      - `row: number`

        Index of the row, from 0.

      - `column?: string | null`

        Property of the row, when rows are objects.

    - `confidence?: number | null`

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

  - `job_id: string`

    The extract job reviewed.

  - `open_flags: Array<string>`

    JSON Pointers of flagged fields nobody checked.

  - `original_result: Record<string, unknown> | null`

    The result as the model read it.

  - `required_fields: Array<string>`

    JSON Pointers of fields flagged when empty.

  - `retain_until: string`

    When the job and its document may be deleted.

  - `reviewed_result: Record<string, unknown>`

    The result with the field actions.

  - `revision: number`

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

  - `source_file_id: string | null`

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

  - `status: "approved" | "pending" | "rejected"`

    pending until approved or rejected.

    - `"approved"`

    - `"pending"`

    - `"rejected"`

  - `updated_at: string`

    When the review last changed.

### Example

```typescript
import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const extractReview = await client.extract.review.changeFields('job_id', {
  changes: [{ change: 'correct', path: '/total' }],
  revision: 0,
});

console.log(extractReview.id);
```

#### 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

`client.extract.review.approve(stringjobID, ReviewApproveParamsparams, RequestOptionsoptions?): ExtractReview`

**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

- `jobID: string`

- `params: ReviewApproveParams`

  - `revision: number`

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

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `sign_off?: boolean`

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

### Returns

- `ExtractReview`

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

  - `id: string`

    Unique identifier of the review.

  - `confidence_threshold: number`

    Fields read below this confidence are flagged.

  - `created_at: string`

    When review was turned on.

  - `decided_at: string | null`

    When it was approved or rejected.

  - `decided_by: string | null`

    ID of the user who approved or rejected it.

  - `decided_reason: string | null`

    Why it was rejected.

  - `field_actions: Record<string, FieldActions>`

    The latest action per field, keyed by JSON Pointer.

    - `action: "clear" | "confirm" | "correct"`

      confirm, correct or clear.

      - `"clear"`

      - `"confirm"`

      - `"correct"`

    - `actor_id: string`

      ID of the user who acted.

    - `at: string`

      When they acted.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `fields_in_scope: Array<string>`

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

  - `flags: Array<Flag>`

    Fields the review asks a person to check.

    - `handled: boolean`

      Whether someone confirmed, corrected or cleared it.

    - `path: string`

      JSON Pointer of the field.

    - `reason: "below_threshold" | "required_empty"`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"`

      - `"required_empty"`

    - `cell?: Cell | null`

      Where in a list the least confident value is.

      - `row: number`

        Index of the row, from 0.

      - `column?: string | null`

        Property of the row, when rows are objects.

    - `confidence?: number | null`

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

  - `job_id: string`

    The extract job reviewed.

  - `open_flags: Array<string>`

    JSON Pointers of flagged fields nobody checked.

  - `original_result: Record<string, unknown> | null`

    The result as the model read it.

  - `required_fields: Array<string>`

    JSON Pointers of fields flagged when empty.

  - `retain_until: string`

    When the job and its document may be deleted.

  - `reviewed_result: Record<string, unknown>`

    The result with the field actions.

  - `revision: number`

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

  - `source_file_id: string | null`

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

  - `status: "approved" | "pending" | "rejected"`

    pending until approved or rejected.

    - `"approved"`

    - `"pending"`

    - `"rejected"`

  - `updated_at: string`

    When the review last changed.

### Example

```typescript
import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const extractReview = await client.extract.review.approve('job_id', { revision: 0 });

console.log(extractReview.id);
```

#### 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

`client.extract.review.reject(stringjobID, ReviewRejectParamsparams, RequestOptionsoptions?): ExtractReview`

**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

- `jobID: string`

- `params: ReviewRejectParams`

  - `reason: string`

    Body param: Why the result was rejected.

  - `revision: number`

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

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

### Returns

- `ExtractReview`

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

  - `id: string`

    Unique identifier of the review.

  - `confidence_threshold: number`

    Fields read below this confidence are flagged.

  - `created_at: string`

    When review was turned on.

  - `decided_at: string | null`

    When it was approved or rejected.

  - `decided_by: string | null`

    ID of the user who approved or rejected it.

  - `decided_reason: string | null`

    Why it was rejected.

  - `field_actions: Record<string, FieldActions>`

    The latest action per field, keyed by JSON Pointer.

    - `action: "clear" | "confirm" | "correct"`

      confirm, correct or clear.

      - `"clear"`

      - `"confirm"`

      - `"correct"`

    - `actor_id: string`

      ID of the user who acted.

    - `at: string`

      When they acted.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `fields_in_scope: Array<string>`

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

  - `flags: Array<Flag>`

    Fields the review asks a person to check.

    - `handled: boolean`

      Whether someone confirmed, corrected or cleared it.

    - `path: string`

      JSON Pointer of the field.

    - `reason: "below_threshold" | "required_empty"`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"`

      - `"required_empty"`

    - `cell?: Cell | null`

      Where in a list the least confident value is.

      - `row: number`

        Index of the row, from 0.

      - `column?: string | null`

        Property of the row, when rows are objects.

    - `confidence?: number | null`

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

  - `job_id: string`

    The extract job reviewed.

  - `open_flags: Array<string>`

    JSON Pointers of flagged fields nobody checked.

  - `original_result: Record<string, unknown> | null`

    The result as the model read it.

  - `required_fields: Array<string>`

    JSON Pointers of fields flagged when empty.

  - `retain_until: string`

    When the job and its document may be deleted.

  - `reviewed_result: Record<string, unknown>`

    The result with the field actions.

  - `revision: number`

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

  - `source_file_id: string | null`

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

  - `status: "approved" | "pending" | "rejected"`

    pending until approved or rejected.

    - `"approved"`

    - `"pending"`

    - `"rejected"`

  - `updated_at: string`

    When the review last changed.

### Example

```typescript
import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const extractReview = await client.extract.review.reject('job_id', {
  reason: 'The invoice total does not match the line items.',
  revision: 0,
});

console.log(extractReview.id);
```

#### 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

`client.extract.review.reopen(stringjobID, ReviewReopenParamsparams, RequestOptionsoptions?): ExtractReview`

**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

- `jobID: string`

- `params: ReviewReopenParams`

  - `revision: number`

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

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

### Returns

- `ExtractReview`

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

  - `id: string`

    Unique identifier of the review.

  - `confidence_threshold: number`

    Fields read below this confidence are flagged.

  - `created_at: string`

    When review was turned on.

  - `decided_at: string | null`

    When it was approved or rejected.

  - `decided_by: string | null`

    ID of the user who approved or rejected it.

  - `decided_reason: string | null`

    Why it was rejected.

  - `field_actions: Record<string, FieldActions>`

    The latest action per field, keyed by JSON Pointer.

    - `action: "clear" | "confirm" | "correct"`

      confirm, correct or clear.

      - `"clear"`

      - `"confirm"`

      - `"correct"`

    - `actor_id: string`

      ID of the user who acted.

    - `at: string`

      When they acted.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `fields_in_scope: Array<string>`

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

  - `flags: Array<Flag>`

    Fields the review asks a person to check.

    - `handled: boolean`

      Whether someone confirmed, corrected or cleared it.

    - `path: string`

      JSON Pointer of the field.

    - `reason: "below_threshold" | "required_empty"`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"`

      - `"required_empty"`

    - `cell?: Cell | null`

      Where in a list the least confident value is.

      - `row: number`

        Index of the row, from 0.

      - `column?: string | null`

        Property of the row, when rows are objects.

    - `confidence?: number | null`

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

  - `job_id: string`

    The extract job reviewed.

  - `open_flags: Array<string>`

    JSON Pointers of flagged fields nobody checked.

  - `original_result: Record<string, unknown> | null`

    The result as the model read it.

  - `required_fields: Array<string>`

    JSON Pointers of fields flagged when empty.

  - `retain_until: string`

    When the job and its document may be deleted.

  - `reviewed_result: Record<string, unknown>`

    The result with the field actions.

  - `revision: number`

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

  - `source_file_id: string | null`

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

  - `status: "approved" | "pending" | "rejected"`

    pending until approved or rejected.

    - `"approved"`

    - `"pending"`

    - `"rejected"`

  - `updated_at: string`

    When the review last changed.

### Example

```typescript
import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const extractReview = await client.extract.review.reopen('job_id', { revision: 0 });

console.log(extractReview.id);
```

#### 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

`client.extract.review.listEvents(stringjobID, ReviewListEventsParamsquery?, RequestOptionsoptions?): PaginatedCursor<ExtractReviewEvent>`

**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

- `jobID: string`

- `query: ReviewListEventsParams`

  - `organization_id?: string | null`

  - `page_size?: number`

    Events per page.

  - `page_token?: string | null`

    Token from the previous page.

  - `project_id?: string | null`

### Returns

- `ExtractReviewEvent`

  One entry in a review's history.

  - `id: string`

    Unique identifier of the entry.

  - `actor_id: string`

    ID of the user who acted.

  - `created_at: string`

    When it happened.

  - `kind: "approved" | "created" | "field_cleared" | 7 more`

    What happened.

    - `"approved"`

    - `"created"`

    - `"field_cleared"`

    - `"field_confirmed"`

    - `"field_corrected"`

    - `"field_restored"`

    - `"field_undone"`

    - `"flags_signed_off"`

    - `"rejected"`

    - `"reopened"`

  - `detail?: ExtractReviewCreatedDetail | ExtractReviewRejectedDetail | ExtractReviewSignedOffDetail | null`

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

    - `ExtractReviewCreatedDetail`

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

      - `confidence_threshold: number`

        Fields read below this confidence are flagged.

      - `fields_in_scope: Array<string>`

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

      - `origin: "api" | "edit" | "history" | "run"`

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

        - `"api"`

        - `"edit"`

        - `"history"`

        - `"run"`

      - `required_fields: Array<string>`

        JSON Pointers of fields flagged when empty.

    - `ExtractReviewRejectedDetail`

      What a `rejected` entry records.

      - `reason: string`

        Why the result was rejected.

    - `ExtractReviewSignedOffDetail`

      What a `flags_signed_off` entry records.

      - `paths: Array<string>`

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

  - `path?: string | null`

    JSON Pointer of the field it changed.

  - `value_after?: unknown`

    The field's value after the change.

  - `value_before?: unknown`

    The field's value before the change.

### Example

```typescript
import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const extractReviewEvent of client.extract.review.listEvents('job_id')) {
  console.log(extractReviewEvent.id);
}
```

#### 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

- `ExtractReview`

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

  - `id: string`

    Unique identifier of the review.

  - `confidence_threshold: number`

    Fields read below this confidence are flagged.

  - `created_at: string`

    When review was turned on.

  - `decided_at: string | null`

    When it was approved or rejected.

  - `decided_by: string | null`

    ID of the user who approved or rejected it.

  - `decided_reason: string | null`

    Why it was rejected.

  - `field_actions: Record<string, FieldActions>`

    The latest action per field, keyed by JSON Pointer.

    - `action: "clear" | "confirm" | "correct"`

      confirm, correct or clear.

      - `"clear"`

      - `"confirm"`

      - `"correct"`

    - `actor_id: string`

      ID of the user who acted.

    - `at: string`

      When they acted.

    - `value?: unknown`

      The corrected value, for `correct`.

  - `fields_in_scope: Array<string>`

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

  - `flags: Array<Flag>`

    Fields the review asks a person to check.

    - `handled: boolean`

      Whether someone confirmed, corrected or cleared it.

    - `path: string`

      JSON Pointer of the field.

    - `reason: "below_threshold" | "required_empty"`

      below_threshold, or required_empty for a required field left empty.

      - `"below_threshold"`

      - `"required_empty"`

    - `cell?: Cell | null`

      Where in a list the least confident value is.

      - `row: number`

        Index of the row, from 0.

      - `column?: string | null`

        Property of the row, when rows are objects.

    - `confidence?: number | null`

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

  - `job_id: string`

    The extract job reviewed.

  - `open_flags: Array<string>`

    JSON Pointers of flagged fields nobody checked.

  - `original_result: Record<string, unknown> | null`

    The result as the model read it.

  - `required_fields: Array<string>`

    JSON Pointers of fields flagged when empty.

  - `retain_until: string`

    When the job and its document may be deleted.

  - `reviewed_result: Record<string, unknown>`

    The result with the field actions.

  - `revision: number`

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

  - `source_file_id: string | null`

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

  - `status: "approved" | "pending" | "rejected"`

    pending until approved or rejected.

    - `"approved"`

    - `"pending"`

    - `"rejected"`

  - `updated_at: string`

    When the review last changed.

### Extract Review Event

- `ExtractReviewEvent`

  One entry in a review's history.

  - `id: string`

    Unique identifier of the entry.

  - `actor_id: string`

    ID of the user who acted.

  - `created_at: string`

    When it happened.

  - `kind: "approved" | "created" | "field_cleared" | 7 more`

    What happened.

    - `"approved"`

    - `"created"`

    - `"field_cleared"`

    - `"field_confirmed"`

    - `"field_corrected"`

    - `"field_restored"`

    - `"field_undone"`

    - `"flags_signed_off"`

    - `"rejected"`

    - `"reopened"`

  - `detail?: ExtractReviewCreatedDetail | ExtractReviewRejectedDetail | ExtractReviewSignedOffDetail | null`

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

    - `ExtractReviewCreatedDetail`

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

      - `confidence_threshold: number`

        Fields read below this confidence are flagged.

      - `fields_in_scope: Array<string>`

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

      - `origin: "api" | "edit" | "history" | "run"`

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

        - `"api"`

        - `"edit"`

        - `"history"`

        - `"run"`

      - `required_fields: Array<string>`

        JSON Pointers of fields flagged when empty.

    - `ExtractReviewRejectedDetail`

      What a `rejected` entry records.

      - `reason: string`

        Why the result was rejected.

    - `ExtractReviewSignedOffDetail`

      What a `flags_signed_off` entry records.

      - `paths: Array<string>`

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

  - `path?: string | null`

    JSON Pointer of the field it changed.

  - `value_after?: unknown`

    The field's value after the change.

  - `value_before?: unknown`

    The field's value before the change.
