Skip to main content
  • Sync
  • Async
def get_document_status(
    document_id: str,
) -> Dict[str, Any]

Parameters

  • document_id (str): ID of the document to check

Returns

  • Dict[str, Any]: Status information including current status, potential errors, and other metadata

Examples

  • Sync
  • Async
from morphik import Morphik

db = Morphik()

# Check document processing status
status = db.get_document_status("doc_123abc")

print(f"Status: {status.get('status')}")
if status.get('error'):
    print(f"Error: {status.get('error')}")

# Use in a polling loop
import time

while True:
    status = db.get_document_status("doc_123abc")
    if status.get('status') == 'completed':
        print("Document processing complete!")
        break
    elif status.get('status') == 'failed':
        print(f"Document processing failed: {status.get('error')}")
        break
    time.sleep(2)

Notes

  • Common status values include: "processing", "completed", "failed"
  • This is a lightweight endpoint useful for checking progress without fetching the full document.
  • The SDK also provides a helper method for polling: see the document ingestion methods which can wait for completion automatically.