Client
Synchronous and asynchronous client classes for the DocuTray API
The main client classes for interacting with the DocuTray API.
Client
Synchronous client for the DocuTray API.
Example:
>>> client = Client(api_key="sk_test_123")
>>> # Convert a document
>>> result = client.convert.run(
... file=Path("invoice.pdf"),
... document_type_code="invoice"
... )
>>> print(result.data)
>>> client.close()
Or using a context manager:
>>> with Client(api_key="sk_test_123") as client:
... result = client.identify.run(file=Path("document.pdf"))
... print(f"Type: {result.document_type.name}")Properties:
-
convert: Document conversion operations. -
document_types: Document type catalog operations. -
identify: Document identification operations. -
knowledge_bases: Knowledge base operations for semantic search. -
steps: Step execution operations.
AsyncClient
Asynchronous client for the DocuTray API.
Example:
>>> async with AsyncClient(api_key="sk_test_123") as client:
... result = await client.convert.run(
... file=Path("invoice.pdf"),
... document_type_code="invoice"
... )
... print(result.data)Properties:
-
convert: Document conversion operations (async). -
document_types: Document type catalog operations (async). -
identify: Document identification operations (async). -
knowledge_bases: Knowledge base operations for semantic search (async). -
steps: Step execution operations (async).