> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> API reference for Extractaai: every `extractaai.api.*` operation with input and output types.

Every `extractaai.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

<Info>
  **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).
</Info>

## Classification

### create

`classification.create`

Create a document classification (EXTRACTA\_AI\_CREATE\_CLASSIFICATION)

**Risk:** `write`

```ts theme={null}
await corsair.extractaai.api.classification.create({});
```

**Input**

| Name                    | Type     | Required | Description |
| ----------------------- | -------- | -------- | ----------- |
| `classificationDetails` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="classificationDetails full type">
    ```ts theme={null}
    {
      name: string,
      description?: string,
      documentTypes: {
        name: string,
        description: string,
        uniqueWords: string[],
        extractionId?: string
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name               | Type      | Required | Description |
| ------------------ | --------- | -------- | ----------- |
| `status`           | `created` | Yes      | —           |
| `createdAt`        | `number`  | Yes      | —           |
| `classificationId` | `string`  | Yes      | —           |

***

### delete

`classification.delete`

Delete a document classification (EXTRACTA\_AI\_DELETE\_CLASSIFICATION) \[DESTRUCTIVE · IRREVERSIBLE]

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.extractaai.api.classification.delete({});
```

**Input**

| Name               | Type     | Required | Description |
| ------------------ | -------- | -------- | ----------- |
| `classificationId` | `string` | Yes      | —           |

**Output**

| Name      | Type      | Required | Description |
| --------- | --------- | -------- | ----------- |
| `status`  | `success` | Yes      | —           |
| `message` | `string`  | No       | —           |

***

### update

`classification.update`

Update a document classification (EXTRACTA\_AI\_UPDATE\_CLASSIFICATION)

**Risk:** `write`

```ts theme={null}
await corsair.extractaai.api.classification.update({});
```

**Input**

| Name                    | Type     | Required | Description |
| ----------------------- | -------- | -------- | ----------- |
| `classificationId`      | `string` | Yes      | —           |
| `classificationDetails` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="classificationDetails full type">
    ```ts theme={null}
    {
      name: string,
      description: string,
      documentTypes: {
        name: string,
        description: string,
        uniqueWords: string[],
        extractionId?: string
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name               | Type      | Required | Description |
| ------------------ | --------- | -------- | ----------- |
| `status`           | `updated` | Yes      | —           |
| `updatedAt`        | `number`  | Yes      | —           |
| `classificationId` | `string`  | Yes      | —           |

***

### view

`classification.view`

View a document classification configuration (EXTRACTA\_AI\_VIEW\_CLASSIFICATION)

**Risk:** `read`

```ts theme={null}
await corsair.extractaai.api.classification.view({});
```

**Input**

| Name               | Type     | Required | Description |
| ------------------ | -------- | -------- | ----------- |
| `classificationId` | `string` | Yes      | —           |

**Output**

| Name                    | Type      | Required | Description |
| ----------------------- | --------- | -------- | ----------- |
| `status`                | `success` | Yes      | —           |
| `classificationId`      | `string`  | Yes      | —           |
| `classificationDetails` | `object`  | Yes      | —           |

<AccordionGroup>
  <Accordion title="classificationDetails full type">
    ```ts theme={null}
    {
      createdAt?: number,
      name: string,
      description?: string,
      documentTypes: {
        name: string,
        description: string,
        uniqueWords: string[],
        extractionId?: string
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Credits

### get

`credits.get`

Get the account credit balance (EXTRACTA\_AI\_GET\_CREDITS)

**Risk:** `read`

```ts theme={null}
await corsair.extractaai.api.credits.get({});
```

**Input:** *empty object*

**Output**

| Name      | Type     | Required | Description |
| --------- | -------- | -------- | ----------- |
| `status`  | `ok`     | Yes      | —           |
| `credits` | `number` | Yes      | —           |

***

## Extraction

### create

`extraction.create`

Create a document extraction template (EXTRACTA\_AI\_CREATE\_EXTRACTION)

**Risk:** `write`

```ts theme={null}
await corsair.extractaai.api.extraction.create({});
```

**Input**

| Name                | Type     | Required | Description |
| ------------------- | -------- | -------- | ----------- |
| `extractionDetails` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="extractionDetails full type">
    ```ts theme={null}
    {
      name: string,
      description?: string,
      language: string,
      options?: {
        hasTable?: boolean,
        hasVisuals?: boolean,
        handwrittenTextRecognition?: boolean,
        checkboxRecognition?: boolean,
        longDocument?: boolean,
        splitPdfPages?: boolean,
        specificPageProcessing?: boolean,
        specificPageProcessingOptions?: {
          from: number,
          to: number
        }
      },
      fields: {
        key: string,
        description?: string,
        example?: string,
        type?: string | object | array,
        properties?: lazy[],
        items?: {
          type: string | object,
          example?: string,
          properties?: lazy[]
        }
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name           | Type      | Required | Description |
| -------------- | --------- | -------- | ----------- |
| `status`       | `created` | Yes      | —           |
| `createdAt`    | `number`  | Yes      | —           |
| `extractionId` | `string`  | Yes      | —           |

***

### delete

`extraction.delete`

Delete an extraction, batch, or file (EXTRACTA\_AI\_DELETE\_EXTRACTION) \[DESTRUCTIVE · IRREVERSIBLE]

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.extractaai.api.extraction.delete({});
```

**Input**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `extractionId` | `string` | Yes      | —           |
| `batchId`      | `string` | No       | —           |
| `fileId`       | `string` | No       | —           |

**Output**

| Name        | Type      | Required | Description |
| ----------- | --------- | -------- | ----------- |
| `status`    | `deleted` | Yes      | —           |
| `deletedAt` | `number`  | Yes      | —           |

***

### getBatchResults

`extraction.getBatchResults`

Get extraction results for a batch (EXTRACTA\_AI\_GET\_BATCH\_RESULTS)

**Risk:** `read`

```ts theme={null}
await corsair.extractaai.api.extraction.getBatchResults({});
```

**Input**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `extractionId` | `string` | Yes      | —           |
| `batchId`      | `string` | Yes      | —           |
| `fileId`       | `string` | No       | —           |

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      status: waiting,
      extractionId?: string,
      batchId?: string,
      fileId?: string
    } | {
      extractionId: string,
      batchId: string,
      fileId?: string,
      files: {
        fileId?: string,
        fileName?: string,
        status: string,
        result?: lazy,
        url?: string
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

***

### update

`extraction.update`

Update a document extraction configuration (EXTRACTA\_AI\_UPDATE\_EXTRACTION)

**Risk:** `write`

```ts theme={null}
await corsair.extractaai.api.extraction.update({});
```

**Input**

| Name                | Type     | Required | Description |
| ------------------- | -------- | -------- | ----------- |
| `extractionId`      | `string` | Yes      | —           |
| `extractionDetails` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="extractionDetails full type">
    ```ts theme={null}
    {
      name?: string,
      description?: string,
      language?: string,
      options?: {
        hasTable?: boolean,
        hasVisuals?: boolean,
        handwrittenTextRecognition?: boolean,
        checkboxRecognition?: boolean,
        longDocument?: boolean,
        splitPdfPages?: boolean,
        specificPageProcessing?: boolean,
        specificPageProcessingOptions?: {
          from: number,
          to: number
        }
      },
      fields?: {
        key: string,
        description?: string,
        example?: string,
        type?: string | object | array,
        properties?: lazy[],
        items?: {
          type: string | object,
          example?: string,
          properties?: lazy[]
        }
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name           | Type      | Required | Description |
| -------------- | --------- | -------- | ----------- |
| `status`       | `updated` | Yes      | —           |
| `updatedAt`    | `number`  | Yes      | —           |
| `extractionId` | `string`  | Yes      | —           |

***

### view

`extraction.view`

View a document extraction configuration (EXTRACTA\_AI\_VIEW\_EXTRACTION)

**Risk:** `read`

```ts theme={null}
await corsair.extractaai.api.extraction.view({});
```

**Input**

| Name           | Type     | Required | Description |
| -------------- | -------- | -------- | ----------- |
| `extractionId` | `string` | Yes      | —           |

**Output**

| Name                | Type     | Required | Description |
| ------------------- | -------- | -------- | ----------- |
| `extractionId`      | `string` | Yes      | —           |
| `extractionDetails` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="extractionDetails full type">
    ```ts theme={null}
    {
      name: string,
      description?: string,
      language: string,
      options?: {
        hasTable?: boolean,
        hasVisuals?: boolean,
        handwrittenTextRecognition?: boolean,
        checkboxRecognition?: boolean,
        longDocument?: boolean,
        splitPdfPages?: boolean,
        specificPageProcessing?: boolean,
        specificPageProcessingOptions?: {
          from: number,
          to: number
        }
      },
      fields: {
        key: string,
        description?: string,
        example?: string,
        type?: string | object | array,
        properties?: lazy[],
        items?: {
          type: string | object,
          example?: string,
          properties?: lazy[]
        }
      }[],
      status?: string,
      batches?: {
      }
    }
    ```
  </Accordion>
</AccordionGroup>

***
