Overview
OkraPDF has two upload paths. Both produce the same result: a processed document you can query, extract from, and publish.| Standard upload | Presign upload | |
|---|---|---|
| Steps | 1 request (DO handles everything) | 3 requests (presign + PUT + confirm) |
| Latency to “upload done” | ~3-4s | ~0.5s |
| Worker involved | Yes (receives PDF bytes) | No (PDF goes direct to R2) |
| Durable Object created | Immediately | Only at confirm step |
| Best for | SDK, small files, simplicity | CLI pipelines, large files, speed |
Presign upload (fast path)
Three steps: get a signed URL, upload the PDF directly to storage, then confirm to start processing.Step 1: Get presigned URL
Step 2: Upload directly to R2
Step 3: Confirm and start processing
Step 4: Poll status
Standard upload (simple path)
One request. The Worker receives the PDF bytes and handles everything.From a URL
From a local file (binary)
Two-step presign through DO
/presign endpoint skips the DO entirely until confirm.
When to use which
Use presign (/presign) when:
- You want the lowest possible upload latency
- You’re building a CLI tool or pipeline
- Files are large (>10MB) and you don’t want them passing through a Worker
- You want the docId before the DO exists (e.g. for optimistic UI)
/upload-url) when:
- You’re uploading from a public URL (the server fetches it)
- You’re using the SDK (
okra.sessions.create(url)) - Simplicity matters more than speed
Full script
Seescripts/presign-upload-example.sh for a runnable bash script that does all four steps with timing.