# Review

## Create Extract Review

`client.Extract.Review.New(ctx, jobID, params) (*ExtractReview, error)`

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

  - `OrganizationID param.Field[string]`

    Query param

  - `ProjectID param.Field[string]`

    Query param

  - `ConfidenceThreshold param.Field[float64]`

    Body param: Fields read below this confidence are flagged.

  - `FieldsInScope param.Field[[]string]`

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

  - `RequiredFields param.Field[[]string]`

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

### Returns

- `type ExtractReview struct{…}`

  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.

  - `ConfidenceThreshold float64`

    Fields read below this confidence are flagged.

  - `CreatedAt Time`

    When review was turned on.

  - `DecidedAt Time`

    When it was approved or rejected.

  - `DecidedBy string`

    ID of the user who approved or rejected it.

  - `DecidedReason string`

    Why it was rejected.

  - `FieldActions map[string, ExtractReviewFieldAction]`

    The latest action per field, keyed by JSON Pointer.

    - `Action string`

      confirm, correct or clear.

      - `const ExtractReviewFieldActionActionClear ExtractReviewFieldActionAction = "clear"`

      - `const ExtractReviewFieldActionActionConfirm ExtractReviewFieldActionAction = "confirm"`

      - `const ExtractReviewFieldActionActionCorrect ExtractReviewFieldActionAction = "correct"`

    - `ActorID string`

      ID of the user who acted.

    - `At Time`

      When they acted.

    - `Value any`

      The corrected value, for `correct`.

  - `FieldsInScope []string`

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

  - `Flags []ExtractReviewFlag`

    Fields the review asks a person to check.

    - `Handled bool`

      Whether someone confirmed, corrected or cleared it.

    - `Path string`

      JSON Pointer of the field.

    - `Reason string`

      below_threshold, or required_empty for a required field left empty.

      - `const ExtractReviewFlagReasonBelowThreshold ExtractReviewFlagReason = "below_threshold"`

      - `const ExtractReviewFlagReasonRequiredEmpty ExtractReviewFlagReason = "required_empty"`

    - `Cell ExtractReviewFlagCell`

      Where in a list the least confident value is.

      - `Row int64`

        Index of the row, from 0.

      - `Column string`

        Property of the row, when rows are objects.

    - `Confidence float64`

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

  - `JobID string`

    The extract job reviewed.

  - `OpenFlags []string`

    JSON Pointers of flagged fields nobody checked.

  - `OriginalResult map[string, any]`

    The result as the model read it.

  - `RequiredFields []string`

    JSON Pointers of fields flagged when empty.

  - `RetainUntil Time`

    When the job and its document may be deleted.

  - `ReviewedResult map[string, any]`

    The result with the field actions.

  - `Revision int64`

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

  - `SourceFileID string`

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

  - `Status ExtractReviewStatus`

    pending until approved or rejected.

    - `const ExtractReviewStatusApproved ExtractReviewStatus = "approved"`

    - `const ExtractReviewStatusPending ExtractReviewStatus = "pending"`

    - `const ExtractReviewStatusRejected ExtractReviewStatus = "rejected"`

  - `UpdatedAt Time`

    When the review last changed.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  extractReview, err := client.Extract.Review.New(
    context.TODO(),
    "job_id",
    llamacloud.ExtractReviewNewParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, jobID, query) (*ExtractReview, error)`

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

  - `OrganizationID param.Field[string]`

  - `ProjectID param.Field[string]`

### Returns

- `type ExtractReview struct{…}`

  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.

  - `ConfidenceThreshold float64`

    Fields read below this confidence are flagged.

  - `CreatedAt Time`

    When review was turned on.

  - `DecidedAt Time`

    When it was approved or rejected.

  - `DecidedBy string`

    ID of the user who approved or rejected it.

  - `DecidedReason string`

    Why it was rejected.

  - `FieldActions map[string, ExtractReviewFieldAction]`

    The latest action per field, keyed by JSON Pointer.

    - `Action string`

      confirm, correct or clear.

      - `const ExtractReviewFieldActionActionClear ExtractReviewFieldActionAction = "clear"`

      - `const ExtractReviewFieldActionActionConfirm ExtractReviewFieldActionAction = "confirm"`

      - `const ExtractReviewFieldActionActionCorrect ExtractReviewFieldActionAction = "correct"`

    - `ActorID string`

      ID of the user who acted.

    - `At Time`

      When they acted.

    - `Value any`

      The corrected value, for `correct`.

  - `FieldsInScope []string`

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

  - `Flags []ExtractReviewFlag`

    Fields the review asks a person to check.

    - `Handled bool`

      Whether someone confirmed, corrected or cleared it.

    - `Path string`

      JSON Pointer of the field.

    - `Reason string`

      below_threshold, or required_empty for a required field left empty.

      - `const ExtractReviewFlagReasonBelowThreshold ExtractReviewFlagReason = "below_threshold"`

      - `const ExtractReviewFlagReasonRequiredEmpty ExtractReviewFlagReason = "required_empty"`

    - `Cell ExtractReviewFlagCell`

      Where in a list the least confident value is.

      - `Row int64`

        Index of the row, from 0.

      - `Column string`

        Property of the row, when rows are objects.

    - `Confidence float64`

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

  - `JobID string`

    The extract job reviewed.

  - `OpenFlags []string`

    JSON Pointers of flagged fields nobody checked.

  - `OriginalResult map[string, any]`

    The result as the model read it.

  - `RequiredFields []string`

    JSON Pointers of fields flagged when empty.

  - `RetainUntil Time`

    When the job and its document may be deleted.

  - `ReviewedResult map[string, any]`

    The result with the field actions.

  - `Revision int64`

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

  - `SourceFileID string`

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

  - `Status ExtractReviewStatus`

    pending until approved or rejected.

    - `const ExtractReviewStatusApproved ExtractReviewStatus = "approved"`

    - `const ExtractReviewStatusPending ExtractReviewStatus = "pending"`

    - `const ExtractReviewStatusRejected ExtractReviewStatus = "rejected"`

  - `UpdatedAt Time`

    When the review last changed.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  extractReview, err := client.Extract.Review.Get(
    context.TODO(),
    "job_id",
    llamacloud.ExtractReviewGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, jobID, params) (*ExtractReview, error)`

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

  - `Changes param.Field[[]ExtractReviewChangeFieldsParamsChange]`

    Body param: Changes to apply, in order.

    - `Change string`

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

      - `const ExtractReviewChangeFieldsParamsChangeChangeClear ExtractReviewChangeFieldsParamsChangeChange = "clear"`

      - `const ExtractReviewChangeFieldsParamsChangeChangeConfirm ExtractReviewChangeFieldsParamsChangeChange = "confirm"`

      - `const ExtractReviewChangeFieldsParamsChangeChangeCorrect ExtractReviewChangeFieldsParamsChangeChange = "correct"`

      - `const ExtractReviewChangeFieldsParamsChangeChangeRestore ExtractReviewChangeFieldsParamsChangeChange = "restore"`

      - `const ExtractReviewChangeFieldsParamsChangeChangeUndo ExtractReviewChangeFieldsParamsChangeChange = "undo"`

    - `Path string`

      JSON Pointer of the field.

    - `Value any`

      The corrected value, for `correct`.

  - `Revision param.Field[int64]`

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

  - `OrganizationID param.Field[string]`

    Query param

  - `ProjectID param.Field[string]`

    Query param

