# Split a PDF packet into documents by type with one API call

> Split a mixed PDF packet (invoices, statements, forms) into page ranges by document type with the Reducto Split API.

Canonical: https://reducto.ai/cookbooks/split-pdf-by-document-type

Send the packet to Reducto Split with a list of document types and a one-line description of each. The response lists each type with the pages it covers and a confidence level, so you can route invoices, statements and forms to the right extractor. One call, no training data.

## What you'll build

Synthetic 5-page mixed packet (or your own file)

- Upload the packet or pass a public URL.
- Describe each document type in split_description.
- Call /split and read result.splits: each entry has a name, its pages and a confidence.
- Send each page range to Extract with the schema for that type.

## Setup

Grab an API key from <a href="https://studio.reducto.ai" rel="noopener noreferrer" target="_blank">studio.reducto.ai</a> -> API Keys -> Create new API key, then set it and install the SDK:

```bash
export REDUCTO_API_KEY="your-api-key-here"
pip install reductoai   # or: npm install reductoai
```

## Step 1: Call `/split`

The options that matter for this job:

- `split_description`: The document types to look for, described in plain language.
- `split_rules`: Optional rules, for example that a type can appear more than once.
- `parsing.settings.model`: The parse model used to read each page.

```python
# pip install reductoai
from pathlib import Path
from reducto import Reducto

client = Reducto()  # reads REDUCTO_API_KEY

upload = client.upload(file=Path("packet.pdf"))
result = client.split.run(
    input=upload.file_id,
    split_description=[
        {
            "name": "Invoice",
            "description": "A vendor invoice or bill with line items and a total due.",
        },
        {
            "name": "Bank statement",
            "description": "A bank account statement with balances and a transaction history.",
        },
        {
            "name": "Intake form",
            "description": "A patient or customer intake form filled in by hand.",
        },
    ],
    split_rules="Each page belongs to exactly one section. A document type can appear more than once.",
    parsing={
        "settings": {
            "model": "r-1",
        },
    },
)
print(result)
```

```javascript
// npm install reductoai

const client = new Reducto(); // reads REDUCTO_API_KEY

const upload = await client.upload({ file: fs.createReadStream("packet.pdf") });
const result = await client.split.run({
  input: upload.file_id,
  split_description: [
    {
      name: "Invoice",
      description: "A vendor invoice or bill with line items and a total due.",
    },
    {
      name: "Bank statement",
      description: "A bank account statement with balances and a transaction history.",
    },
    {
      name: "Intake form",
      description: "A patient or customer intake form filled in by hand.",
    },
  ],
  split_rules: "Each page belongs to exactly one section. A document type can appear more than once.",
  parsing: {
    settings: {
      model: "r-1",
    },
  },
});
console.log(JSON.stringify(result, null, 2));
```

Or with curl:

```bash
# 1. Upload the file (or pass a public URL as "input" and skip this step)
curl -s https://platform.reducto.ai/upload \
  -H "Authorization: Bearer $REDUCTO_API_KEY" \
  -F file=@packet.pdf
# => {"file_id": "reducto://..."}

# 2. Run split
curl -s https://platform.reducto.ai/split \
  -H "Authorization: Bearer $REDUCTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "reducto://FILE_ID",
  "split_description": [{"name": "Invoice", "description": "A vendor invoice or bill with line items and a total due."}, {"name": "Bank statement", "description": "A bank account statement with balances and a transaction history."}, {"name": "Intake form", "description": "A patient or customer intake form filled in by hand."}],
  "split_rules": "Each page belongs to exactly one section. A document type can appear more than once.",
  "parsing": {"settings": {"model": "r-1"}}
}'
```

## Step 2: Read the result

On the sample (a synthetic 5-page mixed packet), the job-specific part of the response:

```json
{"name": "Invoice", "pages": [1], "conf": "high"}
{"name": "Bank statement", "pages": [2, 3, 4], "conf": "high"}
{"name": "Intake form", "pages": [5], "conf": "high"}
```

Each split names the document type and the pages it covers, so you can send each range to its own Extract schema.

[Full response format ->](https://docs.reducto.ai/split#sample-response)

## When to use something else

- **Split**: when one file holds several documents that need different schemas.
- **Extract directly**: when every file is a single known document type.
- **Classify**: when each file is one document and you only need its type.

## Where this goes next

- [Split docs](https://docs.reducto.ai/split.md)
- [Reducto Split](/split)
- [Split a law review article (cookbook)](/cookbooks/reducto-split-law-review-article)
- [Invoice line items to JSON](/cookbooks/invoice-line-items-to-json)
