Skip to main content

htpbe — Python client

Python client for the HTPBE API — structural PDF tamper & forgery detection. It analyses a PDF's byte-level structure (xref tables, incremental updates, signatures, object streams) to detect whether a document was modified after creation. No original copy needed.

Not a KYC/identity platform — it's the structural PDF-forensics layer. Full API reference: https://htpbe.tech/api

Install

pip install htpbe

Quickstart

from htpbe import Client

client = Client(api_key="htpbe_live_...")  # get a key at https://htpbe.tech/api

result = client.analyze_and_wait("https://example.com/invoice.pdf")

print(result["status"])               # "intact" | "modified" | "inconclusive"
print(result["modification_markers"]) # e.g. ["HTPBE_POST_SIGNATURE_EDIT"]

A structural verdict describes the file, not the person who sent it, so it is never safe as the sole basis for an automatic adverse decision. Every result ships a usage_caution guardrail — branch on recommended_action to route the case instead of auto-rejecting:

action = result["usage_caution"]["recommended_action"]
# "no_action"             → intact: no adverse action (still not a guarantee)
# "route_to_human_review" → send to a human reviewer before any decision
# "request_from_issuer"   → verify the document with the issuing organisation

See examples/check_pdf.py for a complete routing example.

The API works on any publicly accessible PDF URL (≤ 10 MB), downloadable without authentication.

Two-step flow

analyze_and_wait is shorthand for the underlying two calls:

check_id = client.analyze("https://example.com/contract.pdf")
result = client.get_result(check_id)

List your checks

offset = 0
while True:
    page = client.list_checks(limit=50, offset=offset)
    for check in page["data"]:
        print(check["id"], check["status"])
    if not page["has_more"]:
        break
    offset += page["limit"]
print(page["total"])  # total number of checks matching the filters

Error handling

from htpbe import HtpbeAPIError

try:
    result = client.analyze_and_wait(url)
except HtpbeAPIError as exc:
    print(exc.status, exc.code, exc.message)  # e.g. 402 payment_required ...

Testing without spending credits

Test keys (htpbe_test_...) return deterministic synthetic results and only accept the documented test URLs — see the API docs. Live keys (htpbe_live_...) accept any public PDF URL and draw from your credit balance.

What you can detect

The verdict is intact, modified, or inconclusive, with named modification_markers. Common use cases:

License

MIT

Metadata

Release files for htpbe 0.2.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 htpbe 0.2.0
File Size Uploaded Provenance Actions
htpbe-0.2.0.tar.gz 6.6 kB With provenance Details for htpbe-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 12.4 kB

Release files / htpbe-0.2.0.tar.gz

Download URL htpbe-0.2.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
969d3514329b2702c7e54422995fa45aac8ceaaafed6fc0337d75bc82d1d6740
BLAKE2b-256 checksum
How to use checksums
5e681a6dfd72cc7b58b86513e5ae159c1b3f961effc3e2ac86479350d4c09ac5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Release files / htpbe-0.2.0-py3-none-any.whl

Download URL htpbe-0.2.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f247c74723c6124dd56c93a5dda3e68c76672e9daca7e285a1dae511c61d1914
BLAKE2b-256 checksum
How to use checksums
49a499dcfd8036a2af2640979a411b0260d3a1d7755652890b1fb1f8e88c62ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Security for htpbe 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for htpbe-0.2.0.tar.gz

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 Nov 23, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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