PesaLens

Statement analysis API

For SACCOs, digital lenders, chamas and landlords who review M-PESA statements. Send a statement PDF, get categorised transactions, monthly income, regular income sources, balances, Fuliza use and betting share back as JSON, usually in under 3 seconds.

Request

curl -H "Authorization: Bearer $PESALENS_KEY" \
  -F statement=@statement.pdf -F password=123456 \
  "https://pesalens.guyblack.me/api/v1/statements?transactions=true"

Response (shortened)

{
  "customer_name": "JANE WANJIKU DOE",
  "report": { "start": "2026-07-01", "end": "2026-09-30", "total_in": 2823400, "total_out": 3249200,
              "fees": 47700, "fuliza_borrowed": 1200000, "betting_staked": 95000, "categories": [...] },
  "income": { "average_monthly_income": 2510000, "regular_sources": [{"name": "ACME LTD", "months": 3, "total": 7500000}],
              "average_daily_balance": 412300, "lowest_balance": 1200, "fuliza_times": 9 },
  "transactions": [{ "receipt": "TIQ3ABC123", "time": "2026-09-02T09:12:00", "details": "...",
                     "category": "SentToPeople", "paid_in": 0, "withdrawn": 50000, "balance": 497700 }]
}

Amounts are in cents (KES × 100). Errors return {"error": "…", "code": "wrong_password"} (also not_a_pdf, no_transactions, unreadable) with status 422.

Privacy

Statements sent to the API are processed in memory and never stored. You are responsible for having the account holder’s consent.

Pricing

KES 30 per statement, billed monthly; volume pricing from 1,000 statements a month. Contact us for a key.