# compat.unstructured_general

> Partition a PDF into elements in the response shape of the Unstructured general endpoint.

> Coming soon. The hosted API is not live yet, and this page describes the planned service as of 16 November 2026. [Get notified](https://pdfluent.com/contact/?topic=hosted) when it opens.

Source: https://pdfluent.com/docs/api/reference/compat-unstructured-general/

Partition a PDF into elements in the response shape of the Unstructured general endpoint.

`POST /v1/compat/unstructured/general`

| | |
|---|---|
| Input | one file, sent as `multipart/form-data`; the optional `options` part is a JSON object |
| Output | JSON |
| Credits | [credit rate: no claim ID yet] |
| Limits | [size, page and time limits: no claim ID yet] |
| Reads or changes the document | reads only |
| Error statuses | 400, 413, 422, 500, 501, 504 (see [Errors](https://pdfluent.com/docs/api/errors/)) |

## Options

| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| `chunking_strategy` | string | no |  | `basic`, `by_title` or `by_page`. Without it the elements are returned unchunked. |
| `combine_text_under_n_chars` | integer | no |  | Merge sections shorter than this with the next one. Default 0. |
| `coordinates` | boolean | no |  | Add `metadata.coordinates`. Default false. |
| `filename` | string | no |  | Name of the uploaded file, put in `metadata.filename`. The service fills it from the upload; a client may also send it. |
| `include_orig_elements` | boolean | no |  | Accepted and ignored: original elements are not attached to chunks. |
| `include_page_breaks` | boolean | no |  | Add a `PageBreak` element between pages. Default false. |
| `languages` | array of string | no |  | Accepted; elements carry the language the engine detected. |
| `max_characters` | integer | no |  | Hard chunk budget in characters. Default 500. |
| `multipage_sections` | boolean | no |  | Let `by_title` sections run across pages. Default true. |
| `new_after_n_chars` | integer | no |  | Soft chunk budget in characters. Default: `max_characters`. |
| `output_format` | string | no |  | `application/json` (default). `text/csv` is refused. |
| `overlap` | integer | no |  | Characters shared between pieces of one long element. Default 0. |
| `password` | string | no |  | Password of an encrypted document. |
| `pdf_infer_table_structure` | boolean | no |  | Keep `metadata.text_as_html` on tables. Default true. |
| `starting_page_number` | integer | no |  | Number of the first page in `metadata.page_number`. Default 1. |
| `strategy` | string | no |  | `auto` (default), `fast`, `hi_res`. `ocr_only` and `vlm` are refused. |

## Example

### curl

```sh
curl -sS -f -X POST "$PDFLUENT_API_URL/v1/compat/unstructured/general" \
  -H "x-api-key: $PDFLUENT_API_KEY" \
  -F file=@structured.pdf \
  -F 'options={"strategy":"fast"}' \
  -o result.json
```

### Python

```python
import json
import os

import requests

options = {"strategy": "fast"}

parts = [
    ("file", ("structured.pdf", open("structured.pdf", "rb"))),
    ("options", (None, json.dumps(options))),
]

response = requests.post(
    os.environ["PDFLUENT_API_URL"] + "/v1/compat/unstructured/general",
    headers={"x-api-key": os.environ["PDFLUENT_API_KEY"]},
    files=parts,
)
response.raise_for_status()

with open("result.json", "wb") as out:
    out.write(response.content)
```

### Node.js

```js
import { openAsBlob } from 'node:fs';
import { writeFile } from 'node:fs/promises';

const form = new FormData();
form.append('file', await openAsBlob("structured.pdf"), "structured.pdf");
form.append('options', JSON.stringify({"strategy":"fast"}));

const response = await fetch(process.env.PDFLUENT_API_URL + "/v1/compat/unstructured/general", {
  method: 'POST',
  headers: { 'x-api-key': process.env.PDFLUENT_API_KEY },
  body: form,
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);

await writeFile("result.json", Buffer.from(await response.arrayBuffer()));
```

The key goes in the `x-api-key` header; see [Authentication](https://pdfluent.com/docs/api/authentication/). Every response carries `x-pdfluent-pages` and `x-pdfluent-credits`.
