Skip to main content

Overview

Pulse API is designed to handle documents of any size, from single-page memos to multi-thousand-page reports. Page count never causes an error — only the transport of the bytes is gated:
  • Direct multipart uploads (file=) are limited to 100 MB. A larger direct upload fails fast with HTTP 413 and error code FILE_TOO_LARGE_USE_URL; it is never silently accepted.
  • file_url submissions are accepted at any size. Files over 100 MB must be submitted via file_url pointing at your own hosted or presigned URL (for example, an S3 presigned GET URL).
Very large documents are sharded transparently: Pulse splits the document into page-range shards, extracts them in parallel, and reassembles a single ordered result. You still submit one request and poll one job_id — there is no separate API for large documents, and you are billed only for the pages that are actually extracted.

File Size Limits

A 413 response carries "code": "FILE_TOO_LARGE_USE_URL" and names the limit. Host the document yourself — any URL Pulse can download, such as an S3 presigned GET URL — and resubmit with file_url.

Partial Results

A large-document job completes with a partial result whenever at least one page succeeds; it fails outright only when every page is unextractable. Partial results are loud and page-precise:
  • failed_pages at the result top level lists each unrecoverable page as {"page": N, "error": "..."}.
  • A matching summary is appended to warnings.
  • The markdown carries a <!-- PAGE N FAILED EXTRACTION: ... --> placeholder at each hole so page-splitting consumers keep alignment.
  • Only extracted pages are billed.
Check failed_pages on every completed large-document job; if it is absent, every page was extracted.

Automatic Optimizations

Smart Async Switching

The production client automatically switches to async mode for large files:
For documents over 70 pages, spreadsheet extractions, or any response payload above the 5 MB inline threshold, results are returned as a one-time download link of the form https://api.runpulse.com/results/{job_id}. Fetching the link returns the complete result JSON with the same shape as an inline response:
/results/{job_id} links are single-use and expire 1 hour after the job completes. Once a successful download has streamed (or the hour has elapsed), the link returns 410 Gone. Always persist the payload to your own storage on first read.

Processing Strategies

1. Full Document Processing

Process entire documents when you need complete context:

2. Page Range Processing

Extract specific sections to reduce processing time:
Page Range Syntax (1-indexed, page 1 is the first page):
  • Single page: "5" — extracts the 5th page
  • Range: "10-20" — extracts pages 10 through 20 (inclusive)
  • Multiple ranges: "1-5,10-15,20" — extracts pages 1-5, 10-15, and page 20
  • Mixed: "1,3,5-10,15" — extracts pages 1, 3, 5-10, and 15
When you request a page subset, every page number in the response — markdown page-break markers, bounding boxes, tables, words, and extension output — refers to the original document’s page numbers, not positions within the subset. Extracting pages="10-20" yields items labeled pages 10 through 20.
You do not need to split a large document into page-range chunks yourself. Pulse shards and reassembles very large documents transparently under a single job ID. Use pages= to save cost when you only need part of a document, not as a workaround for size.

3. Selective Extraction

Extract only what you need to minimize processing:

Async Processing Deep Dive

Starting Async Jobs

Polling for Completion

Parallel Processing

Process multiple large documents simultaneously:

Optimization Techniques

1. Memory Management

For very large responses:

2. Cost Optimization

Minimize pages processed to reduce costs:

3. Performance Monitoring

Track processing performance:

Common Patterns

Financial Report Analysis

Error Handling

Handling Large Document Errors

Best Practices Summary

  • Always use async processing for files > 50 pages
  • Let the client auto-detect when to use async
  • Implement proper polling with backoff
  • Process only the pages you need
  • Extract TOC first to navigate large documents
  • Use chunking for very large documents
  • Track processing times and costs
  • Adjust chunk sizes based on document type
  • Use concurrent processing for multiple files

Next Steps

Async Processing

Async flag, polling, and webhooks

Error Handling

Handle errors in large documents