Client libraries

Official SDKs

Skip the raw HTTP and let the SDKs handle authentication, retries, and typed responses. Same API surface across every language.

JavaScript / Node.js
l4b-labs v1.3.0
GitHub
Install
npm install @l4b/labs
Quick start
import { L4B } from "@l4b/labs";

const l4b = new L4B(process.env.L4B_API_KEY);

const { data } = await l4b.emi.calculate({
  principal: 1000000,
  annual_rate_pct: 10.5,
  tenure_months: 60,
});
console.log(data.emi); // 21493.9
Python
l4b-labs v1.3.0
GitHub
Install
pip install l4b-labs
Quick start
from l4b_labs import L4B

l4b = L4B(api_key="l4b_live_...")

resp = l4b.emi.calculate(
    principal=1_000_000,
    annual_rate_pct=10.5,
    tenure_months=60,
)
print(resp.data.emi)  # 21493.9
PHP
l4b-labs v1.2.0
GitHub
Install
composer require loan4bank/labs
Quick start
<?php
require_once 'vendor/autoload.php';
use L4B\Labs\Client;

$l4b = new Client(getenv('L4B_API_KEY'));

$resp = $l4b->emi->calculate([
    'principal'        => 1000000,
    'annual_rate_pct'  => 10.5,
    'tenure_months'    => 60,
]);
echo $resp->data->emi; // 21493.9
Java
l4b-labs v1.2.0
GitHub
Install
implementation 'com.loan4bank:labs:1.2.0'
Quick start
import com.loan4bank.labs.L4B;
import com.loan4bank.labs.model.EmiRequest;

L4B l4b = new L4B(System.getenv("L4B_API_KEY"));

var resp = l4b.emi().calculate(
    EmiRequest.builder()
        .principal(1_000_000)
        .annualRatePct(10.5)
        .tenureMonths(60)
        .build()
);
System.out.println(resp.getData().getEmi()); // 21493.9

Common SDK conventions

  • Read the API key from L4B_API_KEY in your environment.
  • Every SDK auto-retries on 429 and 5xx with exponential backoff (max 3 attempts).
  • Errors surface as typed exceptions carrying the L4B code — try/catch on L4B.PlanGateError, L4B.RateLimitError, etc.
  • Sandbox vs live is chosen purely by the key prefix — l4b_sandbox_… or l4b_live_….

No SDK for your language?

Every endpoint is a plain HTTP call with an X-API-Key header — you can integrate from anywhere with a fetch/curl-equivalent. Open a GitHub Discussion if you'd like us to prioritise a Ruby, Go, or Rust client.

Why use an official LOAN4BANK SDK?

The LOAN4BANK SDKs are thin, batteries-included clients that turn every REST endpoint into a native function call in your language of choice. They wrap authentication, retries, HMAC signing, response typing, error class hierarchy and pagination so your integration code can focus on the business logic instead of transport plumbing. Every SDK ships from the same monorepo and is released on the same day as the API — you can pin exact versions with lock files, and Renovate/Dependabot updates just work.

The JavaScript / TypeScript SDK is the most mature and doubles as a Node.js server-side client and a browser client (the browser bundle is tree-shaken and only imports the endpoints you actually use — median footprint is under 12 KB gzipped). The Python SDK targets 3.10+ and uses `httpx` for asyncio-first performance; both sync and async APIs are exposed. The PHP SDK works on 8.1+ and integrates cleanly with Laravel service providers. The Java SDK targets JDK 17+ and ships as a shaded jar so you don't fight transitive-dependency conflicts. The Go SDK follows the `context.Context` convention throughout and lets you inject a custom `http.RoundTripper` for observability tooling.

Every SDK exposes the exact same error class hierarchy — `AuthError`, `PlanGateError`, `RateLimitError`, `ValidationError`, `NotFoundError`, `ConflictError`, `WebhookSignatureError` and a generic `ServerError` — so you can share error-handling patterns across microservices even when they're written in different languages. The retry policy defaults to 3 attempts with jittered exponential backoff on 429 and 5xx, and it can be tuned per client instance if your workload needs a different profile.

Frequently asked questions

Which LOAN4BANK SDK should I use for a Next.js or React app?
Use the JavaScript / TypeScript SDK. It works in both the Node.js runtime (for API routes and server components) and the browser (for edge functions and public widgets). The browser bundle is tree-shaken so you only pay for the endpoints you actually call.
Do the LOAN4BANK SDKs support async/await?
Yes. Every SDK exposes async APIs natively — Promise-based in JavaScript, asyncio in Python, ReactiveX in Java, and Goroutine-friendly in Go. Sync APIs are also provided in Python and Java for scripts and legacy code paths.
How do I keep LOAN4BANK SDKs up to date with API changes?
Pin the SDK in your dependency manifest (package.json, requirements.txt, composer.json, pom.xml, go.mod) and let Renovate or Dependabot open PRs on new releases. Every SDK follows semantic versioning aligned with the API — MAJOR bumps signal a breaking change, MINOR bumps are additive.
Can I use the LOAN4BANK API without an SDK?
Absolutely. Every endpoint is a plain HTTPS call with an X-API-Key header — the reference has curl samples on every page. The SDKs simply save you from re-implementing retries, signing, typing and error classification in every language you ship.
Are LOAN4BANK SDKs open source?
Yes. Every SDK repo is public on GitHub under the loan4bank organisation, licensed MIT. Bug reports, PRs and language-idiom feedback are welcome — new-language contributions are triaged monthly.

Prefer to build against the raw HTTP surface? The API Reference has copy-paste curl and fetch snippets for every endpoint, and the Quick Start walks you through your first request in five minutes.