> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# Prep and NLP API output

If you already use the [Prep API](/prep/overview) or the [NLP API](/nlp/overview),
you can send what they produced straight to the Summarization API, without
reshaping it.

## Prep API output: `prep_documents`

The Prep API can produce a JSONL file with one document per line: its text, its
document type and its metadata. Parse each line and send the objects as an array:

```json
{
  "prep_documents": [
    {"id": "c9753dce15074d719c30ca4727721fa6-0001", "text": "…",
     "category": "Cardiology", "subcategory": "ECG", "chartdate": "2022-03-04",
     "subject_id": "11110001", "subject_name": "…", "subject_dob": "1966-08-01 04:10:48"},
    …
  ],
  "prompt": "…"
}
```

Each line becomes a document:

| From the line                                                 | Used as                                                                                                               |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `text`                                                        | The document. Required                                                                                                |
| `id`                                                          | The document `id`, which citations point to (when it is 1–64 of `A–Z a–z 0–9 _ . : -`; otherwise the line's position) |
| `category`, `subcategory`                                     | The document type                                                                                                     |
| `chartdate`                                                   | Its date (the date part)                                                                                              |
| `subject_id`, `subject_name`, `subject_dob`, `subject_gender` | The [patient check](/summarization/guides/several-documents#one-patient-per-job)                                      |

Other fields are ignored.

**Remove the `pdf` field first.** Each line also carries the original document as
a base64 PDF. It is not used — the text is — and it makes the request around a
hundred times larger. A line with a PDF and no text is refused with
`unsupported_document`.

```python
import json

with open("bundle.jsonl") as f:
    lines = [json.loads(line) for line in f if line.strip()]
for line in lines:
    line.pop("pdf", None)

body = {"prep_documents": lines, "prompt": "Summarize the cardiac history for a referral."}
```

## NLP API results: `nlp_results`

If you have already run the documents through the NLP API, send its result files
as they are — `emtellipro-json-2`, including the documents' text (the NLP API's
`text` feature). Several files are fine:

```json
{"nlp_results": [{"format": "emtellipro-json-2", "version": "2.37.0",
                  "documents": [ … ]}],
 "prompt": "…"}
```

Each document's `id`, `category` and `subcategory` come from the file. Documents whose
`processing_status` is not `success` are summarized too.

NLP results are large — many times the size of their text — so these requests
can be up to 16 MiB.

## Adding dates and patient details: `document_metadata`

NLP results carry no dates or patient details. Add them by document id with
`document_metadata`, which works for any of a job's documents:

```json
"document_metadata": {
  "c9753dce15074d719c30ca4727721fa6-0001": {"chart_date": "2022-03-04",
                                            "subject": {"dob": "1966-08-01"}}
}
```

A key that matches no document is refused with `unknown_document_id`.

If you have both the Prep JSONL and the NLP results for the same documents, their
ids match: send the NLP results, and build `document_metadata` from the Prep
lines' `chartdate` and `subject_*` fields.

## Combining

`documents`, `prep_documents` and `nlp_results` can all be sent in one job. Ids
must be unique across them; documents without an id are numbered by their
position across all of them, in that order.