HyperAPI Python SDK: parse, extract, classify, split and redact documents.
Install
pip install hyperapi-sdk
Python 3.9 or later. The package is hyperapi-sdk and imports as hyperapi.
The
hyperapipackage on PyPI is a different project. Installhyperapi-sdk.
Quick start
Create an API key in the dashboard and
set it as HYPERAPI_KEY.
from hyperapi import HyperAPIClient
with HyperAPIClient() as client: # reads HYPERAPI_KEY
result = client.parse("invoice.pdf")
print(result.result.ocr) # the document's text
Every call takes a file path, uploads the file and waits for the result.
Operations
| Method | What it does | Result |
|---|---|---|
parse(file, mode=None) |
Text and layout of every page. mode="advanced" adds HTML and markdown per page (Plus plan or higher). |
ParseResponse |
extract(file, category=None, schema=None) |
Structured fields. category="financial" for invoices and receipts; schema= to define your own output shape. |
ExtractResponse |
extract_advanced(file) |
Structured fields; detects the document type for you. | ExtractResponse |
classify(file, options=None) |
The document type. | ClassifyResponse |
split(file, options=None) |
Splits a multi-document file into its documents. | SplitResponse |
redact(file, mode="redact") |
Masks personal data; mode="deidentify" replaces it with synthetic values. |
RedactResponse |
process(file) |
Parse and extract in one call. | ProcessResult |
fields = client.extract("invoice.pdf", category="financial")
print(fields.result["entities"], fields.result["line_items"])
policy = client.extract(
"policy.pdf",
schema={"policy_number": None, "active": False}, # the shape you want back
)
print(policy.result["data"])
doc_type = client.classify("doc.pdf").result["document_type"]
split = client.split("binder.pdf").result
splits = split["segmentation"]["splits"] if "segmentation" in split else [] # a single document needs no split
masked = client.redact("contract.pdf")
print(masked.result["summary"]) # {"PERSON_NAME": 2, "EMAIL": 1, ...}
schema takes a dict, a JSON string, or a pathlib.Path to a JSON file.
Typed responses
Results are pydantic v2 models generated from the API's OpenAPI description
(openapi/hyperapi-public.yaml),
so editors complete field names and type checkers catch typos.
result.result.pages[0].text # attribute access
result["result"]["pages"] # dict-style access also works
result.to_dict() # a plain dict, e.g. for json.dumps
- A field the API adds later stays on the model and in
to_dict(). - If a reply does not match its model, you get a
GenericResponsewith the same data, and the SDK logsresponse_model_mismatchonce. Use dict-style access (result["items"]) on it; typed attributes such asitems_are not there. - A key that clashes with a method gets a trailing underscore as an attribute:
batch.items_(the key is stillbatch["items"]).
Async client
AsyncHyperAPIClient has the same methods; each one is a coroutine. Close it with
async with or await client.aclose().
import asyncio
from hyperapi import AsyncHyperAPIClient
async def main():
async with AsyncHyperAPIClient() as client:
results = await asyncio.gather(
client.parse("a.pdf"), client.parse("b.pdf"),
)
asyncio.run(main())
HyperAPIClient is not thread-safe; use one client per thread.
AsyncHyperAPIClient can be shared across tasks.
Jobs and batches
Submit without waiting, then collect the result later:
job = client.submit_extract("big.pdf")
result = client.wait_for_job(job) # or client.get_job(job.job_id)
client.delete_job(job.job_id) # cancel
Process many files as one batch:
batch = client.create_batch_from_files(
endpoint="/v1/classify",
file_paths=["a.pdf", "b.pdf", "c.pdf"],
idempotency_key="nightly-2026-12-01", # resubmitting returns the same batch
)
status = client.wait_for_batch(batch.batch_id)
for item in status.items_:
print(item.doc_index, item.status, item.result_url)
Batches accept /v1/parse, /v1/extract, /v1/extract-omni, /v1/classify,
/v1/split and /v1/redact. wait_for_batch() returns the first 200 items; for a
larger batch, page with get_batch(batch_id, offset=200). Each result_url expires;
call get_batch() again for a fresh one.
Configuration
client = HyperAPIClient(
api_key=None, # default: HYPERAPI_KEY
timeout=120.0, # seconds per HTTP call
poll_interval=3.0, # seconds between status checks
poll_timeout=3600.0, # seconds to wait for a job
)
- Limits:
client.get_limits()returns your account's file size and page limits per operation. - Proxies and certificates: the standard
HTTPS_PROXY,NO_PROXYandSSL_CERT_FILEvariables work. For SOCKS,pip install "hyperapi-sdk[socks]". - Logging:
logging.getLogger("hyperapi").setLevel(logging.INFO). The SDK never logs API keys or file contents. - Retries: the SDK retries status checks, not submits, so a job is never created or billed twice.
Errors
All errors subclass HyperAPIError and carry status_code, code and request_id.
Include the request_id when you contact support.
| Error | When |
|---|---|
AuthenticationError |
Missing or invalid API key (401) |
RateLimitError |
Too many requests (429); see retry_after |
DocumentUploadError |
The upload failed, the file is too large (413) or the type is not supported (415) |
ParseError, ExtractError, ClassifyError, SplitError, RedactError |
The operation failed, or the document is over its page limit (413) |
JobTimeoutError |
poll_timeout passed before the job finished |
JobCancelledError |
The job was cancelled |
Supported files
PDF; images (PNG, JPEG, GIF, WebP, TIFF, HEIC, HEIF); Office (DOCX, DOC, XLSX, XLS, PPTX, PPT); text and data (CSV, TXT, MD, RTF, JSON, XML); XPS and OXPS; email (EML, MSG).
More
- Documentation
- Walkthrough notebook
- Changelog
- Issues · Security · support: hyperapi-support@hyperbots.com
Development
pip install -e ".[dev]"
ruff check hyperapi/
pytest
License
Metadata
Release files for hyperapi-sdk 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hyperapi_sdk-0.8.0.tar.gz | 84.5 kB | With provenance | Details for hyperapi_sdk-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hyperapi_sdk-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for hyperapi_sdk-0.8.0-py3-none-any.whl |
Total release size: 169.2 kB
Release files / hyperapi_sdk-0.8.0.tar.gz
| Download URL | hyperapi_sdk-0.8.0.tar.gz |
|---|---|
| Size | 84.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43a690795348451fd7083921923cfe3b6da42da6ed79478928fb8a8d51ced7d5
|
|
BLAKE2b-256 checksum How to use checksums |
b8cf3c9c6c03def18b18a86435b77b7cc938cd5852c9b0da18a956cfda8c6853
|
| 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 Dec 1, 2026.
Transparency logRelease files / hyperapi_sdk-0.8.0-py3-none-any.whl
| Download URL | hyperapi_sdk-0.8.0-py3-none-any.whl |
|---|---|
| Size | 84.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ffa58e7e86463cf04452e481ff8d17f3533db77c93e25adaa3bb79cd7e4491f8
|
|
BLAKE2b-256 checksum How to use checksums |
b87410cec3a4f79ff4f2579c163d5696f070e7820dfecc629172d97766f65362
|
| 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 Dec 1, 2026.
Transparency logSecurity for hyperapi-sdk 0.8.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.
Attestation for hyperapi_sdk-0.8.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 Dec 1, 2026.
Transparency logA 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.