Skip to main content

CSV export (UW table)

The fastest way to get a structured spreadsheet of the bank statement data.
# Months as rows (one row per statement period per account)
curl "https://api.lendpathway.com/api/books/{book_id}/csv-export" \
  -H "Authorization: Bearer pat_xxx" \
  -o uw.csv

# Pivoted (metrics as rows, months as columns)
curl "https://api.lendpathway.com/api/books/{book_id}/csv-export?table_format=month_as_col" \
  -H "Authorization: Bearer pat_xxx" \
  -o uw_pivoted.csv
month_as_row (default):
Period,Document,Account,Starting Balance,Deposits,...,True Revenue,DTI %
Jul 2025,July_2025.pdf,MAIN ACCOUNT,8149.06,101019.45,...,51587.45,10.2%
Jul 2025,July_2025.pdf,EXPENSE ACCOUNT,414.90,14216.36,...,0.0,
...
NET,,1 Account,8149.06,427709.57,...,174227.90,15.9%
Average,,1 Account,2037.27,106927.39,...,43556.98,15.9%
month_as_col (pivoted):
Metric,Jul 2025,Aug 2025,Sep 2025,Oct 2025
Starting Balance,13320.22,51667.09,50352.87,28034.39
Deposits,115936.01,116600.20,88212.78,106960.58
True Revenue,51587.45,0.0,46764.70,75875.75
DTI %,10.5%,,16.7%,19.2%
The pivoted format uses the combined account (account_id=0) per statement, which is the aggregate of all accounts in that month. Good for pivot tables in Excel or Google Sheets. Exclusions are applied before the CSV is generated. Excluded documents and accounts are omitted. In Python:
r = requests.get(
    f"{API_BASE}/books/{book_id}/csv-export",
    headers=headers,
    params={"table_format": "month_as_col"}
)
with open("uw.csv", "wb") as f:
    f.write(r.content)

Excel export

Returns an .xlsx file using your org’s spreadsheet template.
# Bank statements
curl "https://api.lendpathway.com/api/books/{book_id}/spreadsheet-export?sheet_type=mca" \
  -H "Authorization: Bearer pat_xxx" \
  -o statements.xlsx

# Credit report
curl "https://api.lendpathway.com/api/books/{book_id}/spreadsheet-export?sheet_type=vlad" \
  -H "Authorization: Bearer pat_xxx" \
  -o credit.xlsx

# Tax forms
curl "https://api.lendpathway.com/api/books/{book_id}/spreadsheet-export?sheet_type=tax" \
  -H "Authorization: Bearer pat_xxx" \
  -o tax.xlsx

JSON analytics

Use /analytics for the full structured data. See working with analytics for field details.
analytics = requests.get(f"{API_BASE}/books/{book_id}/analytics", headers=headers).json()
Credit report data:
book = requests.get(f"{API_BASE}/books/{book_id}", headers=headers).json()
cr = book["book_meta"]["parser_v2_credit_report"]
Tax data:
tax = requests.get(f"{API_BASE}/books/{book_id}/tax-analytics", headers=headers).json()

Build a complete deal package

import requests, json

def export_deal(book_id, output_dir="."):
    headers = {"Authorization": f"Bearer {TOKEN}"}

    # CSV
    r = requests.get(f"{API_BASE}/books/{book_id}/csv-export", headers=headers)
    with open(f"{output_dir}/{book_id}_uw.csv", "wb") as f:
        f.write(r.content)

    # Excel
    r = requests.get(
        f"{API_BASE}/books/{book_id}/spreadsheet-export",
        headers=headers,
        params={"sheet_type": "mca"}
    )
    with open(f"{output_dir}/{book_id}_statements.xlsx", "wb") as f:
        f.write(r.content)

    # Analytics JSON
    analytics = requests.get(f"{API_BASE}/books/{book_id}/analytics", headers=headers).json()
    with open(f"{output_dir}/{book_id}_analytics.json", "w") as f:
        json.dump(analytics, f, indent=2)

    print(f"Exported: {book_id}")
    print(f"  Revenue: ${analytics['true_revenue']:,.2f}")
    print(f"  Positions: {len(analytics['positions'])}")