TypeScript SDK

Typed render client for Node and Bun.

The official TypeScript SDK is the shortest path from a Node or Bun service to a finished document: typed templates, typed fields, real bytes back, and webhook signature verification in the same package.

Available nowPublished on npm as @pixldocs/sdk. ESM, zero runtime dependencies, Node 18+.
Proved on 6 Aug 2026
What ran
The compiled client from npm — getTemplateFields() then render() — against the deployed API.
Result
32 typed field keys and a 149,593-byte PDF, byte-identical to what the n8n, Zapier and Make lanes returned for the same input.

Get rendering

  1. 01
    Install
    bash
    npm install @pixldocs/sdk
  2. 02
    Create a client

    Take a key from Workspace Settings → API keys and keep it in an environment variable — never in client-side code.

    typescript
    import { PixlDocs } from '@pixldocs/sdk';
    
    const pixl = new PixlDocs({ apiKey: process.env.PIXLDOCS_API_KEY! });
  3. 03
    Learn what the template accepts
    typescript
    const fields = await pixl.getTemplateFields(templateId);
    console.log(fields.single_fields.map((f) => f.key));
    // → ['statement_no', 'borrower_name', 'outstanding_principal', ...]
  4. 04
    Render it
    typescript
    const doc = await pixl.render({
      templateId,
      format: 'pdf',
      data: { borrower_name: 'Aisha Karim', outstanding_principal: 17298.69 },
    });
    
    await Bun.write('statement.pdf', doc.bytes);
    console.log(doc.contentType, doc.bytes.length, doc.unmatchedKeys);

    unmatchedKeys lists anything the template did not recognise, so a renamed field surfaces immediately instead of quietly disappearing.

  5. 05
    Verify webhooks (async renders)
    typescript
    import { verifyWebhook } from '@pixldocs/sdk';
    
    const event = await verifyWebhook({
      payload: rawBody,
      signature: req.headers['x-pixldocs-signature'],
      secret: process.env.PIXLDOCS_WEBHOOK_SECRET!,
    });

    It throws on a tampered body or a stale timestamp — both are covered by the SDK's own test suite.

What's in it

  • render, renderHtml, renderUrl — synchronous, bytes back.
  • createRender, getRender — async jobs by id.
  • listTemplates, getTemplateFields — typed discovery.
  • verifyWebhook — HMAC check with timestamp tolerance.
  • PixlDocsError — carries the API's code, so failures branch cleanly.
No SDK needed
Every one of these is one HTTPS call. If your language has no SDK yet, the API reference has copy-paste curl and Python for the same endpoints.