### Returns

- `type ExtractReview struct{…}`

  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.

  - `ConfidenceThreshold float64`

    Fields read below this confidence are flagged.

  - `CreatedAt Time`

    When review was turned on.

  - `DecidedAt Time`

    When it was approved or rejected.

  - `DecidedBy string`

    ID of the user who approved or rejected it.

  - `DecidedReason string`

    Why it was rejected.

  - `FieldActions map[string, ExtractReviewFieldAction]`

    The latest action per field, keyed by JSON Pointer.

    - `Action string`

      confirm, correct or clear.

      - `const ExtractReviewFieldActionActionClear ExtractReviewFieldActionAction = "clear"`

      - `const ExtractReviewFieldActionActionConfirm ExtractReviewFieldActionAction = "confirm"`

      - `const ExtractReviewFieldActionActionCorrect ExtractReviewFieldActionAction = "correct"`

    - `ActorID string`

      ID of the user who acted.

    - `At Time`

      When they acted.

    - `Value any`

      The corrected value, for `correct`.

  - `FieldsInScope []string`

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

  - `Flags []ExtractReviewFlag`

    Fields the review asks a person to check.

    - `Handled bool`

      Whether someone confirmed, corrected or cleared it.

    - `Path string`

      JSON Pointer of the field.

    - `Reason string`

      below_threshold, or required_empty for a required field left empty.

      - `const ExtractReviewFlagReasonBelowThreshold ExtractReviewFlagReason = "below_threshold"`

      - `const ExtractReviewFlagReasonRequiredEmpty ExtractReviewFlagReason = "required_empty"`

    - `Cell ExtractReviewFlagCell`

      Where in a list the least confident value is.

      - `Row int64`

        Index of the row, from 0.

      - `Column string`

        Property of the row, when rows are objects.

    - `Confidence float64`

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

  - `JobID string`

    The extract job reviewed.

  - `OpenFlags []string`

    JSON Pointers of flagged fields nobody checked.

  - `OriginalResult map[string, any]`

    The result as the model read it.

  - `RequiredFields []string`

    JSON Pointers of fields flagged when empty.

  - `RetainUntil Time`

    When the job and its document may be deleted.

  - `ReviewedResult map[string, any]`

    The result with the field actions.

  - `Revision int64`

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

  - `SourceFileID string`

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

  - `Status ExtractReviewStatus`

    pending until approved or rejected.

    - `const ExtractReviewStatusApproved ExtractReviewStatus = "approved"`

    - `const ExtractReviewStatusPending ExtractReviewStatus = "pending"`

    - `const ExtractReviewStatusRejected ExtractReviewStatus = "rejected"`

  - `UpdatedAt Time`

    When the review last changed.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  extractReview, err := client.Extract.Review.ChangeFields(
    context.TODO(),
    "job_id",
    llamacloud.ExtractReviewChangeFieldsParams{
      Changes: []llamacloud.ExtractReviewChangeFieldsParamsChange{llamacloud.ExtractReviewChangeFieldsParamsChange{
        Change: "correct",
        Path: "/total",
      }},
      Revision: 0,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, jobID, params) (*ExtractReview, error)`

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

  - `Revision param.Field[int64]`

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

  - `OrganizationID param.Field[string]`

    Query param

  - `ProjectID param.Field[string]`

    Query param

  - `SignOff param.Field[bool]`

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

### Returns

- `type ExtractReview struct{…}`

  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.

  - `ConfidenceThreshold float64`

    Fields read below this confidence are flagged.

  - `CreatedAt Time`

    When review was turned on.

  - `DecidedAt Time`

    When it was approved or rejected.

  - `DecidedBy string`

    ID of the user who approved or rejected it.

  - `DecidedReason string`

    Why it was rejected.

  - `FieldActions map[string, ExtractReviewFieldAction]`

    The latest action per field, keyed by JSON Pointer.

    - `Action string`

      confirm, correct or clear.

      - `const ExtractReviewFieldActionActionClear ExtractReviewFieldActionAction = "clear"`

      - `const ExtractReviewFieldActionActionConfirm ExtractReviewFieldActionAction = "confirm"`

      - `const ExtractReviewFieldActionActionCorrect ExtractReviewFieldActionAction = "correct"`

    - `ActorID string`

      ID of the user who acted.

    - `At Time`

      When they acted.

    - `Value any`

      The corrected value, for `correct`.

  - `FieldsInScope []string`

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

  - `Flags []ExtractReviewFlag`

    Fields the review asks a person to check.

    - `Handled bool`

      Whether someone confirmed, corrected or cleared it.

    - `Path string`

      JSON Pointer of the field.

    - `Reason string`

      below_threshold, or required_empty for a required field left empty.

      - `const ExtractReviewFlagReasonBelowThreshold ExtractReviewFlagReason = "below_threshold"`

      - `const ExtractReviewFlagReasonRequiredEmpty ExtractReviewFlagReason = "required_empty"`

    - `Cell ExtractReviewFlagCell`

      Where in a list the least confident value is.

      - `Row int64`

        Index of the row, from 0.

      - `Column string`

        Property of the row, when rows are objects.

    - `Confidence float64`

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

  - `JobID string`

    The extract job reviewed.

  - `OpenFlags []string`

    JSON Pointers of flagged fields nobody checked.

  - `OriginalResult map[string, any]`

    The result as the model read it.

  - `RequiredFields []string`

    JSON Pointers of fields flagged when empty.

  - `RetainUntil Time`

    When the job and its document may be deleted.

  - `ReviewedResult map[string, any]`

    The result with the field actions.

  - `Revision int64`

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

  - `SourceFileID string`

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

  - `Status ExtractReviewStatus`

    pending until approved or rejected.

    - `const ExtractReviewStatusApproved ExtractReviewStatus = "approved"`

    - `const ExtractReviewStatusPending ExtractReviewStatus = "pending"`

    - `const ExtractReviewStatusRejected ExtractReviewStatus = "rejected"`

  - `UpdatedAt Time`

    When the review last changed.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  extractReview, err := client.Extract.Review.Approve(
    context.TODO(),
    "job_id",
    llamacloud.ExtractReviewApproveParams{
      Revision: 0,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, jobID, params) (*ExtractReview, error)`

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

  - `Reason param.Field[string]`

    Body param: Why the result was rejected.

  - `Revision param.Field[int64]`

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

  - `OrganizationID param.Field[string]`

    Query param

  - `ProjectID param.Field[string]`

    Query param

### Returns

- `type ExtractReview struct{…}`

  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.

  - `ConfidenceThreshold float64`

    Fields read below this confidence are flagged.

  - `CreatedAt Time`

    When review was turned on.

  - `DecidedAt Time`

    When it was approved or rejected.

  - `DecidedBy string`

    ID of the user who approved or rejected it.

  - `DecidedReason string`

    Why it was rejected.

  - `FieldActions map[string, ExtractReviewFieldAction]`

    The latest action per field, keyed by JSON Pointer.

    - `Action string`

      confirm, correct or clear.

      - `const ExtractReviewFieldActionActionClear ExtractReviewFieldActionAction = "clear"`

      - `const ExtractReviewFieldActionActionConfirm ExtractReviewFieldActionAction = "confirm"`

      - `const ExtractReviewFieldActionActionCorrect ExtractReviewFieldActionAction = "correct"`

    - `ActorID string`

      ID of the user who acted.

    - `At Time`

      When they acted.

    - `Value any`

      The corrected value, for `correct`.

  - `FieldsInScope []string`

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

  - `Flags []ExtractReviewFlag`

    Fields the review asks a person to check.

    - `Handled bool`

      Whether someone confirmed, corrected or cleared it.

    - `Path string`

      JSON Pointer of the field.

    - `Reason string`

      below_threshold, or required_empty for a required field left empty.

      - `const ExtractReviewFlagReasonBelowThreshold ExtractReviewFlagReason = "below_threshold"`

      - `const ExtractReviewFlagReasonRequiredEmpty ExtractReviewFlagReason = "required_empty"`

    - `Cell ExtractReviewFlagCell`

      Where in a list the least confident value is.

      - `Row int64`

        Index of the row, from 0.

      - `Column string`

        Property of the row, when rows are objects.

    - `Confidence float64`

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

  - `JobID string`

    The extract job reviewed.

  - `OpenFlags []string`

    JSON Pointers of flagged fields nobody checked.

  - `OriginalResult map[string, any]`

    The result as the model read it.

  - `RequiredFields []string`

    JSON Pointers of fields flagged when empty.

  - `RetainUntil Time`

    When the job and its document may be deleted.

  - `ReviewedResult map[string, any]`

    The result with the field actions.

  - `Revision int64`

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

  - `SourceFileID string`

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

  - `Status ExtractReviewStatus`

    pending until approved or rejected.

    - `const ExtractReviewStatusApproved ExtractReviewStatus = "approved"`

    - `const ExtractReviewStatusPending ExtractReviewStatus = "pending"`

    - `const ExtractReviewStatusRejected ExtractReviewStatus = "rejected"`

  - `UpdatedAt Time`

    When the review last changed.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  extractReview, err := client.Extract.Review.Reject(
    context.TODO(),
    "job_id",
    llamacloud.ExtractReviewRejectParams{
      Reason: "The invoice total does not match the line items.",
      Revision: 0,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, jobID, params) (*ExtractReview, error)`

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

  - `Revision param.Field[int64]`

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

  - `OrganizationID param.Field[string]`

    Query param

  - `ProjectID param.Field[string]`

    Query param

### Returns

- `type ExtractReview struct{…}`

  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.

  - `ConfidenceThreshold float64`

    Fields read below this confidence are flagged.

  - `CreatedAt Time`

    When review was turned on.

  - `DecidedAt Time`

    When it was approved or rejected.

  - `DecidedBy string`

    ID of the user who approved or rejected it.

  - `DecidedReason string`

    Why it was rejected.

  - `FieldActions map[string, ExtractReviewFieldAction]`

    The latest action per field, keyed by JSON Pointer.

    - `Action string`

      confirm, correct or clear.

      - `const ExtractReviewFieldActionActionClear ExtractReviewFieldActionAction = "clear"`

      - `const ExtractReviewFieldActionActionConfirm ExtractReviewFieldActionAction = "confirm"`

      - `const ExtractReviewFieldActionActionCorrect ExtractReviewFieldActionAction = "correct"`

    - `ActorID string`

      ID of the user who acted.

    - `At Time`

      When they acted.

    - `Value any`

      The corrected value, for `correct`.

  - `FieldsInScope []string`

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

  - `Flags []ExtractReviewFlag`

    Fields the review asks a person to check.

    - `Handled bool`

      Whether someone confirmed, corrected or cleared it.

    - `Path string`

      JSON Pointer of the field.

    - `Reason string`

      below_threshold, or required_empty for a required field left empty.

      - `const ExtractReviewFlagReasonBelowThreshold ExtractReviewFlagReason = "below_threshold"`

      - `const ExtractReviewFlagReasonRequiredEmpty ExtractReviewFlagReason = "required_empty"`

    - `Cell ExtractReviewFlagCell`

      Where in a list the least confident value is.

      - `Row int64`

        Index of the row, from 0.

      - `Column string`

        Property of the row, when rows are objects.

    - `Confidence float64`

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

  - `JobID string`

    The extract job reviewed.

  - `OpenFlags []string`

    JSON Pointers of flagged fields nobody checked.

  - `OriginalResult map[string, any]`

    The result as the model read it.

  - `RequiredFields []string`

    JSON Pointers of fields flagged when empty.

  - `RetainUntil Time`

    When the job and its document may be deleted.

  - `ReviewedResult map[string, any]`

    The result with the field actions.

  - `Revision int64`

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

  - `SourceFileID string`

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

  - `Status ExtractReviewStatus`

    pending until approved or rejected.

    - `const ExtractReviewStatusApproved ExtractReviewStatus = "approved"`

    - `const ExtractReviewStatusPending ExtractReviewStatus = "pending"`

    - `const ExtractReviewStatusRejected ExtractReviewStatus = "rejected"`

  - `UpdatedAt Time`

    When the review last changed.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  extractReview, err := client.Extract.Review.Reopen(
    context.TODO(),
    "job_id",
    llamacloud.ExtractReviewReopenParams{
      Revision: 0,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, jobID, query) (*PaginatedCursor[ExtractReviewEvent], error)`

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

  - `OrganizationID param.Field[string]`

  - `PageSize param.Field[int64]`

    Events per page.

  - `PageToken param.Field[string]`

    Token from the previous page.

  - `ProjectID param.Field[string]`

### Returns

- `type ExtractReviewEvent struct{…}`

  One entry in a review's history.

  - `ID string`

    Unique identifier of the entry.

  - `ActorID string`

    ID of the user who acted.

  - `CreatedAt Time`

    When it happened.

  - `Kind ExtractReviewEventKind`

    What happened.

    - `const ExtractReviewEventKindApproved ExtractReviewEventKind = "approved"`

    - `const ExtractReviewEventKindCreated ExtractReviewEventKind = "created"`

    - `const ExtractReviewEventKindFieldCleared ExtractReviewEventKind = "field_cleared"`

    - `const ExtractReviewEventKindFieldConfirmed ExtractReviewEventKind = "field_confirmed"`

    - `const ExtractReviewEventKindFieldCorrected ExtractReviewEventKind = "field_corrected"`

    - `const ExtractReviewEventKindFieldRestored ExtractReviewEventKind = "field_restored"`

    - `const ExtractReviewEventKindFieldUndone ExtractReviewEventKind = "field_undone"`

    - `const ExtractReviewEventKindFlagsSignedOff ExtractReviewEventKind = "flags_signed_off"`

    - `const ExtractReviewEventKindRejected ExtractReviewEventKind = "rejected"`

    - `const ExtractReviewEventKindReopened ExtractReviewEventKind = "reopened"`

  - `Detail ExtractReviewEventDetailUnion`

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

    - `type ExtractReviewEventDetailExtractReviewCreatedDetail struct{…}`

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

      - `ConfidenceThreshold float64`

        Fields read below this confidence are flagged.

      - `FieldsInScope []string`

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

      - `Origin string`

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

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginAPI ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "api"`

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginEdit ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "edit"`

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginHistory ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "history"`

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginRun ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "run"`

      - `RequiredFields []string`

        JSON Pointers of fields flagged when empty.

    - `type ExtractReviewEventDetailExtractReviewRejectedDetail struct{…}`

      What a `rejected` entry records.

      - `Reason string`

        Why the result was rejected.

    - `type ExtractReviewEventDetailExtractReviewSignedOffDetail struct{…}`

      What a `flags_signed_off` entry records.

      - `Paths []string`

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

  - `Path string`

    JSON Pointer of the field it changed.

  - `ValueAfter any`

    The field's value after the change.

  - `ValueBefore any`

    The field's value before the change.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Extract.Review.ListEvents(
    context.TODO(),
    "job_id",
    llamacloud.ExtractReviewListEventsParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
```

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

- `type ExtractReview struct{…}`

  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.

  - `ConfidenceThreshold float64`

    Fields read below this confidence are flagged.

  - `CreatedAt Time`

    When review was turned on.

  - `DecidedAt Time`

    When it was approved or rejected.

  - `DecidedBy string`

    ID of the user who approved or rejected it.

  - `DecidedReason string`

    Why it was rejected.

  - `FieldActions map[string, ExtractReviewFieldAction]`

    The latest action per field, keyed by JSON Pointer.

    - `Action string`

      confirm, correct or clear.

      - `const ExtractReviewFieldActionActionClear ExtractReviewFieldActionAction = "clear"`

      - `const ExtractReviewFieldActionActionConfirm ExtractReviewFieldActionAction = "confirm"`

      - `const ExtractReviewFieldActionActionCorrect ExtractReviewFieldActionAction = "correct"`

    - `ActorID string`

      ID of the user who acted.

    - `At Time`

      When they acted.

    - `Value any`

      The corrected value, for `correct`.

  - `FieldsInScope []string`

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

  - `Flags []ExtractReviewFlag`

    Fields the review asks a person to check.

    - `Handled bool`

      Whether someone confirmed, corrected or cleared it.

    - `Path string`

      JSON Pointer of the field.

    - `Reason string`

      below_threshold, or required_empty for a required field left empty.

      - `const ExtractReviewFlagReasonBelowThreshold ExtractReviewFlagReason = "below_threshold"`

      - `const ExtractReviewFlagReasonRequiredEmpty ExtractReviewFlagReason = "required_empty"`

    - `Cell ExtractReviewFlagCell`

      Where in a list the least confident value is.

      - `Row int64`

        Index of the row, from 0.

      - `Column string`

        Property of the row, when rows are objects.

    - `Confidence float64`

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

  - `JobID string`

    The extract job reviewed.

  - `OpenFlags []string`

    JSON Pointers of flagged fields nobody checked.

  - `OriginalResult map[string, any]`

    The result as the model read it.

  - `RequiredFields []string`

    JSON Pointers of fields flagged when empty.

  - `RetainUntil Time`

    When the job and its document may be deleted.

  - `ReviewedResult map[string, any]`

    The result with the field actions.

  - `Revision int64`

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

  - `SourceFileID string`

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

  - `Status ExtractReviewStatus`

    pending until approved or rejected.

    - `const ExtractReviewStatusApproved ExtractReviewStatus = "approved"`

    - `const ExtractReviewStatusPending ExtractReviewStatus = "pending"`

    - `const ExtractReviewStatusRejected ExtractReviewStatus = "rejected"`

  - `UpdatedAt Time`

    When the review last changed.

### Extract Review Event

- `type ExtractReviewEvent struct{…}`

  One entry in a review's history.

  - `ID string`

    Unique identifier of the entry.

  - `ActorID string`

    ID of the user who acted.

  - `CreatedAt Time`

    When it happened.

  - `Kind ExtractReviewEventKind`

    What happened.

    - `const ExtractReviewEventKindApproved ExtractReviewEventKind = "approved"`

    - `const ExtractReviewEventKindCreated ExtractReviewEventKind = "created"`

    - `const ExtractReviewEventKindFieldCleared ExtractReviewEventKind = "field_cleared"`

    - `const ExtractReviewEventKindFieldConfirmed ExtractReviewEventKind = "field_confirmed"`

    - `const ExtractReviewEventKindFieldCorrected ExtractReviewEventKind = "field_corrected"`

    - `const ExtractReviewEventKindFieldRestored ExtractReviewEventKind = "field_restored"`

    - `const ExtractReviewEventKindFieldUndone ExtractReviewEventKind = "field_undone"`

    - `const ExtractReviewEventKindFlagsSignedOff ExtractReviewEventKind = "flags_signed_off"`

    - `const ExtractReviewEventKindRejected ExtractReviewEventKind = "rejected"`

    - `const ExtractReviewEventKindReopened ExtractReviewEventKind = "reopened"`

  - `Detail ExtractReviewEventDetailUnion`

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

    - `type ExtractReviewEventDetailExtractReviewCreatedDetail struct{…}`

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

      - `ConfidenceThreshold float64`

        Fields read below this confidence are flagged.

      - `FieldsInScope []string`

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

      - `Origin string`

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

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginAPI ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "api"`

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginEdit ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "edit"`

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginHistory ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "history"`

        - `const ExtractReviewEventDetailExtractReviewCreatedDetailOriginRun ExtractReviewEventDetailExtractReviewCreatedDetailOrigin = "run"`

      - `RequiredFields []string`

        JSON Pointers of fields flagged when empty.

    - `type ExtractReviewEventDetailExtractReviewRejectedDetail struct{…}`

      What a `rejected` entry records.

      - `Reason string`

        Why the result was rejected.

    - `type ExtractReviewEventDetailExtractReviewSignedOffDetail struct{…}`

      What a `flags_signed_off` entry records.

      - `Paths []string`

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

  - `Path string`

    JSON Pointer of the field it changed.

  - `ValueAfter any`

    The field's value after the change.

  - `ValueBefore any`

    The field's value before the change.
