doccheap-haystack
A Haystack component for doc.cheap: give it photos or scans of passports, national ID cards or driving licences and it returns Haystack documents with the printed fields – name, date of birth, document number, expiry, the machine-readable zone.
One recognised document costs one credit, $0.01. Registering gives 100 free documents every month. An unreadable image, an empty frame or an unsupported document type costs nothing, and every answer says whether it was billed.
The package needs Python 3.10 or later. It is built on the
doc-cheap client and haystack-ai.
Installation
pip install doccheap-haystack
The component
DocCheapConverter takes a list of sources: image file paths, http(s)://
URLs or ByteStream objects, each one JPEG or PNG image of up to 25 MiB.
It returns two outputs:
documents– oneDocumentper image. Its content is oneLabel: valueline per field that was read. Its meta holdsdoc_cheap_scan_id,doc_cheap_statusanddoc_cheap_billed, plus the source'sfile_pathorurland anymetayou passed in.scans– the API's full answer for each of those images, in the same order.
An image with no readable document still gives a document: its content is
empty and doc_cheap_status says why, for example no_document_found. A
source that cannot be opened or downloaded, is empty or is too large is skipped
with a warning. Any other failure – a wrong key, no credits left, a bad setting
– is raised.
| Parameter | Default | Meaning |
|---|---|---|
api_key |
Secret.from_env_var("DOC_CHEAP_API_KEY", strict=False) |
The API key. |
base_url |
DOC_CHEAP_API_BASE, else https://api.doc.cheap |
The API address. |
timeout |
60.0 |
Seconds to wait for the API and for each URL download. |
expect_country |
None |
The issuing country you expect (ISO 3166-1 alpha-3). |
retain_hours |
None |
How long the API keeps the result; 0 keeps nothing. |
store_full_path |
False |
Keep the whole file path in meta, not just the file name. |
Usage
On its own:
from haystack.utils import Secret
from haystack_integrations.components.converters.doc_cheap import DocCheapConverter
converter = DocCheapConverter(api_key=Secret.from_token("sk_sandbox_public"))
result = converter.run(sources=["https://doc.cheap/og-card.png"])
for document in result["documents"]:
print(document.meta["doc_cheap_status"], document.meta["doc_cheap_billed"])
print(document.content)
In a pipeline that stores the results:
import os
from haystack import Pipeline
from haystack.components.writers import DocumentWriter
from haystack.document_stores.in_memory import InMemoryDocumentStore
from haystack_integrations.components.converters.doc_cheap import DocCheapConverter
os.environ.setdefault("DOC_CHEAP_API_KEY", "sk_sandbox_public")
store = InMemoryDocumentStore()
pipeline = Pipeline()
pipeline.add_component("reader", DocCheapConverter())
pipeline.add_component("writer", DocumentWriter(document_store=store))
pipeline.connect("reader.documents", "writer.documents")
pipeline.run({"reader": {"sources": ["https://doc.cheap/og-card.png"]}})
print(store.count_documents())
The component serialises with the pipeline. The key is saved as the name of its environment variable, never as its value.
API keys
- Live key –
sk_live_…, created in the doc.cheap cabinet. - Sandbox key –
sk_sandbox_publicworks without an account. It gives 10 free recognised documents per address in all, and at most 10 requests per address an hour, whatever their answer.
Resources
License
Metadata
Release files for doccheap-haystack 0.1.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 |
|---|---|---|---|---|
| doccheap_haystack-0.1.0.tar.gz | 9.1 kB | With provenance | Details for doccheap_haystack-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| doccheap_haystack-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for doccheap_haystack-0.1.0-py3-none-any.whl |
Total release size: 17.6 kB
Release files / doccheap_haystack-0.1.0.tar.gz
| Download URL | doccheap_haystack-0.1.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
965c06e0f78c6010f4356e0c4b95cab488537f9c4f3eacfae27d74ca610ecc76
|
|
BLAKE2b-256 checksum How to use checksums |
bb41f49299be52715bfe3aa7fa05ca6771e5595019688a2d4d9da5cbaa83887b
|
| 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 4, 2026.
Transparency logRelease files / doccheap_haystack-0.1.0-py3-none-any.whl
| Download URL | doccheap_haystack-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c507dbe53f0af02693dddbefc853c44576c2f0a71a9c78b7e6cf2daa2024d537
|
|
BLAKE2b-256 checksum How to use checksums |
9ca98890b4556f3e3df0e5b184a5dd0be1f8776d5a85d4ff6659989784547461
|
| 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 4, 2026.
Transparency logSecurity for doccheap-haystack 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for doccheap_haystack-0.1.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 Oct 4, 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.