Skip to main content

parserbee-python

Python client for the ParserBee API. Send a PDF, scan or phone photo of an invoice, purchase order, receipt or bank statement, and get back structured JSON that matches your Parser Template.

Install

pip install parserbee

Requires Python 3.9 or later.

Before you start

  1. Create a free account at app.parserbee.com. New accounts get 25 free pages, no credit card.
  2. Create a Parser Template: upload one sample document and the AI builds the fields for you, or pick a ready-made one from the template library.
  3. Copy your API key from Settings (it starts with pk_) and the template ID from the template page.
export PARSERBEE_API_KEY=pk_your_api_key

Quick start

from parserbee import ParserBee

client = ParserBee()  # reads PARSERBEE_API_KEY

result = client.extract("your_template_id", "invoice.pdf")
print(result["data"])
# {'invoice_number': 'INV-2026-001', 'vendor_name': 'Acme Corp', 'total_amount': 1500.0, ...}

Extract from a public link instead of a local file:

result = client.extract("your_template_id", file_url="https://example.com/invoice.pdf")

An open binary file works too:

with open("receipt.jpg", "rb") as f:
    result = client.extract("your_template_id", f)

The response

extract() returns the API response as a dict:

Key What it holds
data The extracted fields, shaped like your Parser Template
request_id The request ID (also in Activity in the dashboard)
credits_remaining Page credits left after this call
usage pages_processed, credits_charged, doc_size_bytes
processing_time_ms Time taken

Each extraction costs 1 page credit per page processed, with a minimum of 1.

Other methods

client.list_templates()          # every Parser Template in the account
client.get_template("tpl_id")    # one template with its fields
client.get_credits()             # balance, plan and subscription status
client.list_activity()           # the last 10 extractions
client.get_activity("req_id")    # one extraction, with its data

Errors

Every error is a subclass of parserbee.ParserBeeError, with .code and .status:

Exception When
InvalidRequestError 400: missing field, or a file type that is not accepted
AuthenticationError 401: missing or invalid API key
InsufficientCreditsError 402: no page credits left (.credits_remaining)
PermissionDeniedError 403: no active subscription
NotFoundError 404: template or request not found
APIError Any other API error
APIConnectionError The request did not reach the API
from parserbee import InsufficientCreditsError

try:
    client.extract("your_template_id", "invoice.pdf")
except InsufficientCreditsError:
    print("Top up page credits in the dashboard")

Examples

The examples folder has scripts you can run as they are:

  • extract_invoice.py: one file, printed as JSON
  • extract_from_url.py: a document that is already online
  • folder_to_csv.py: every PDF and image in a folder, one CSV row each
  • check_credits.py: balance and template IDs

Supported files

PDF, PNG, JPG, WebP and HEIC, up to 50 MB. The API also reads DOC, PPT, PPTX, XLSX, CSV, TXT, RTF, ODT, HTML and EML; see the API reference for details. Scans and phone photos work, and there is no need to run OCR first. DOCX is not accepted: save it as PDF first.

No code needed?

If you only need the data in a spreadsheet, you do not need this library. Data Lab in the dashboard takes a batch of documents and exports one combined Excel, CSV or Google Sheets file. To try a single invoice in the browser, use the free invoice parser.

Choosing a tool for invoices? Our comparison of invoice OCR software covers 10 options, tested on real invoices, scans and phone photos.

License

MIT

Metadata

Release files for parserbee 0.1.0

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

Source distribution (sdist)

Source distribution for parserbee 0.1.0
File Size Uploaded
parserbee-0.1.0.tar.gz 9.1 kB Details

Built distribution (wheel)

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

Total release size: 16.3 kB

Release files / parserbee-0.1.0.tar.gz

Download URL parserbee-0.1.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f4a11d7d63a23d19c41498b1d21b36ed4aed0c09b63e045884341c91329ceaf6
BLAKE2b-256 checksum
How to use checksums
684dc00811626bce6a412c2300e66410fdde6a5b8295e54a6a9b1dbc826ef599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release files / parserbee-0.1.0-py3-none-any.whl

Download URL parserbee-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34cc81688a26023d1fda280ee738b0ab027df8b03caff79296d5548df3cd6562
BLAKE2b-256 checksum
How to use checksums
439665acd5ac52b3b217559c039f66e4fc2a46f9b8316622d83fe330e993993c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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