Quickstart
Extract structured data from a document in under five minutes.
If you’d rather click through a UI walkthrough first, sign up and the welcome wizard at /welcome/workspace will guide you through naming a workspace, picking a schema template (Invoice / Receipt / Resume / Contract / ID Doc / Medical Record / Bank Statement / Tax Form / Blank), uploading a sample PDF, and inspecting the extracted JSON. The wizard’s final step creates an “Onboarding key” you can copy from the rendered curl snippet — paste that into TRACORE_API_KEY below to follow this SDK-driven version.
1. Install the SDK
npm install @tracore/sdk
2. Create a client
import { TracoreClient } from "@tracore/sdk";
const client = new TracoreClient({
apiKey: process.env.TRACORE_API_KEY!,
});
3. Create a workspace
const workspace = await client.workspaces.create({
name: "My Workspace",
slug: "my-workspace",
});
4. Define a schema
Create a schema that describes the data you want to extract:
const schema = await client.schemas.create("my-workspace", {
schemaKey: "invoice",
name: "Invoice",
description: "Extract invoice fields",
definition: {
type: "object",
properties: {
invoiceNumber: { type: "string", description: "Invoice number" },
date: { type: "string", description: "Invoice date" },
totalAmount: { type: "number", description: "Total amount due" },
vendor: { type: "string", description: "Vendor or supplier name" },
lineItems: {
type: "array",
items: {
type: "object",
properties: {
description: { type: "string" },
quantity: { type: "number" },
unitPrice: { type: "number" },
},
},
},
},
},
});
5. Upload and extract
Upload a document and start extraction in one call. Pass poll: true to wait for the result:
import { readFileSync } from "node:fs";
const file = new Blob([readFileSync("./invoice.pdf")], {
type: "application/pdf",
});
const run = await client.extract("my-workspace", "invoice", {
file,
fileName: "invoice.pdf",
poll: true,
});
6. Read the results
When the run completes, the extracted data is available on the run object:
console.log(run.status); // "completed"
console.log(run.result);
// {
// invoiceNumber: "INV-2024-001",
// date: "2024-03-15",
// totalAmount: 1250.00,
// vendor: "Acme Corp",
// lineItems: [
// { description: "Consulting", quantity: 10, unitPrice: 125.00 }
// ]
// }
Next steps
- Upload a Document — file uploads, text content, and inline extraction
- Extract & Poll — manual polling and run statuses
- Webhooks — get notified when extraction completes