Skip to main content

Python SDK for the Parze API

Project description

Parze Python SDK

Official Python client for the Parze document parsing API.

Installation

pip install parze

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(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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parze-0.2.7.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parze-0.2.7-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file parze-0.2.7.tar.gz.

File metadata

  • Download URL: parze-0.2.7.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for parze-0.2.7.tar.gz
Algorithm Hash digest
SHA256 1f58630a1c3728f66fcbf10a03421fb42ce622937a8b134970185c49f054d4f8
MD5 547e7bbebdb88fc20558adc32a9dd526
BLAKE2b-256 71539727a4e73f0c067f202b5e9d1e8f3f4c911c7ea3daa16d27d79209d78544

See more details on using hashes here.

File details

Details for the file parze-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: parze-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for parze-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6ad03241126d64f15d691736a3408e6bb74a74826f0b15cbc3e47b4d72e3a200
MD5 0491aa5318bc348f1140c6984a4994bf
BLAKE2b-256 b51c3ef7223ce29e1ca745c05730ac13ea7149e4ec7c25b3d9c96b276668e601

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page