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"])

# Get AI-suggested schema
suggested = client.suggest_schema(text)
print(suggested)

API Reference

parse(file, output_format="structured", preserve_tables=True, preserve_layout=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
  • preserve_layout (bool): Preserve document layout
  • 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, preserve_layout=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)
  • preserve_layout (bool, optional): Preserve document layout 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

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.3.tar.gz (4.2 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.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: parze-0.2.3.tar.gz
  • Upload date:
  • Size: 4.2 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.3.tar.gz
Algorithm Hash digest
SHA256 5024478261ecc103abcbfd6ec2b09274d95bb7ff37520d26834714683725edc3
MD5 566b644a4d2332936a79a782953c1acb
BLAKE2b-256 25e037f2a03c382f1fc6d6cf1b6ffbdde675b3254d9021592dc107c54e693b59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parze-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b8a07c424fe7771d2c4b7af2e9b12760ea156ab27d828a4e1c79b95fa449d647
MD5 09ab74d51bfe5d7e9553eee2b01cbacd
BLAKE2b-256 b5d6c1103706822095e39601568fd526267375ced074ccba30c56db5dfb95dfa

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