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="auto")

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): "auto", "ocr_only", "llm_only", or "identity_doc"

Returns: Dict with parsed text and metadata

extract(text=None, extraction_schema=None, job_id=None, file=None, extraction_mode="auto", 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): "auto", "ocr_only", "llm_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 confidence scores

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.5.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.5-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for parze-0.2.5.tar.gz
Algorithm Hash digest
SHA256 15c7f18ce2248a25b85ca5475065aa8a1ed559e3da2ae55d6d7c3e3f1be709eb
MD5 4c485ebbe4212ada6eb149c4cf964431
BLAKE2b-256 d91bdff463e97558126a9e3af1f0e40b9f980196a300a40100f57098c0f3b184

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parze-0.2.5-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.9.6

File hashes

Hashes for parze-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e1c9b194fb99041711b6a514fea62e6681ce642fac699985d467b7fe693c16b8
MD5 13698d1c34084dcb467610963ed06ccd
BLAKE2b-256 48ae5cb56170e2afa61a080b3e9756606ce20a2a011c76ff1b2a183378cdcf2a

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