Jan 6, 2026 · Updated Nov 3, 2026

<span aria-hidden="true" id="lets-build-document-intelligence-pipeline-using-transloadit"></span>

# Let's Build: document intelligence pipeline using Transloadit

![Kevin van Zonneveld](/assets/images/teammates/avatar-kvz-4.jpg)

**Kevin van Zonneveld**

Co-founder · Amsterdam, The Netherlands · Show bio

[](https://x.com/kvz)[](https://github.com/kvz)

Turn a PDF or DOCX document into a local JSON file containing its title, summary, and optional insights. This example combines document conversion with schema-guided AI extraction; you review the saved result against the original before using it elsewhere.

The [downloadable TypeScript application](/example%5Fapps/document-intelligence-pipeline/README.md) runs outside this repository. It accepts one local document, sends it to Transloadit and an AI provider, and saves the response to a new output file. Use a synthetic or non-sensitive document that you have permission to upload for your first run. Processing is billed, including when you explicitly select Transloadit-provided AI test credentials.

<span aria-hidden="true" id="what-document-intelligence-really-means"></span>

## What document intelligence really means

A document workflow can parse text, split pages, and extract structured fields. Those are separate operations: the application here sends PDFs directly to [/ai/chat](/docs/robots/ai-chat.md) and converts DOCX files to PDF first. It does not run OCR or split documents into chunks.

The result is a starting point for review or indexing, rather than proof that every fact was extracted correctly. Its schema describes document insights, not invoice totals, line items, or confidence scores.

<span aria-hidden="true" id="setting-up-your-typescript-project"></span>

## Setting up your TypeScript project

Follow the application's [installation and access instructions](/example%5Fapps/document-intelligence-pipeline/README.md) from an empty, standalone directory outside an existing Node.js project or Yarn workspace. No private checkout or fixture download is needed; you supply your own PDF or DOCX. The shell examples use Bash.

The tested combination is [Node.js 26.12.1](https://nodejs.org/en/download/archive/v26.12.1), Yarn 4.12.0 through Corepack, `@transloadit/node` 4.14.0, `zod` 3.25.76, and `zod-to-json-schema` 3.25.2. These are reproduction pins, not claims that they are the latest releases. Node 26 is a [maintained release line](https://nodejs.org/en/about/previous-releases); keep security updates in mind when adapting the example. Corepack is a separate prerequisite on Node 26: follow its [installation instructions](https://github.com/nodejs/corepack#manual-installs) if `corepack` is not available. You also need cURL for the downloads.

The README installs the pinned packages and downloads **both** `document-intelligence-pipeline/run.ts` and `shared/runtime.ts`. Keep those sibling directories together, because the program imports `../shared/runtime.ts`. Its final `--help` command should work before you supply any credentials. If setup fails, inspect the partial directory before retrying: the initial `package.json` creation refuses to overwrite a file. Do not repeat it over an existing application.

Configure `TRANSLOADIT_AUTH_KEY` and `TRANSLOADIT_AUTH_SECRET` in the shell running the application, as shown in the README. These authenticate your Transloadit Workspace. Keep them out of source control and browser code. The program reads process environment variables and does not load an environment file.

AI access is a separate choice. Either set `TRANSLOADIT_AI_CREDENTIALS` to the name of an existing AI Credential containing an Anthropic key, or explicitly pass `--test-credentials` for billed Transloadit-provided test keys. Select one mode. The program does not create or change credentials; see the [/ai/chat documentation](/docs/robots/ai-chat.md) for provider access and billing.

<span aria-hidden="true" id="step-1-document-parsing-with-ocr-optional"></span>

## Step 1: Document parsing with OCR (optional)

The [/document/ocr](/docs/robots/document-ocr.md) Robot is useful when your separate workflow needs recognized text or layout information from a PDF. This application instead uses the PDF input support of `anthropic/claude-sonnet-4-6`, selected explicitly in its extraction Step.

For DOCX input, the [/document/convert](/docs/robots/document-convert.md) Robot produces the PDF sent to the model. Conversion and OCR serve different purposes; adding an OCR Step would require deciding how its output feeds your own extraction workflow.

<span aria-hidden="true" id="step-2-document-splitting"></span>

## Step 2: Document splitting

The [/document/split](/docs/robots/document-split.md) Robot can select pages for a different workflow. The example below processes one whole file. Splitting a contract into independent requests can lose definitions or terms from other pages, so do not assume that combining per-page answers reproduces a whole document's meaning.

<span aria-hidden="true" id="step-3-schema-driven-data-extraction-with-ai"></span>

## Step 3: Schema-driven data extraction with AI

The application exports `example` and `documentInsightsSchema`. Reuse these when inspecting or adapting it instead of maintaining a second copy of its Instructions or schema. The extraction Step uses `format: 'json'`, a serialized JSON Schema, and `result: true` to expose the answer file.

`title` and `summary` are required strings. Optional fields are `author`, `publication_date`, `document_type`, `key_topics`, and `key_points`. The document type, when present, is one of `whitepaper`, `report`, `contract`, `invoice`, `receipt`, `statement`, or `manual`. An optional field may be omitted; a required string can still be empty or factually wrong. Schema validation checks shape, not truth.

<span aria-hidden="true" id="building-a-complete-pipeline"></span>

## Building a complete pipeline

Place a document at `document.pdf` in your reader directory, or change `--input` to its actual path. Choose a writable output path that does not exist. With Workspace authentication already configured and `TRANSLOADIT_AI_CREDENTIALS` unset, this command authorizes billed processing with test keys:

```bash
node document-intelligence-pipeline/run.ts --input ./document.pdf --output ./result.json --test-credentials

```

For an existing Anthropic AI Credential, set `TRANSLOADIT_AI_CREDENTIALS` as described above and omit `--test-credentials`. The runner accepts a nonempty input of at most 20 MiB and downloads at most 20 MiB of output. These are tutorial limits. It allows five minutes for the Assembly and a separate 30-second result download; provider limits can still refuse a file within the local size limit.

On success, the terminal prints **Saved** followed by the output path. The input is unchanged, and `result.json` is a local file rather than a temporary result URL. An existing output is refused before an Assembly is submitted. For sequential reruns, use another destination; do not delete your previous result just to repeat a command.

Save this inspection script as `inspect.ts` beside `package.json`. It reads the saved output using the same exported schema, rejects blank required text, and prints the two fields you should review:

```typescript
import { readFile } from 'node:fs/promises'

import { documentInsightsSchema } from './document-intelligence-pipeline/run.ts'

const saved = JSON.parse(await readFile('./result.json', 'utf8'))
const insights = documentInsightsSchema.parse(saved)
if (!insights.title.trim() || !insights.summary.trim()) {
  throw new Error('The title or summary is blank. Review the source and Assembly before retrying.')
}
console.log(insights.title)
console.log(insights.summary)

```

```bash
node inspect.ts

```

Check names, dates, quantities, and the summary's main assertions against your source. A report about repairing 12 bicycles with $240 of spare parts must not turn into a summary about selling bicycles or spending $24. The inspection script cannot make that factual judgment for you. Review optional fields in the JSON too, and keep sensitive results private.

If a run fails after printing an Assembly ID, inspect that Assembly in the Console before retrying. A timeout or interruption does not establish that remote processing stopped, and a failed run can still be billed. The runner disables SDK retries and removes its unfinished local output after a caught failure; it cannot guarantee cleanup after a forced termination. Inspect any leftover file before choosing a new destination.

<span aria-hidden="true" id="processing-multiple-document-types"></span>

## Processing multiple document types

The runner accepts `.pdf` and `.docx` filenames, including uppercase extensions. The [/file/filter](/docs/robots/file-filter.md) Robot routes files with PDF MIME type directly to extraction; the other branch converts to PDF first. This does not make every non-PDF format an accepted input to this CLI. Renaming a damaged file does not repair its contents, and successful conversion does not establish an accurate summary.

<span aria-hidden="true" id="using-templates-for-reusability"></span>

<span aria-hidden="true" id="handling-large-document-batches"></span>

<span aria-hidden="true" id="decide-what-to-add-beyond-the-local-example"></span>

## Decide what to add beyond the local example

Run documents sequentially with distinct output filenames while evaluating results and costs. This CLI has no batch scheduler, review queue, or cloud-storage export. Before processing a collection, review current [pricing](/pricing.md) and the [Robot documentation](/docs/robots.md).

Templates can make an adapted set of Assembly Instructions reusable. They are not required for this local run. Saving Instructions in a Template or adding storage does not by itself provide human review, access controls for your application, or a reliable extraction policy.

<span aria-hidden="true" id="why-teams-choose-transloadit-for-document-ai"></span>

<span aria-hidden="true" id="transloadit-vs-dedicated-document-ai-platforms"></span>

<span aria-hidden="true" id="when-to-use-this-approach"></span>

## When to use this approach

This approach is useful when you want control over the conversion and extraction Steps in a file workflow and can supply the application around them. Compare a dedicated document AI product using your own documents if you need a packaged review experience or measured extraction quality. This small example does not establish feature parity or production readiness.

<span aria-hidden="true" id="ready-to-build"></span>

## Ready to build?

Start with the [application README](/example%5Fapps/document-intelligence-pipeline/README.md) and one non-sensitive document whose contents you know. Keep the saved JSON and your source together for review, then use the [AI Robot docs](/docs/robots.md#artificial-intelligence) to plan any changes to the extraction workflow.

[#letsbuild](/blog/tags/letsbuild.md)[#ai](/blog/tags/ai.md)[#document-processing-service](/blog/tags/document-processing-service.md)[#artificial-intelligence-service](/blog/tags/artificial-intelligence-service.md)[#developer-experience](/blog/tags/developer-experience.md)

### Join 25k+ developers

Sign up for our [monthly newsletter](/newsletters.md) to receive direct links to 3 exclusive tech — and 2 product updates. No less, no more.

Email address

Subscribe

One email a month. Unsubscribe anytime.

## File uploading and encoding. Made simple.

Trusted by Coursera and The New York Times for a reliable API, top-notch support, and open source like [Uppy](https://uppy.io) and [Tus](https://tus.io).

[Try it free](/c/signup/)[Request a demo](/request-demo.md)

No credit card needed · Cancel anytime
