Skip to main content

oxpdf

Python SDK for the 0xPdf PDF-to-JSON API.

Demo

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

0xPdf product demo

Full MP4 · Try free · API docs

Installation

pip install "oxpdf @ git+https://github.com/risha-max/oxpdf-python.git@main"

Quick Start

from oxpdf import Client

client = Client(api_key="your_api_key")

# Parse with a built-in template
result = client.parse("invoice.pdf", schema_template="invoice")
print(result["data"])

# Parse with a custom schema
result = client.parse("doc.pdf", schema={
    "type": "object",
    "properties": {
        "title": {"type": "string"},
        "amount": {"type": "number"}
    }
})

# Stream parse with real-time progress
for event in client.parse_stream("large.pdf", schema_template="invoice"):
    if event["event"] == "page":
        print(f"Progress: {event['data'].get('message')}")
    elif event["event"] == "complete":
        print("Done!", event["data"])

# Queue async processing and wait for completion
queued = client.upload("invoice.pdf", schema_id="your_schema_id")
status = client.wait_for_job(
    queued["job_id"],
    interval_seconds=2.0,
    timeout_seconds=180.0,
)
print(status["status"])

Error Handling

from oxpdf import Client, OxPDFError

client = Client(api_key="your_api_key")

try:
    result = client.parse("doc.pdf", schema_template="invoice")
except OxPDFError as e:
    print(f"API error: {e} (status: {e.status_code})")
except FileNotFoundError:
    print("PDF file not found")

Full API Reference

Client

Client(
  api_key,
  base_url="https://api.0xpdf.io/api/v1",
  timeout=120,
  max_retries=2,
  retry_delay=0.5,
  backoff_multiplier=2.0
)

PDF Parsing

Method Description
parse(file_path, *, schema, schema_template, schema_id, use_ocr, ocr_engine, pages) Sync parse — returns structured JSON
parse_stream(file_path, *, schema, schema_template, schema_id, use_ocr, ocr_engine, pages, batch_size) Streaming parse via SSE — yields events
validate(file_path, *, schema_id, schema_name) Dry-run validation without processing

Async Jobs

Method Description
upload(file_path, *, schema_id, schema_name, use_ocr, ocr_engine) Queue PDF for background processing
job_status(job_id) Poll async job status
wait_for_job(job_id, *, interval_seconds, timeout_seconds) Poll until completed/failed

Image Extraction

Method Description
extract_images(file_path, *, pages, min_width, min_height, use_ocr, ocr_engine) Extract images from a PDF
list_images(*, limit, offset) List extracted images
get_image_url(image_id, *, expiration_seconds) Get/refresh presigned URL
delete_image(image_id) Delete a specific image
delete_all_images() Delete all images

File Management

Method Description
list_files() List uploaded PDFs
get_file(pdf_id) Get PDF metadata + download URL
delete_file(pdf_id) Delete an uploaded PDF

Schema CRUD

Method Description
list_schemas() List saved schemas
get_schema(schema_id) Get schema with full definition
create_schema(name, schema, *, is_default) Create a new schema
update_schema(schema_id, name, schema, *, is_default) Update existing schema
delete_schema(schema_id) Delete a schema
set_default_schema(schema_id) Set as default
generate_schema(description, *, refinement, current_schema, selected_text) AI-generate a schema

Templates

Method Description
list_templates() Parse templates (invoice, receipt, etc.)
list_schema_templates() Schema editor templates
get_schema_template(template_id) Get template with full schema

Analytics & Pricing

Method Description
get_analytics() Usage analytics
submit_feedback(feedback) Submit feedback
get_pricing(*, billing_cycle) Get pricing tiers
get_current_tier() Current subscription & quota

Metadata

Release files for oxpdf 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oxpdf 0.1.4
File Size Uploaded Provenance
oxpdf-0.1.4.tar.gz 9.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for oxpdf 0.1.4
File Interpreter ABI Platform
oxpdf-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / oxpdf-0.1.4.tar.gz

Download URL oxpdf-0.1.4.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
08ce7cdbd12afdbf3e9bd253be520badcf125c145897a032227445231cf175d0
BLAKE2b-256 checksum
How to use checksums
2bfe9927500b11706039bbde5aa48057e65e6228c157ad0a89738dbff9a4cb90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

Release files / oxpdf-0.1.4-py3-none-any.whl

Download URL oxpdf-0.1.4-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bf6efb223a7b6e88f53801d04136f68626ce122b1fee9cf8f203c1cb675fc69
BLAKE2b-256 checksum
How to use checksums
ec076714d003b99fa4a2eb27d4b40d054218268176bdeb5bf3b0ea4402d7d7fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

Security for oxpdf 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for oxpdf-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page