Docs/API Reference
Reference

API Reference

Complete reference for the STET REST API endpoints and SSE streaming.

Base URL

base_url
http://localhost:8000

Interactive API documentation (Swagger UI) is available at /docs.

Endpoints

Standard Audit

POST/audit

Process a single PDF bank statement against a CSV/Excel ledger.

Request (multipart/form-data)
request
pdf_file: File    # Bank statement PDF
csv_file: File    # Ledger CSV or Excel
Response
response.json
{
  "matches": [...],
  "discrepancies": [...],
  "pdf_total_rows": 127,
  "ledger_total_rows": 134,
  "file_hash": "a7f3c9b2e1d8f456..."
}

Data Room Audit

POST/audit/dataroom

Process a ZIP file containing multiple PDFs and CSVs.

Request (multipart/form-data)
request
zip_file: File    # ZIP containing PDFs and CSVs

Note

Files in the ZIP are automatically classified by extension. All PDFs are treated as bank statements; all CSVs/Excel files as ledgers.

SSE Streaming

For real-time progress updates, connect to the SSE endpoint:

sse_endpoint
GET /api/v2/audit/{audit_id}/stream
Event: log
event_log.json
{
  "ts": "2024-01-04T12:00:00Z",
  "level": "info" | "success" | "warn" | "error" | "pass",
  "message": "Processing Pass 1: The Anchor",
  "pass": "Anchor" | "Semantic" | "Float" | "Redline"
}
Event: status
event_status.json
{
  "phase": "running" | "complete" | "error",
  "progress": 45,
  "counts": {
    "matched": 89,
    "discrepant": 3
  }
}
Event: done
event_done.json
{ "ok": true }

Response Types

MatchRecord

match_record.ts
{
  "id": "uuid",
  "pdf_row": Transaction,
  "ledger_row": Transaction,
  "match_type": "EXACT" | "FUZZY_HIGH" | "SEMANTIC" | "FLOAT",
  "confidence_score": 0.95,
  "details": "Perfect identity match"
}

Discrepancy

discrepancy.ts
{
  "type": "MISSING_ENTRY" | "TIMING_MISMATCH" | "AMOUNT_VARIANCE" | "CLASSIFICATION_ERROR",
  "pdf_row": Transaction | null,
  "ledger_row": Transaction | null,
  "details": "Transaction in PDF not found in Ledger"
}

Transaction

transaction.ts
{
  "date": "2024-01-15",
  "amount": 5000.00,
  "description": "AWS Monthly Invoice",
  "source": "pdf" | "ledger",
  "row_index": 0
}