---
title: "DataExtraction"
canonical_url: "https://www.nutrient.io/api/python/data-extraction/"
md_url: "https://www.nutrient.io/api/python/data-extraction.md"
last_updated: "2026-10-26T16:51:00.815Z"
description: "Extracts data from a document with the same operations, the same option names and the same output files as the hosted Nutrient data extraction service, so code and knowledge carry over between the two. Like every SDK operation, each one reads its options from the document's settings: `ParseSettings` and `ExtractSettings`, generated from the hosted service's parameters, and the canonical settings they alias. Options left unset keep the default the pipeline or the SDK-wide settings provide."
---

Extracts data from a document with the same operations, the same option names and the same output files as the hosted Nutrient data extraction service, so code and knowledge carry over between the two. Like every SDK operation, each one reads its options from the document's settings: `ParseSettings` and `ExtractSettings`, generated from the hosted service's parameters, and the canonical settings they alias. Options left unset keep the default the pipeline or the SDK-wide settings provide.

```python

from nutrient_sdk import DataExtraction

```

## Construction

`DataExtraction` cannot be instantiated directly. Obtain instances through static factory methods or via other SDK classes.

## Class Methods

### set

```python

@classmethod
def set(cls, document: Document) -> DataExtraction

```

Creates a DataExtraction instance for the specified document.

**Parameters:**

| Name       | Type                                | Description                             |
| ---------- | ----------------------------------- | --------------------------------------- |
| `document` | [`Document`](/api/python/document/) | The open document to extract data from. |

**Returns:** [`DataExtraction`](/api/python/data-extraction/) - A DataExtraction instance bound to the document.

**Raises:**

- [`NullOrEmptyParameterException`](/api/python/exceptions/null-or-empty-parameter-exception/): Thrown when document is null.

---

## Methods

### extract

```python

def extract(self) -> ExtractResult

```

Extracts structured data from the document with an AI model, shaped by the JSON Schema you supply.

**Returns:** [`ExtractResult`](/api/python/results/extract-result/) - The artifacts the run produced, under the same names the hosted service uses.

**Raises:**

- [`InvalidStateException`](/api/python/exceptions/invalid-state-exception/): Thrown when this instance has been disposed.

- [`InvalidLicenseException`](/api/python/exceptions/invalid-license-exception/): Thrown when the license does not cover a capability this call runs.

- [`InvalidArgumentException`](/api/python/exceptions/invalid-argument-exception/): Thrown when a setting is rejected as invalid input.

- [`VisionException`](/api/python/exceptions/vision-exception/): Thrown when the run fails; the message ends with the failure code.

---

### parse

```python

def parse(self) -> ParseResult

```

Parses the document into structured content (paragraphs, tables, figures, key-value regions and more) and exports it as JSON, Markdown or both.

**Returns:** [`ParseResult`](/api/python/results/parse-result/) - The artifacts the run produced, under the same names the hosted service uses.

**Raises:**

- [`InvalidStateException`](/api/python/exceptions/invalid-state-exception/): Thrown when this instance has been disposed.

- [`InvalidLicenseException`](/api/python/exceptions/invalid-license-exception/): Thrown when the license does not cover a capability this call runs.

- [`InvalidArgumentException`](/api/python/exceptions/invalid-argument-exception/): Thrown when a setting is rejected as invalid input.

- [`VisionException`](/api/python/exceptions/vision-exception/): Thrown when the run fails; the message ends with the failure code.

---

---

## Related pages

- [Open a PDF and convert it to a Word document](/api/python.md)
- [Document](/api/python/document.md)
- [License](/api/python/license.md)
- [Query](/api/python/query.md)
- [Telemetry](/api/python/telemetry.md)
- [Vision](/api/python/vision.md)

