Skip to main content

Overview

Pulse API is designed to handle documents of any size, from single-page memos to thousand-page reports. This guide covers strategies for efficiently processing large documents while maintaining accuracy and minimizing costs. Very large files are defined as documents with 100+ pages, which require special handling for optimal performance.

Size Thresholds

Understanding these thresholds helps you choose the right processing strategy:

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

3. Chunked Processing

For very large documents, process in chunks:

4. 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