Python SDK
Quickly integrate Docflow document workflow management capabilities with docflow-sdk Python SDK
docflow-sdk is the official Python SDK for TextIn Docflow, providing workspace management, document classification, intelligent review, type-safe response models, and comprehensive error handling.
Installation
System Requirements: Python >= 3.8
Authentication and Initialization
The SDK supports multiple authentication methods (priority: constructor parameters > environment variables > .env file):
Using environment variables is recommended to avoid hardcoding credentials in your code.
API Overview
Workspace Management
Workspaces are the top-level organizational unit in Docflow, used to isolate document processing workflows for different business scenarios.
Create Workspace
List Workspaces
Method Chaining (Recommended)
Simplify code through context binding, reducing repetitive parameter passing:
Document Category Management
Categories define structured fields and extraction rules for documents.
Create Category (with Sample Files)
Field Management
Table Management
Sample Management
File Processing
Upload and Recognize Files
Get Recognition Results
Intelligent Review
Docflow provides LLM-based intelligent review capabilities, supporting single-document rule validation and cross-document review.
Create Review Rule Repository
Cross-Document Review
Submit Review Task
Get Review Results
Enumeration Types
The SDK provides complete enumeration type definitions to avoid parameter errors:
Use iterators to automatically handle pagination without manual looping:
Error Handling
The SDK provides comprehensive error classification for precise handling of different exception scenarios.
Error Types
Error Handling Example
Internationalization (i18n)
The SDK supports multilingual error messages:
Advanced Configuration
Timeout and Retry
Custom Retry Configuration
Custom API Address
Resource Management
Use context manager to automatically close connections:
Debug Logging
Enable DEBUG level logging to view request details:
Complete Examples
See the examples directory for complete usage examples:
FAQ