# Pre-Fillling Extraction Form

The SmartExtract component shows an extraction form to collect required details from the user to correctly extract data from the document. At times you might already have this information present in the client application. To save users from re-filling or incorrectly filling this information you can pass data to be pre-filled in the data extraction form.

## Using SmartExtract API

With SmartExtract API you can pass the initial form data with the [sendExtractDocumentRequest](/smart-extract-documentation/smart-extract.js/smartextract-api.md#extracting-document-data) API call.

```typescript
smex.sendExtractDocumentRequest({
  file,
  fileName,
  data: {
    documentType,
    assetType,
    osPeriod,
    pageRange,
  },
})
```

Please check [Initial Form Data Options](/smart-extract-documentation/smart-extract.js/pre-filling-extraction-form.md#initial-form-data-options) section below for more details

## Using SmartExtractSimple API

With SmartExtractSimple API you can pass the initial form data with the[ extractDocumentData](/smart-extract-documentation/smart-extract.js/smartextractsimple-api.md#extracting-document-data) API call.

```typescript
const data = await smex.extractDocumentData({
  session: {...},
  file: fileDataUrl,
  fileName: file.name,
  data: {
    documentType,
    assetType,
    osPeriod,
    pageRange,
  },
});
```

Please check [Initial Form Data Options](/smart-extract-documentation/smart-extract.js/pre-filling-extraction-form.md#initial-form-data-options) section below for more details

## Initial Form Data Options

Following are the possible values that can be passed as part of the `data` object to pre-fill the extraction form:

| Parameter    | Required | Type              | Description                                                                           |
| ------------ | -------- | ----------------- | ------------------------------------------------------------------------------------- |
| documentType | No       | string            | One of [Valid Document Types](/smart-extract-documentation/appendix.md#document-type) |
| assetType    | No       | string            | One of [Valid Asset types](/smart-extract-documentation/appendix.md#asset-type)       |
| pageRange    | No       | \[number, number] | Page range to extract data for a pdf file                                             |
| osPeriod     | No       | \[Date, Date]     | Period range for operating statements                                                 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://clik-ai.gitbook.io/smart-extract-documentation/smart-extract.js/pre-filling-extraction-form.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
