Skip to main content

Node.js SDK

The official Node.js SDK for Structurify provides a TypeScript-first interface to the document extraction API.

npm version Node.js 18+

Installation

npm install @structurify/sdk

Quick Start

import { Structurify } from '@structurify/sdk';
import * as fs from 'fs';

// Initialize client
const client = new Structurify({ apiKey: 'sk_live_your_api_key' });

// List available templates
const templates = await client.templates.list();
templates.forEach(t => console.log(`${t.name} - ${t.id}`));

// Create a project
const project = await client.projects.create({
name: 'Invoice Processing',
templateId: 'tpl_invoice',
});

// Upload a document
const doc = await client.documents.upload({
projectId: project.id,
file: new Blob([fs.readFileSync('invoice.pdf')]),
name: 'invoice.pdf',
});

// Run extraction
const job = await client.extraction.run({ projectId: project.id });
const completed = await client.extraction.waitForCompletion(job.id);

// Export results
const exportResult = await client.exports.create({
projectId: project.id,
format: 'csv',
});
const csvData = await client.exports.download(exportResult.export.id);
console.log(csvData);

Features

  • TypeScript-first - Full type definitions included
  • Promise-based - Modern async/await API
  • Error handling - Typed exception classes
  • Webhook support - Built-in signature verification

Resources