Build document pipelines that don't break
Harbor turns PDFs, scans, email attachments and spreadsheets into typed JSON you can trust. One endpoint, deterministic schemas, and a human review queue when confidence is low.
What Harbor does
Send a file and a schema. Harbor classifies the document, extracts the fields you asked for, and returns a confidence score per field. Anything below your threshold goes to a review queue instead of silently corrupting your database.
Start with the quickstart below. It takes about four minutes and uses a sandbox key that never bills you.
Three primitives
- ParseFile in, structured document out. Text, tables, handwriting and layout.
- ExtractYour JSON schema, enforced. Missing fields are explicit, never guessed.
- RouteConfidence thresholds send clean results onward and edge cases to review.
Quickstart
Install the SDK and set your key. The sandbox accepts any file and returns deterministic fixtures, so you can build before you buy.
npm i @harbor/sdk
export HARBOR_KEY=hb_test_4f9a…
Authentication
Every request carries a bearer token. Keys are scoped to an environment (test or live) and to a project. Never ship a live key to a browser or mobile app — mint short-lived upload tokens on your server instead.
import { Harbor } from "@harbor/sdk";
const harbor = new Harbor({ key: process.env.HARBOR_KEY });
Both keys stay valid for 24 hours after rotation, so you can deploy without downtime.
Your first extraction
Pass a schema and a file. Harbor returns extracted fields plus a per-field confidence score between 0 and 1.
const result = await harbor.extract({
file: "./invoice-0412.pdf",
schema: {
vendor: "string",
total: "number",
due_date: "date",
line_items: [{ description: "string", amount: "number" }],
},
});
The response
{
"id": "job_8f21",
"status": "complete",
"fields": {
"vendor": { "value": "Northwind Supply", "confidence": 0.99 },
"total": { "value": 4820.5, "confidence": 0.97 },
"due_date": { "value": "2026-12-19", "confidence": 0.93 }
}
}
Webhooks
Long documents are processed asynchronously. Subscribe to job.completed and job.needs_review instead of polling. Every delivery is signed with an HMAC-SHA256 header and retried with exponential backoff for 24 hours.
| Event | When | Typical use |
|---|---|---|
job.completed | All fields above threshold | Write to your database |
job.needs_review | Any field below threshold | Open the review queue |
job.failed | Unreadable or unsupported file | Notify the uploader |
Errors & retries
Harbor uses conventional HTTP status codes. 429 and 5xx are safe to retry with jitter; 422 means the schema itself is invalid and retrying will not help.
Send an Idempotency-Key header with uploads. Replaying the same key returns the original job instead of creating a duplicate.
Rate limits
Limits apply per key and reset on a rolling 60-second window. Response headers carry the remaining budget so you can pace uploads before you are throttled.
| Tier | Requests / min | Concurrent jobs | Max file |
|---|---|---|---|
| Sandbox | 60 | 2 | 10 MB |
| Growth | 600 | 25 | 100 MB |
| Scale | Custom | 200 | 500 MB |
What's next
You have parsed your first document. Next, add a review threshold, wire the webhook into your queue, and read the API reference for pagination and bulk uploads.