AI Document Processing
BalanceSheet Pro's core value proposition is AI-powered document-to-journal automation.
Workflow
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Upload │────▶│ Classify │────▶│ Extract │
│ Document │ │ Document │ │ Data │
└──────────────┘ └──────────────┘ └──────────────┘
│
▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Post │◀────│ Approve │◀────│ Propose │
│ Journal │ │ /Reject │ │ Journal │
└──────────────┘ └──────────────┘ └──────────────┘
Step 1: Upload
curl -X POST http://localhost:8000/api/v1/documents/upload \
-H "Authorization: Bearer TOKEN" \
-F "company_id=COMPANY_ID" \
-F "file=@invoice.pdf" \
-F "document_type=invoice"
Step 2: AI Processing
curl -X POST http://localhost:8000/api/v1/ai/process-document/DOC_ID \
-H "Authorization: Bearer TOKEN"
Response:
{
"proposal_id": "uuid",
"document_type": "invoice",
"confidence": 0.92,
"proposed_entry": {
"description": "Payment to Vendor",
"lines": [
{"account_code": "6000", "debit": 1000.00, "credit": 0},
{"account_code": "2000", "debit": 0, "credit": 1000.00}
],
"confidence": 0.85,
"explanation": "Standard expense payable entry"
}
}
Step 3: Review
Accountant reviews the AI proposal:
- Accept — Creates journal entry
- Reject — Discards proposal
- Modify — Edit before accepting
AI Provider Configuration
Set environment variables:
AI_API_KEY=your-api-key
AI_BASE_URL=https://api.openai.com/v1
AI_MODEL=gpt-4o-mini
Works with any OpenAI-compatible API:
- OpenAI
- Azure OpenAI
- Local LLMs (Ollama, vLLM, etc.)
Fallback (No AI)
If no AI API key is configured, a mock provider returns sample data for testing.