Skip to main content
Every FlexOrch pipeline starts with a document upload. The TypeScript SDK provides three upload methods — single file, batch, and connector-based — giving you the flexibility to integrate with your existing storage and workflow without restructuring your code.

Single file upload

Pass a local file path to client.documents.upload(). The method returns a Promise<Job> that resolves as soon as the document is queued for processing.
import { FlexOrch } from "@flexorch/sdk";

const client = new FlexOrch({
  apiKey: process.env.FLEXORCH_API_KEY,
});

const job = await client.documents.upload("invoice.pdf");
console.log(`Job ID: ${job.id} | Status: ${job.status}`);
Supported file types include PDF, DOCX, PPTX, XLSX, HTML, Markdown, and plain text. FlexOrch auto-detects the MIME type from the file contents.

Multi-file upload

Use client.documents.uploadMany() to upload a list of files concurrently. Each file gets its own job; the method returns a Promise<Job[]> in the same order as the input array.
const filePaths = ["contract.pdf", "memo.docx", "slides.pptx"];

const jobs = await client.documents.uploadMany(filePaths);

jobs.forEach((job) => {
  console.log(`${job.id}${job.status}`);
});
uploadMany() issues all uploads concurrently, so submitting 20 files takes roughly the same wall-clock time as submitting one.

Upload from a connector

If your documents live in a connected storage source (S3, Google Drive, SharePoint, and others), use uploadFromConnector() to pull them directly — no local download required.
const jobs = await client.documents.uploadFromConnector({
  connectorId: 1,
  keys: ["reports/q1.pdf", "reports/q2.pdf"],
});

jobs.forEach((job) => {
  console.log(`${job.id}${job.status}`);
});
You can find connector IDs in the FlexOrch dashboard under Settings → Connectors.

Duplicate detection

Every upload is fingerprinted against previously processed documents in your workspace. When a duplicate is detected, the returned Job object includes isDuplicate: true and an originalJobId pointing to the original job.
const job = await client.documents.upload("invoice.pdf");

if (job.isDuplicate) {
  console.log(`Duplicate detected. Original job: ${job.originalJobId}`);
} else {
  console.log("New document — processing started.");
}
Duplicate jobs are still billed at the standard rate unless you have duplicate suppression enabled on your plan. Check your plan settings before uploading large batches.

File size limits

PlanMax file sizeMax files per batch
Starter25 MB10
Growth100 MB50
Enterprise500 MBUnlimited
Uploading a file that exceeds your plan’s size limit causes the returned Promise to reject with a FileTooLargeError. Handle it with a try/catch block.
import { FileTooLargeError } from "@flexorch/sdk";

try {
  const job = await client.documents.upload("large_scan.pdf");
} catch (err) {
  if (err instanceof FileTooLargeError) {
    console.error(`File rejected: ${err.message}`);
  } else {
    throw err;
  }
}

Next steps

Manage Jobs

Poll status and access extraction results for uploaded documents.

Build Datasets

Combine completed jobs into exportable, LLM-ready datasets.