{"_id":"@0xpdf/client","_rev":"2-5b5fbd5168c5373885aad1d21a892435","name":"@0xpdf/client","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.4":{"name":"@0xpdf/client","version":"0.1.4","keywords":["pdf","ocr","parsing","json","api","document","extraction"],"author":{"name":"0xPdf"},"license":"MIT","_id":"@0xpdf/client@0.1.4","maintainers":[{"name":"0xpdf","email":"admin@risha.one"}],"homepage":"https://github.com/risha-max/oxpdf-js#readme","bugs":{"url":"https://github.com/risha-max/oxpdf-js/issues"},"dist":{"shasum":"050f6f90c6805170e29608b3242b511d7c22126e","tarball":"https://registry.npmjs.org/@0xpdf/client/-/client-0.1.4.tgz","fileCount":9,"integrity":"sha512-U4xNW5tbX8bfXwLInmfnM4DSXVC29Ze8Y2QCaDl5LQelhsa2cgafMTV/pNkhO+T1BQ+Wh8dQdB521SZ4I4ET3g==","signatures":[{"sig":"MEUCIFzamuQaJUIEZjxpBC7KHz292EJ1KgiOZ9abLxfWKf/6AiEAhy20ljZ0q3509eAs5Zx45yt53+jpbIiVoCdi/OmpLYY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@0xpdf%2fclient@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":122903},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"99d614b98ebaf66307f34daa23f5562a676ddc75","scripts":{"build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"0xpdf","email":"admin@risha.one"},"repository":{"url":"git+https://github.com/risha-max/oxpdf-js.git","type":"git"},"_npmVersion":"10.8.2","description":"TypeScript/JavaScript SDK for the 0xPdf PDF-to-JSON API","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.4.0","@types/node":"^25.2.3"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.4_1782318004743_0.4959934828961061","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@0xpdf/client","version":"0.1.5","publishConfig":{"access":"public"},"description":"TypeScript/JavaScript SDK for the 0xPdf PDF-to-JSON API","keywords":["pdf","ocr","parsing","json","api","document","extraction"],"license":"MIT","author":{"name":"0xPdf"},"repository":{"type":"git","url":"git+https://github.com/risha-max/oxpdf-js.git"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"engines":{"node":">=18.0.0"},"scripts":{"build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"devDependencies":{"@types/node":"^25.2.3","tsup":"^8.0.0","typescript":"^5.4.0"},"homepage":"https://0xpdf.io","bugs":{"url":"https://github.com/risha-max/oxpdf-js/issues"},"_id":"@0xpdf/client@0.1.5","gitHead":"11bf268bf22b285ca09890e36694b2190d018062","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-10S32raq6bhEYUvd0qxeyINMlVkA3WZNdrEHileOT59q2trSRxAsjuzqFF1QeJTqBIdOHzoGGb+a2qXTSh3yJQ==","shasum":"316c03a7e0ab256bdbb45d04332f36c0cd1b2471","tarball":"https://registry.npmjs.org/@0xpdf/client/-/client-0.1.5.tgz","fileCount":9,"unpackedSize":123327,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@0xpdf%2fclient@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCQNH0pK+jAbMDAHMxM+iJbJkjnX+Zt8QznsRwelXWxNgIhAI5k0SD+oqLQiqGvYuB6187e63b6zl8v7kPsZ/i19Dkl"}]},"_npmUser":{"name":"0xpdf","email":"admin@risha.one"},"directories":{},"maintainers":[{"name":"0xpdf","email":"admin@risha.one"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client_0.1.5_1784133682884_0.22635153102560968"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-24T16:20:04.572Z","modified":"2026-07-15T16:41:23.345Z","0.1.4":"2026-06-24T16:20:04.875Z","0.1.5":"2026-07-15T16:41:23.065Z"},"bugs":{"url":"https://github.com/risha-max/oxpdf-js/issues"},"author":{"name":"0xPdf"},"license":"MIT","homepage":"https://0xpdf.io","keywords":["pdf","ocr","parsing","json","api","document","extraction"],"repository":{"type":"git","url":"git+https://github.com/risha-max/oxpdf-js.git"},"description":"TypeScript/JavaScript SDK for the 0xPdf PDF-to-JSON API","maintainers":[{"name":"0xpdf","email":"admin@risha.one"}],"readme":"# @0xpdf/client\n\nTypeScript/JavaScript SDK for the [0xPdf](https://0xpdf.io) PDF-to-JSON API.\n\nWorks in **Node.js 18+**, **Bun**, **Deno**, and the **browser** — zero dependencies, uses native `fetch`.\n\n## Demo\n\nSchema in, PDF in, JSON out — **22 seconds**:\n\n![0xPdf product demo](https://0xpdf.io/media/social-promo.gif)\n\n[Full MP4](https://0xpdf.io/media/social-promo.mp4) · [Try free](https://0xpdf.io/samples?utm_source=github&utm_medium=readme&utm_campaign=oxpdf-js) · [API docs](https://0xpdf.io/docs#sdks)\n\n## Installation\n\n```bash\nnpm install @0xpdf/client\n```\n\n> The legacy unscoped package [`oxpdf`](https://www.npmjs.com/package/oxpdf) is deprecated; use `@0xpdf/client` for new projects.\n\n## Quick Start\n\n```typescript\nimport { OxPDFClient } from \"@0xpdf/client\";\n\nconst client = new OxPDFClient({ apiKey: \"your_api_key\" });\n\n// Parse with a built-in template\nconst result = await client.parse(pdfBuffer, \"invoice.pdf\", {\n  schemaTemplate: \"invoice\",\n});\nconsole.log(result.data);\n\n// Parse from a file path (Node.js only)\nconst result2 = await client.parseFile(\"./invoice.pdf\", {\n  schemaTemplate: \"invoice\",\n});\n\n// Queue async processing and wait for completion\nconst queued = await client.upload(pdfBuffer, \"invoice.pdf\", {\n  schemaId: \"your_schema_id\",\n});\nconst finalStatus = await client.waitForJob(queued.job_id, {\n  intervalMs: 2000,\n  timeoutMs: 180000,\n});\nconsole.log(finalStatus.status);\n\n// Streaming parse with real-time progress\nfor await (const event of client.parseFileStream(\"./large.pdf\", {\n  schemaTemplate: \"invoice\",\n})) {\n  if (event.event === \"page\") console.log(event.data.message);\n  if (event.event === \"complete\") console.log(\"Done!\", event.data);\n}\n```\n\n## Browser Usage\n\n```typescript\nconst input = document.querySelector<HTMLInputElement>(\"#pdf-upload\")!;\ninput.addEventListener(\"change\", async () => {\n  const file = input.files![0];\n  const result = await client.parse(file, file.name, {\n    schemaTemplate: \"invoice\",\n  });\n  console.log(result.data);\n});\n```\n\n## Error Handling\n\n```typescript\nimport { OxPDFClient, OxPDFError } from \"@0xpdf/client\";\n\ntry {\n  const result = await client.parseFile(\"doc.pdf\", {\n    schemaTemplate: \"invoice\",\n  });\n} catch (e) {\n  if (e instanceof OxPDFError) {\n    console.error(`API error: ${e.message} (status: ${e.statusCode})`);\n  }\n}\n```\n\n## Full API Reference\n\n### Constructor\n\n```typescript\nnew OxPDFClient({ apiKey, baseUrl?, timeout?, retry? })\n```\n\n| Option    | Type     | Default                              | Description          |\n| --------- | -------- | ------------------------------------ | -------------------- |\n| `apiKey`  | `string` | —                                    | Your 0xPdf API key   |\n| `baseUrl` | `string` | `https://api.0xpdf.io/api/v1`      | API base URL         |\n| `timeout` | `number` | `120000`                             | Request timeout (ms) |\n| `retry` | `object` | `{ maxRetries: 2, initialDelayMs: 500, backoffMultiplier: 2 }` | Retry/backoff config |\n\n### PDF Parsing\n\n| Method | Description |\n|---|---|\n| `parse(file, filename, options?)` | Sync parse from Buffer/Blob/File |\n| `parseFile(filePath, options?)` | Sync parse from file path (Node.js) |\n| `parseStream(file, filename, options?)` | Streaming SSE parse (async generator) |\n| `parseFileStream(filePath, options?)` | Streaming parse from file (Node.js) |\n| `validate(file, filename, options?)` | Dry-run validation |\n\n### Async Jobs\n\n| Method | Description |\n|---|---|\n| `upload(file, filename, options?)` | Queue PDF for background processing |\n| `jobStatus(jobId)` | Poll async job status |\n| `waitForJob(jobId, options?)` | Poll until `completed`/`failed` (with timeout) |\n\n### Image Extraction\n\n| Method | Description |\n|---|---|\n| `extractImages(file, filename, options?)` | Extract images from a PDF |\n| `listImages(limit?, offset?)` | List extracted images |\n| `getImageUrl(imageId, expirationSeconds?)` | Get/refresh presigned URL |\n| `deleteImage(imageId)` | Delete a specific image |\n| `deleteAllImages()` | Delete all images |\n\n### File Management\n\n| Method | Description |\n|---|---|\n| `listFiles()` | List uploaded PDFs |\n| `getFile(pdfId)` | Get PDF metadata + download URL |\n| `deleteFile(pdfId)` | Delete an uploaded PDF |\n\n### Schema CRUD\n\n| Method | Description |\n|---|---|\n| `listSchemas()` | List saved schemas |\n| `getSchema(schemaId)` | Get schema with full definition |\n| `createSchema(options)` | Create a new schema |\n| `updateSchema(schemaId, options)` | Update existing schema |\n| `deleteSchema(schemaId)` | Delete a schema |\n| `setDefaultSchema(schemaId)` | Set as default |\n| `generateSchema(options)` | AI-generate a schema |\n\n### Templates\n\n| Method | Description |\n|---|---|\n| `listTemplates()` | Parse templates (invoice, receipt, etc.) |\n| `listSchemaTemplates()` | Schema editor templates |\n| `getSchemaTemplate(templateId)` | Get template with full schema |\n\n### Analytics & Pricing\n\n| Method | Description |\n|---|---|\n| `getAnalytics()` | Usage analytics |\n| `submitFeedback(feedback)` | Submit feedback |\n| `getPricing(billingCycle?)` | Get pricing tiers |\n| `getCurrentTier()` | Current subscription & quota |\n\n### Parse Options\n\n| Option           | Type                   | Description                            |\n| ---------------- | ---------------------- | -------------------------------------- |\n| `schema`         | `Record<string, any>`  | Custom JSON schema                     |\n| `schemaTemplate` | `string`               | Pre-built template name                |\n| `schemaId`       | `string`               | Saved schema ID                        |\n| `useOcr`         | `boolean`              | Enable OCR (default: `false`)          |\n| `ocrEngine`      | `string`               | `\"surya\"` or `\"groq_vision\"`          |\n| `pages`          | `number[]`             | Specific pages to parse                |\n","readmeFilename":"README.md"}