sdk
JavaScript / TypeScript SDK
Runtime: Node 18+ (global fetch) · Edge Runtime · Bun · Browser (with bundler)
Install
npm install @snappdf/sdk
Quickstart
import { SnapPdf } from '@snappdf/sdk';
import fs from 'node:fs';
const snap = new SnapPdf({
apiKey: process.env.SNAPPDF_API_KEY!,
maxRetries: 5,
timeout: 30_000,
});
const { pdf } = await snap.pdf.merge({
files: [fs.readFileSync('a.pdf'), fs.readFileSync('b.pdf')],
});
fs.writeFileSync('out.pdf', pdf);Features
- · First-class TypeScript types for every param and response
- · Automatic retries with jittered exponential backoff
- · Idempotency-Key header for safe write retries
- · HMAC-SHA256 webhook signature verification
- · Works in Node, Edge, Bun, Deno, modern browsers
Reference
Full API reference lives at /docs. Source + examples on GitHub.