Skip to main content

Parze Python SDK

Official Python client for the Parze document processing API.

Installation

pip install parze

ai_only support requires parze version 0.2.8 or newer. Older SDKs used llm_only, which the API still accepts as a legacy alias.

Quick Start

from parze import ParzeClient

# Initialize client with your API key
client = ParzeClient(api_key="pk_live_your_key_here")

# Parse a document
result = client.parse("invoice.pdf")
print(result["text"])

# Extract structured data (one step)
schema = {
    "invoice_number": {"type": "string", "description": "Invoice number"},
    "total_amount": {"type": "string", "description": "Total amount"},
    "date": {"type": "string", "description": "Invoice date"}
}
extraction = client.extract(file="invoice.pdf", extraction_schema=schema)
print(extraction["extraction"])

# To avoid double billing, parse first and then extract with job_id
parse_result = client.parse("invoice.pdf")
extraction = client.extract(parse_result["text"], schema, parse_result["job_id"])

# Validate document quality (pre-validation)
validation = client.validate(
    "invoice.pdf",
    validation_type="pre",
    validation_rules={
        "quality_checks": {
            "min_resolution": 150,
            "check_readability": True,
            "check_completeness": True
        }
    }
)
print(validation)

# Get AI-suggested schema
suggested = client.suggest_schema(parse_result["text"])
print(suggested)

API Reference

parse(file, output_format="structured", preserve_tables=True, extraction_mode="ai_only")

Parse a document into structured text.

Parameters:

  • file (str or file object): Path to file or file object
  • output_format (str): "structured", "markdown", or "json"
  • preserve_tables (bool): Preserve table structure
  • extraction_mode (str): "ai_only", "auto", "ocr_only", or "identity_doc". Defaults to "ai_only" for Gemini quality-first extraction.

Returns: Dict with parsed text and metadata

extract(text=None, extraction_schema=None, job_id=None, file=None, extraction_mode="ai_only", preserve_tables=True)

Extract structured data from a file or parsed text using a schema.

Parameters:

  • text (str, optional): Document text (from parse)
  • extraction_schema (dict, required): Schema defining fields to extract
  • job_id (str, required if text is provided): Job ID from parse response
  • file (str or file object, optional): Path to file or file object (if provided, parse runs internally)
  • extraction_mode (str, optional): "ai_only", "auto", "ocr_only", or "identity_doc" (file-based only)
  • preserve_tables (bool, optional): Preserve table structure during parsing (file-based only)

Returns: Dict with extracted data and field metadata

suggest_schema(text)

Get AI-suggested extraction schema based on document text.

Parameters:

  • text (str): Document text

Returns: Dict with suggested schema

text_to_schema(description)

Convert natural language description to extraction schema.

Parameters:

  • description (str): Natural language description of fields

Returns: Dict with generated schema

validate(files, validation_type="pre", validation_rules=None, extraction_schema=None, job_id=None)

Validate document quality (pre) or extracted data (post).

Parameters:

  • files (str, file object, or list): Path(s) to file(s) or file objects
  • validation_type (str): "pre" or "post"
  • validation_rules (dict, optional): Validation rules payload
  • extraction_schema (dict, optional): Required for post-validation
  • job_id (str, optional): Job ID from parse

Returns: Dict with validation results

Get API Key

Get your API key from platform.parze.ai

Metadata

Release files for parze 0.2.8

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

Source distribution (sdist)

Source distribution for parze 0.2.8
File Size Uploaded Provenance Actions
parze-0.2.8.tar.gz 5.0 kB Without provenance Details for parze-0.2.8.tar.gz

Built distribution (wheel)

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

Total release size: 10.6 kB

Release files / parze-0.2.8.tar.gz

Download URL parze-0.2.8.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
825138d8a4c0cbc122a8170916fa76665c8b897c94d0e7efd76ff1b6790d494c
BLAKE2b-256 checksum
How to use checksums
bdb2b3997998ccf2085d7e7fb411313f62e7525a9401663a03d31a7f954fdf41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / parze-0.2.8-py3-none-any.whl

Download URL parze-0.2.8-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b4f0a38600dae4271efed05c32d54c47dc12be593cc6d52e5f6a2f4ff811d7b
BLAKE2b-256 checksum
How to use checksums
f90f288d3d68fa15c5d9fab4fbba6f30e1b8e2558aa402794d8a51dfceb811ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for parze 0.2.8

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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