@ippopone/loanpilot
v0.2.3
Published
Official TypeScript/JavaScript SDK for the LoanPilot API — bank-statement analysis and credit decisioning.
Maintainers
Readme
@ippopone/loanpilot
Official TypeScript/JavaScript SDK for the LoanPilot API — bank-statement analysis and configurable credit decisioning.
npm install @ippopone/loanpilotQuick start
import { LoanPilot } from '@ippopone/loanpilot'
import fs from 'node:fs'
const lp = new LoanPilot({ apiKey: process.env.LOANPILOT_API_KEY! })
// upload a statement and wait for the decision
const created = await lp.analyses.create({
file: fs.readFileSync('statement.pdf'),
fileName: 'statement.pdf',
productId: 'optional-loan-product-id',
inputs: { requested_amount: 500000, collateral_value: 700000 }, // for LTV, etc.
})
const analysis = await lp.analyses.waitFor(created.id)
console.log(analysis.decision, analysis.score)
console.log(analysis.result) // full report: scorecard, obligations, bureau, scenarios…Auth
Server-to-server: create a key in the app under Settings → API keys and pass it as apiKey.
Mobile / per-user: sign the user in and reuse the returned token (never ship a static key in an app):
const { token, client } = await LoanPilot.login({ email, password })
// store `token` securely; next launch: new LoanPilot({ apiKey: token })
await client.logout() // revoke on sign-outRequests are authenticated with Authorization: Bearer <token> and scoped to your team.
API
const lp = new LoanPilot({
apiKey,
baseUrl: 'https://api.ippo.one/v1', // default
timeoutMs: 60000,
maxRetries: 2, // retries 429/5xx with backoff
fetch: customFetch, // optional
})
await lp.me()
await lp.analyses.list({ limit, offset, status, decision })
await lp.analyses.create({ file, fileName, password?, productId?, applicant?, inputs? })
await lp.analyses.get(id, { includeResult: true })
await lp.analyses.waitFor(id, { pollMs, timeoutMs, onPoll })
await lp.products.list()Errors throw LoanPilotError with status, code and detail.
Runtimes
Works in Node 18+ and modern browsers (uses global fetch/FormData/Blob). In the browser, never ship a
lp_live_ key to untrusted clients — call the API from your server.
