Harbor Docs

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.

New to Harbor?

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.

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

auth.ts
import { Harbor } from "@harbor/sdk";
const harbor = new Harbor({ key: process.env.HARBOR_KEY });
Rotate keys in one click.

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.

extract.ts
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

200 OK · JSON
{
  "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.

Webhook events
EventWhenTypical use
job.completedAll fields above thresholdWrite to your database
job.needs_reviewAny field below thresholdOpen the review queue
job.failedUnreadable or unsupported fileNotify 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.

Idempotency.

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.

TierRequests / minConcurrent jobsMax file
Sandbox60210 MB
Growth60025100 MB
ScaleCustom200500 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.