Documentation Index
Fetch the complete documentation index at: https://docs.wepayout.co/llms.txt
Use this file to discover all available pages before exploring further.
List Institutions
Return the list of banks available in Brazil.
Query Parameters
To clear whether this bank is authorized ISPB
Define the ordering of the query. Allowed values: bank_id, code, name, document_name, logo, created_at, updated_at. Default: id
The current page that will be displayed on returned list.
The number of banks that will be displayed per page on paginated lists.
Define the sort order: ascending or descending
Response
Informs whether the ISPB of that institution is authorized or not
[
{
"id": 1270,
"code": "237",
"ispb": "00000000",
"name": "BANCO DO BRASIL S.A. - INSTITUIÇÃO DE PAGAMEN",
"logo": null,
"created_at": "2024-06-25 00:00:00.00",
"updated_at": "2024-06-25 00:00:00.00",
"deleted_at": null,
"ispb_authorized": false
}
]
Use Cases
Display Bank List in UI
async function loadBankOptions() {
const response = await fetch('https://api.wepayments.com/v1/banks/institutions', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { data } = await response.json();
const select = document.getElementById('bank-select');
data.forEach(bank => {
const option = document.createElement('option');
option.value = bank.code;
option.textContent = bank.name;
select.appendChild(option);
});
}
Validate Bank Code
async function validateBankCode(code) {
const response = await fetch('https://api.wepayments.com/v1/banks/institutions', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { data } = await response.json();
return data.some(bank => bank.code === code);
}
Search Banks
async function searchBanks(query) {
const response = await fetch('https://api.wepayments.com/v1/banks/institutions', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { data } = await response.json();
const lowerQuery = query.toLowerCase();
return data.filter(bank =>
bank.name.toLowerCase().includes(lowerQuery) ||
bank.short_name.toLowerCase().includes(lowerQuery)
);
}
Best Practices
The list of institutions doesn’t change frequently. Cache the response to reduce API calls:const CACHE_KEY = 'banks_list';
const CACHE_DURATION = 7 * 24 * 60 * 60 * 1000; // 7 days
async function getBanks() {
const cached = localStorage.getItem(CACHE_KEY);
const timestamp = localStorage.getItem(`${CACHE_KEY}_time`);
if (cached && timestamp) {
const age = Date.now() - parseInt(timestamp);
if (age < CACHE_DURATION) {
return JSON.parse(cached);
}
}
const response = await fetch('https://api.wepayments.com/v1/banks/institutions', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const data = await response.json();
localStorage.setItem(CACHE_KEY, JSON.stringify(data));
localStorage.setItem(`${CACHE_KEY}_time`, Date.now().toString());
return data;
}
Always handle potential errors when fetching the bank list:try {
const banks = await fetchBanks();
displayBanks(banks);
} catch (error) {
console.error('Failed to load banks:', error);
showErrorMessage('Unable to load bank list. Please try again later.');
}
If you only need specific types of institutions, filter the results:const banks = await fetchBanks();
const traditionalBanks = banks.data.filter(bank => bank.type === 'bank');
Rate Limiting
This endpoint is subject to rate limiting. Please cache the response and avoid making excessive requests.