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

# Split

> Cut a packet or workbook into classified segments

```python theme={"dark"}
from ndi_sdk import NdiClient
from ndi_sdk.models.document_ops import SplitCategory

with NdiClient() as client:
    packet = client.documents.create_upload("packet.pdf")
    job = client.jobs.wait(
        client.documents.split(
            packet,
            classes=[
                SplitCategory(id="invoice", label="Invoice", description="A supplier invoice"),
                SplitCategory(id="receipt", label="Receipt", description="A payment receipt"),
            ],
            wait_seconds=30,
        ).job_id
    )
    for segment in job.result.segments:
        print(segment.start_page, segment.end_page, segment.split_class)
```

## Method signature

```text theme={"dark"}
def split(
    source: DocumentSource | UploadResponse,
    *,
    classes: list[SplitCategory],
    unknown_policy: Literal["include", "force", "error"] = "include",
    page_ranges: list[PageRange] | None = None,
    overlap_policy: Literal["exclusive", "shared_boundary_page"] = "exclusive",
    quality: OperationQuality = "auto",
    split_rules: str | None = None,
    output: SplitOutputOptions | None = None,
    wait_seconds: int = 0,
    idempotency_key: str | None = None,
) -> Job
```

### Parameters

| Parameter        | Type                                     | Required | Description                            |
| ---------------- | ---------------------------------------- | -------- | -------------------------------------- |
| `source`         | `DocumentSource` or `UploadResponse`     | Yes      | Packet, workbook, or prior parse       |
| `classes`        | `list[SplitCategory]`                    | Yes      | Classes to cut on                      |
| `unknown_policy` | `"include"` / `"force"` / `"error"`      | No       | Default `include`                      |
| `page_ranges`    | `list[PageRange]`                        | No       | Not supported for spreadsheets         |
| `overlap_policy` | `"exclusive"` / `"shared_boundary_page"` | No       | Shared boundary is reserved            |
| `quality`        | `"auto"`                                 | No       | Only accepted value                    |
| `split_rules`    | `str`                                    | No       | Extra cutting instructions             |
| `output`         | `SplitOutputOptions`                     | No       | `include_content`, `materialize_files` |
| `wait_seconds`   | `int`                                    | No       | Hold the HTTP response open (max 300)  |

### Returns

A `Job`. On success, `result.segments` is the ordered cut list.

`page_ranges` is not supported for spreadsheet sources. A `parse_result`
source is supported.

See [Split guide](/guides/split).
