End-to-End Technical Workflow

Receipt-to-Expense Analysis: Multi-Tool Pipeline

Connect three specialized Apex Forge developer tools into a zero-code document pipeline. In this worked example, we take a photographed receipt, extract clean structured JSON, validate the merchant tax ID format, and query quarterly expense aggregates using natural English.

STEP 01 · EXTRACTION

1. Apex Forge OCR

User attaches receipt photo. OCR engine deskews, detects blur, extracts fields, and performs arithmetic check (subtotal + tax = total).

STEP 02 · FORMAT VALIDATION

2. Apex Forge Regex

Validates merchant tax identification numbers (e.g. GSTIN, VAT ID) or invoice sequences using tested regular expressions.

STEP 03 · SQL ANALYSIS

3. Apex Forge SQL

Seeds SQLite WASM sandbox with extracted line items and executes queries like "Show total spend grouped by vendor category".

Extract Structured JSON from Receipt Photo

Attach your receipt photo to Apex Forge OCR (@OCR-Doc-Parser) with the starter prompt:

Extract the vendor, date, line items, tax, and grand total.

Extracted verified JSON response:

{
  "vendor": { "value": "METRO LOGISTICS SUPPLIES", "confidence": "high" },
  "date": { "value": "2026-07-15", "confidence": "high" },
  "invoice_no": { "value": "INV-2026-8812", "confidence": "high" },
  "tax_id": { "value": "27AAAPL1234C1ZV", "confidence": "high" },
  "line_items": [
    { "description": "Thermal Packing Rolls (5x)", "amount": 145.00 },
    { "description": "Industrial Shipping Labels", "amount": 85.00 }
  ],
  "subtotal": { "value": 230.00, "confidence": "high" },
  "tax": { "value": 41.40, "confidence": "high" },
  "total": { "value": 271.40, "confidence": "high" },
  "arithmetic_reconciled": true
}

Validate Merchant Tax Identifier with Regex

Before storing the vendor record, verify that the 15-character Indian GSTIN adheres to statutory alphanumeric format using Apex Forge Regex (@Regex-Gen-Tester):

Match Indian GSTIN format (2 digits state code, 10 char PAN, 1 entity digit, Z default, 1 checksum).
Sample: 27AAAPL1234C1ZV
Sample: INVALID_GSTIN_123

Verified pattern produced:

/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/

Query Extracted Expenses in SQL

Paste your expense table schema into Apex Forge SQL (@English-To-SQL) and ask a business question:

CREATE TABLE expenses (
  id INT, 
  vendor TEXT, 
  category TEXT, 
  amount DECIMAL, 
  expense_date TEXT
);

INSERT INTO expenses VALUES 
  (1, 'Metro Logistics Supplies', 'Packaging', 271.40, '2026-07-15'),
  (2, 'Cloud Hosting Inc', 'Infrastructure', 85.00, '2026-07-18'),
  (3, 'Metro Logistics Supplies', 'Packaging', 140.00, '2026-07-29');

Find total spending by category for July 2026, ordered by highest spend first.

Verified SQL executed against in-memory SQLite WASM sandbox:

SELECT category, SUM(amount) AS total_spend
FROM expenses
WHERE expense_date LIKE '2026-07%'
GROUP BY category
ORDER BY total_spend DESC;
category total_spend
Packaging $411.40
Infrastructure $85.00

Workflow Considerations & Data Integrity

Connecting separate tools requires human review of extracted monetary figures. Ensure that currency symbols and decimal separators are recognized accurately before inserting into relational databases. This workflow is completely stateless; no document images or table rows are persisted on the host servers.