How to build an end-to-end paperwork automation pipeline with APIs

Ten stages, two ways to build them, and a worked example from a mixed packet to a signed form.

Back to journal

An end-to-end paperwork pipeline has ten stages: upload, classify, split, parse, extract, validate, human review, fill or compose, sign, and record. Build each stage as a separate step with a stored output, put a person at the points where a wrong value costs money, and keep one record of the whole run.

You can assemble those stages from several vendors or take them from one platform. This guide describes each stage, shows where approvals and the audit trail belong, compares the two approaches, and ends with a worked example.

What are the stages from upload to final output?

Stage What it does What it must return
1. Upload Registers the file once A file id that every later step reuses
2. Classify Labels each document or page A class and a confidence score
3. Split Cuts a packet into documents Child files with their page ranges
4. Parse Reads text, tables and layout Markdown, JSON and positions
5. Extract Pulls the fields in your schema Values with a citation and a score
6. Validate and decide Applies your rules and thresholds Pass, verify or review
7. Human review A person approves exceptions A decision with a name and a time
8. Fill or compose Produces the output document A filled form or a rendered PDF
9. Sign Collects signatures A sealed file and a certificate
10. Record and notify Stores the run and calls your systems An audit trail and a webhook event

Not every workflow needs every stage. A single invoice skips split. A report that nobody signs stops at stage 8. Start from the output you need and remove the stages that do not serve it.

Why classify and split before you extract?

Real intake is mixed. One upload holds an application, a bank statement and an ID. One schema over the whole file returns mixed fields.

Classify the pages first, then cut on the boundaries. Keep the two steps apart: classification is a judgment that can be wrong, and cutting is a file operation that cannot. The pause between them is a natural review point. Send low-confidence boundaries to a person before the cut, not after a wrong extraction.

Then read each piece once. Parsing attaches the result to the file, so extraction and later steps should reuse it. If your design parses the same page at three stages, you pay for it three times.

Where do validation and decisions sit?

Validation sits directly after extraction and before anything is written, sent or signed. It has two parts.

Rules you own. Totals equal the sum of line items. The tax number has a valid format. The name on the form matches the name on the ID. These checks are ordinary code and should stay in your codebase.

Thresholds on confidence. Sort results into three bands. High scores pass with no one in the loop. Middle scores trigger an extra check, such as a match against another document. Low scores go to review.

Some branches are decisions, not checks: does this claim need escalation, is this vendor in a restricted country. Use a fast classifier or a typed decision step for these, and record the probability with the answer.

Where do approvals belong?

Put an approval at each point where an error becomes expensive or irreversible. In most pipelines that is three places:

  1. Before the cut, when a split boundary has a low score.
  2. After validation, when a field falls below your threshold or a rule fails.
  3. Before signature, when a document leaves your organization.

An approval is a state of the run, not a message in a chat tool. The run pauses, a reviewer sees the value with its source and its score, and the run resumes from where it stopped when the decision arrives. Three requirements follow:

  • The pause must last long enough for a person. Hours or days, not seconds.
  • The decision must go through an API or a review screen that records who decided.
  • A manual edit must be marked as a manual edit, so a reader can tell a cited value from a typed one.

Where does the audit trail live?

The audit trail belongs to the run, not to your application logs. One record should hold the inputs, the output of each step, the citations, the scores, every approval or rejection with its author and time, and the cost.

This is the main difficulty of a pipeline built from several vendors. Each vendor logs its own step with its own identifier. You then build the record yourself: a run id that you pass to every call, a store for each step output, and a way to query one document from intake to signature.

Decide the retention rule at the start. A regulated workflow may require that a run stay for years. A privacy rule may require that it expire in days. You need both controls: expire by default, and pin on demand.

How do downstream actions and webhooks work?

Long steps should not block a request. Start the run, receive a run id at once, and react to an event when the run completes or pauses. Three points to verify with any vendor:

  • Signed deliveries. Your endpoint must be able to verify that the event came from the vendor.
  • Idempotency. Your handler will receive some events twice. Use the run id as the key.
  • Events for pauses. You need an event when a run waits for a person, not only when it completes.

The handler then does the business action: write the record to the system of record, open a case, release a payment.

Should you build it yourself or use one platform?

Both approaches work. The choice depends on what you already own.

