# Extend

> Turn documents into clean, LLM-ready markdown and pull structured data out of them with Extend's document processing AI.

App · Document Extraction · 2 actions. Web page: https://docs.lodol.com/docs/integrations/extend

## Actions

### Extract data from a document

Pull structured values out of a document (invoice totals, contract dates, form answers) as named fields you can use in later steps. List the fields you want, or leave them blank and let Extend work out the shape of the document for you.

**Inputs**

- File (`file`, text, required): The document to extract from: upload one here, give its public URL, or pass the file id from an earlier Extend step. Uploaded files are sent to Extend first.
- Fields to extract (`fields`, list): Optional. The values to pull out, each with a name and a description of what to look for. Leave this empty to let Extend infer the fields from the document itself.
- Extraction guidance (`extraction_rules`, text): Optional. Plain-language rules for the extraction, e.g. 'Return dates as YYYY-MM-DD and amounts without a currency symbol'. When no fields are listed above, this also tells Extend what kind of document to expect.
- Extraction engine (`engine`, text): Optional. Which engine to extract with. Defaults to the high-accuracy engine. One of: `extraction_performance` (Performance - highest accuracy (default)), `extraction_light` (Light - faster and cheaper for simple documents).

**Outputs**

- `credits` (number): Extend credits this extraction used
- `dashboard_url` (text): Link to review this run in the Extend dashboard
- `data` (object): The extracted values, one key per field you asked for (or per field Extend inferred)
- `extract_run_id` (text): Extend's id for this extraction run
- `field_metadata` (list): Per-field confidence and the text in the document each value came from
- `file_id` (text): Extend's id for the file, reusable in a later Extend step
- `file_name` (text): The name of the file that was read

**Example output**

```json
{
  "credits": 3,
  "dashboard_url": "https://dashboard.extend.ai/extract_runs/exr_Xj8mK2pL9nR4vT7qY5wZ",
  "data": {
    "invoice_number": "INV-2024-001",
    "total_amount": 1234.56,
    "vendor_name": "Acme Supplies"
  },
  "extract_run_id": "exr_Xj8mK2pL9nR4vT7qY5wZ",
  "field_metadata": [
    {
      "confidence": 0.98,
      "field": "vendor_name",
      "page": 1,
      "reference_text": "Acme Supplies"
    },
    {
      "confidence": 0.95,
      "field": "invoice_number",
      "page": 1,
      "reference_text": "Invoice # INV-2024-001"
    }
  ],
  "file_id": "file_xK9mLPqRtN3vS8wF5hB2cQ",
  "file_name": "invoice.pdf"
}
```

### Parse a document

Turn a PDF, image, spreadsheet, presentation, or scan into clean, layout-aware markdown split into chunks: ready to feed into a later AI step, a search index, or a RAG pipeline.

**Inputs**

- File (`file`, text, required): The document to parse: upload one here, give its public URL, or pass the file id from an earlier Extend step. Uploaded files are sent to Extend first, then parsed.
- Split the document into (`chunking_strategy`, text): Optional. How to divide the document. Defaults to one chunk per page. One of: `page` (Pages (one chunk per page)), `section` (Sections (splits at headings, best for search)), `document` (The whole document (a single chunk)).
- Parsing engine (`engine`, text): Optional. Which engine to parse with. Defaults to the high-accuracy engine. One of: `parse_performance` (Performance - highest accuracy for complex tables, handwriting, and checkboxes (default)), `parse_light` (Light - faster and cheaper for high-volume, good-quality documents).
- Table format (`table_format`, text): Optional. How tables are written into the parsed content. Defaults to HTML, which handles merged cells and nested headers. One of: `html` (HTML - complex tables with merged cells (default)), `markdown` (Markdown - simple tables and LLM workflows).
- Include element breakdown (`include_blocks`, true/false): Optional. Also return every element on the page individually -- each table, figure, heading, and key-value pair -- with the page it came from. Default: `false`.
- First page (`page_start`, number): Optional. Parse only from this page onwards. Set the last page too. You are only billed for the pages parsed. At least 1.
- Last page (`page_end`, number): Optional. Parse up to and including this page. Set the first page too. At least 1.

**Outputs**

- `blocks` (list): Individual page elements. Empty unless 'Include element breakdown' is on.
- `chunks` (list): The parsed content, split into chunks
- `content` (text): The whole document as markdown, with every chunk joined in reading order
- `credits` (number): Extend credits this parse used
- `file_id` (text): Extend's id for the parsed file, reusable in a later Extend step
- `file_name` (text): The name of the parsed file
- `page_count` (number): How many pages were parsed
- `parse_run_id` (text): Extend's id for this parse run

**Example output**

```json
{
  "blocks": [
    {
      "content": "CHASE JPMorgan Chase Bank, N.A. P O Box 659754 San Antonio, TX 78265 - 9754",
      "page": 1,
      "type": "text"
    }
  ],
  "chunks": [
    {
      "content": "# CHASE\n\nJPMorgan Chase Bank, N.A.\nP O Box 659754\nSan Antonio, TX 78265 - 9754",
      "page_end": 1,
      "page_start": 1,
      "type": "page"
    }
  ],
  "content": "# CHASE\n\nJPMorgan Chase Bank, N.A.\nP O Box 659754\nSan Antonio, TX 78265 - 9754",
  "credits": 14,
  "file_id": "file_GzKUy0VDhHscv7tweODYb",
  "file_name": "bank_statement.pdf",
  "page_count": 7,
  "parse_run_id": "pr_3f1j6I1gsw5k96xFiCnkM"
}
```
