Catalog npm
PACKAGE EXPLORERView in registry

@0xpdf/client

npm

TypeScript/JavaScript SDK for the 0xPdf PDF-to-JSON API

apidocumentextractionjsonocrparsingpdf
Versions collected2
Direct dependencies3From release 0.1.5
Last observed21 Oct, 09:28 UTC

README

Current package documentation

@0xpdf/client

TypeScript/JavaScript SDK for the 0xPdf PDF-to-JSON API.

Works in Node.js 18+, Bun, Deno, and the browser — zero dependencies, uses native fetch.

Demo

Schema in, PDF in, JSON out — 22 seconds:

0xPdf product demo

Full MP4 · Try free · API docs

Installation

npm install @0xpdf/client

The legacy unscoped package oxpdf is deprecated; use @0xpdf/client for new projects.

Quick Start

import { OxPDFClient } from "@0xpdf/client";

const client = new OxPDFClient({ apiKey: "your_api_key" });

// Parse with a built-in template
const result = await client.parse(pdfBuffer, "invoice.pdf", {
  schemaTemplate: "invoice",
});
console.log(result.data);

// Parse from a file path (Node.js only)
const result2 = await client.parseFile("./invoice.pdf", {
  schemaTemplate: "invoice",
});

// Queue async processing and wait for completion
const queued = await client.upload(pdfBuffer, "invoice.pdf", {
  schemaId: "your_schema_id",
});
const finalStatus = await client.waitForJob(queued.job_id, {
  intervalMs: 2000,
  timeoutMs: 180000,
});
console.log(finalStatus.status);

// Streaming parse with real-time progress
for await (const event of client.parseFileStream("./large.pdf", {
  schemaTemplate: "invoice",
})) {
  if (event.event === "page") console.log(event.data.message);
  if (event.event === "complete") console.log("Done!", event.data);
}

Browser Usage

const input = document.querySelector<HTMLInputElement>("#pdf-upload")!;
input.addEventListener("change", async () => {
  const file = input.files![0];
  const result = await client.parse(file, file.name, {
    schemaTemplate: "invoice",
  });
  console.log(result.data);
});

Error Handling

import { OxPDFClient, OxPDFError } from "@0xpdf/client";

try {
  const result = await client.parseFile("doc.pdf", {
    schemaTemplate: "invoice",
  });
} catch (e) {
  if (e instanceof OxPDFError) {
    console.error(`API error: ${e.message} (status: ${e.statusCode})`);
  }
}

Full API Reference

Constructor

new OxPDFClient({ apiKey, baseUrl?, timeout?, retry? })
OptionTypeDefaultDescription
apiKeystring—Your 0xPdf API key
baseUrlstringhttps://api.0xpdf.io/api/v1API base URL
timeoutnumber120000Request timeout (ms)
retryobject{ maxRetries: 2, initialDelayMs: 500, backoffMultiplier: 2 }Retry/backoff config

PDF Parsing

MethodDescription
parse(file, filename, options?)Sync parse from Buffer/Blob/File
parseFile(filePath, options?)Sync parse from file path (Node.js)
parseStream(file, filename, options?)Streaming SSE parse (async generator)
parseFileStream(filePath, options?)Streaming parse from file (Node.js)
validate(file, filename, options?)Dry-run validation

Async Jobs

MethodDescription
upload(file, filename, options?)Queue PDF for background processing
jobStatus(jobId)Poll async job status
waitForJob(jobId, options?)Poll until completed/failed (with timeout)

Image Extraction

MethodDescription
extractImages(file, filename, options?)Extract images from a PDF
listImages(limit?, offset?)List extracted images
getImageUrl(imageId, expirationSeconds?)Get/refresh presigned URL
deleteImage(imageId)Delete a specific image
deleteAllImages()Delete all images

File Management

MethodDescription
listFiles()List uploaded PDFs
getFile(pdfId)Get PDF metadata + download URL
deleteFile(pdfId)Delete an uploaded PDF

Schema CRUD

MethodDescription
listSchemas()List saved schemas
getSchema(schemaId)Get schema with full definition
createSchema(options)Create a new schema
updateSchema(schemaId, options)Update existing schema
deleteSchema(schemaId)Delete a schema
setDefaultSchema(schemaId)Set as default
generateSchema(options)AI-generate a schema

Templates

MethodDescription
listTemplates()Parse templates (invoice, receipt, etc.)
listSchemaTemplates()Schema editor templates
getSchemaTemplate(templateId)Get template with full schema

Analytics & Pricing

MethodDescription
getAnalytics()Usage analytics
submitFeedback(feedback)Submit feedback
getPricing(billingCycle?)Get pricing tiers
getCurrentTier()Current subscription & quota

Parse Options

OptionTypeDescription
schemaRecord<string, any>Custom JSON schema
schemaTemplatestringPre-built template name
schemaIdstringSaved schema ID
useOcrbooleanEnable OCR (default: false)
ocrEnginestring"surya" or "groq_vision"
pagesnumber[]Specific pages to parse

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 2

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.5Registry latest15 Jul 20263
0.1.424 Jun 20263

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
risha-max/oxpdf-js

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:28 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d81937e1abedf8eb79c08a07dbcf129c1abdc8d292bef173052dba1491abb375