Build it yourself when you have a strong parser in production, you are bound to one cloud, or a stage needs a specialist tool. You keep the freedom to replace each part. You also own the mapping code between vendors, the retries, the review interface and the audit record.

Use one platform when the pipeline continues past extraction into filled, approved and signed documents, and you do not want to maintain the links between stages. You accept more dependence on one vendor in exchange for one key, one bill and one run record.

Vendors cover different parts of the chain. This table comes from our benchmarks page, checked against each vendor's public documentation on November 22, 2026.

Stage CloudRaker Reducto Extend AWS Google Azure
Parse and OCR Yes Yes Yes Yes Yes Yes
Split and classify Yes Yes Yes Separate APIs Yes Yes
Cited extract Yes Yes Yes Forms, tables, queries Yes Yes
Redact Yes No No No No Separate service
Fill and compose Yes Edit only Fill only No No No
Legally binding sign Yes No No Detection only No No

Extend also documents a human review step with a queue in its dashboard. If your pipeline ends at reviewed, structured data, Extend or Reducto with your own output step is a sound design. If your data must stay in one cloud, the AWS, Google or Azure services with a separate e-signature vendor fit better.

What does a worked example look like?

A vendor sends one PDF with an invoice, a W-9 and a signed agreement. The pipeline splits the packet, extracts cited fields, fills a W-9 from the sources and sends it for signature. This example uses the CloudRaker Python SDK. The calls are the ones on the API page and the Split page.

from cloudraker import (
    V1FillBodyFilesItemId,
    V1FillBodyTemplateName,
    V1SignBodyFileName,
    V1SignBodySignersItem,
)
from cloudraker.client import CloudRaker

client = CloudRaker(token="YOUR_API_KEY")
packet = {"url": "https://example.com/intake-packet.pdf"}

# 1 - Classify page by page, then cut on the boundaries
classified = client.classify(
    file=packet,
    granularity="page",
    classes=[
        {"id": "invoice", "description": "A vendor invoice with a total due."},
        {"id": "w9", "description": "An IRS Form W-9."},
        {"id": "agreement", "description": "A signed services agreement."},
    ],
)
run = client.split(file=packet, classify_run_id=classified.id)

# 2 - Extract cited fields from the pieces
data = client.extract(
    files=[{"id": file_id} for file_id in run.output.document_ids],
    schema={
        "type": "object",
        "properties": {
            "business_name": {"type": ["string", "null"]},
            "total_due": {"type": ["number", "null"]},
        },
    },
    citations=True,
)

# 3 - Apply your own rules to data.output.value before you continue

# 4 - Fill the form from the source documents
filled = client.fill(
    template=V1FillBodyTemplateName(url="https://www.irs.gov/pub/irs-pdf/fw9.pdf", name="w9.pdf"),
    files=[V1FillBodyFilesItemId(id=file_id) for file_id in run.output.document_ids],
    instructions="Use the legal entity name, not the trade name.",
)

# 5 - Send the result for signature
signed = client.sign(
    file=V1SignBodyFileName(url=filled.output.file.url),
    signers=[V1SignBodySignersItem(name="Jane Doe", email="jane@example.com")],
    message="Please sign the completed W-9.",
)
print(signed.status)  # "needs_input" - signers get emailed their links

Three things happen outside this snippet. Each split piece carries a confidence value, so step 1 can route a weak boundary to a person. Step 3 is your code, and a failed rule should pause the run for an approval. See Trust for approvals and the audit trail for the record of each run. Each signer verifies with a one-time email code, and the signed PDF is sealed with a timestamp and a certificate of completion.

For steps that can run in parallel on one file set, a pipeline call runs them in a single request with a signed webhook on completion. The same chain is available from the CLI and the MCP server.

What should you measure after launch?

  • Straight-through rate. The share of runs that finish with no person in the loop.
  • Review time. The time a paused run waits for a decision.
  • Error rate after review. Errors found downstream, by field and by document type.
  • Cost per completed document. All stages together, not one call. The rate card lists each stage.

Raise or lower your thresholds from these numbers, one field at a time.

FAQ

  • It is the use of software to read documents, decide what to do with them, and produce the finished output, such as a filled form or a signed contract, with people involved only for exceptions.

Sources

Read this next

All posts