Quickstart · 5 min

Your first African bank-code query in Node.js

From zero to a live bank-code lookup in five minutes, using the official mansaapi SDK.

1

Get a free API key

Issue a key instantly — 100 requests/day, no credit card. It appears on screen and is emailed to you.

2

Install the SDK

terminal
npm install mansaapi
3

Initialize the client

index.ts
import { MansaAPI } from "mansaapi";

const mansa = new MansaAPI({
  apiKey: process.env.MANSA_API_KEY!, // mansa_live_sk_...
});
4

Look up a bank by code

index.ts
// GTBank's NIBSS code is 058
const { data: bank } = await mansa.identity.getBank("058");

console.log(bank.name);       // "Guaranty Trust Bank (GTBank)"
console.log(bank.swift_code); // "GTBINGLA"
console.log(bank.ussd);       // "*737#"
5

List all banks for a country

index.ts
const { data: banks } = await mansa.identity.getBanks({ country: "NG" });

console.log(`${banks.length} Nigerian institutions`);
banks.forEach(b => console.log(`${b.code} — ${b.name}`));

That's it. You're reading live African bank data. Handle errors with MansaAPIError:

error handling
import { MansaAPIError } from "mansaapi";

try {
  await mansa.identity.getBank("000");
} catch (err) {
  if (err instanceof MansaAPIError) {
    console.log(err.code, err.status); // "NOT_FOUND", 404
  }
}