The account number to retrieve transactions for.
Bermuda Commercial Bank RESTful Open Banking API Implementation (v1)
The Bermuda Commercial Bank (BCB) RESTful Open Banking API provides secure, programmatic access to BCB's banking services, enabling developers to integrate financial services into their applications.
- Account details retrieval
- Internal transfers
- Payments (Swift)
- Virtual Accounts
- Transaction information access
- Robust security and compliance
- Comprehensive documentation
Request
Retrieves transaction details for the specified account and date range. This endpoint:
- Validates the provided date parameters. The accepted date formats are
yyyy-MM-ddoryyyyMMdd. - Maximum date range is one year.
- Supports both JSON and CSV response formats based on the Accept header.
- Supports cursor-based pagination for efficient handling of large transaction datasets.
Important: Transaction IDs are globally unique across the entire banking system. For internal transfers, the same transaction ID appears on both accounts (debit and credit entries) with only the transaction type differing. When fees apply, multiple entries may share the same transaction ID.
📖 For detailed information about transaction ID behavior, see: https://developers.bcb.bm/guides/transaction-id-uniqueness-guide
This endpoint uses cursor-based pagination with server-side result-set management:
- First Request: Optionally specify
pageSize(default: 100, max: 1000). The server creates a cursor and returns apageToken. - Subsequent Requests: Use the
pageTokenfrom previous responses withpageStartto navigate pages. - Page Token: Contains encoded pagination context including pageSize, so don't specify
pageSizein subsequent requests. - Total Pages: Calculate using
Math.ceil(total_size / page_size)from the response metadata.
Clients must use the HTTP Accept header to indicate the desired response format:
- Set
Accept: application/jsonfor JSON responses (default) - Set
Accept: text/csvfor CSV responses If the Accept header is omitted,application/jsonis assumed.
All API requests use the versioned base URL:
https://api.bcb.bm/v1/accounts/{accountNumber}/transactions
async function getAllTransactionsPaginated(accountNumber, fromDate, toDate) {
try {
let allTransactions = [];
let pageStart = 1;
let pageToken = null;
let totalPages = 0;
do {
// Build URL with pagination parameters
let url = `https://api.bcb.bm/v1/accounts/${accountNumber}/transactions`;
const params = new URLSearchParams();
// Always include date range
params.append('fromDate', fromDate);
params.append('toDate', toDate);
if (pageStart === 1) {
// First request: specify pageSize
params.append('pageSize', '100');
} else {
// Subsequent requests: use pageToken and pageStart
params.append('pageToken', pageToken);
params.append('pageStart', pageStart.toString());
}
url += '?' + params.toString();
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`Error: ${errorData.message || 'Unknown error'}`);
}
const data = await response.json();
console.log(`Page ${pageStart} data:`, data);
// Store pagination info from first request
if (pageStart === 1 && data.meta && data.meta.pagination) {
pageToken = data.meta.pagination.page_token;
totalPages = Math.ceil(data.meta.pagination.total_size / data.meta.pagination.page_size);
console.log(`Total pages: ${totalPages}, Page token: ${pageToken}`);
}
// Collect transactions from this page
if (data.data && data.data.length > 0) {
allTransactions.push(...data.data);
console.log(`Collected ${data.data.length} transactions from page ${pageStart}`);
}
pageStart++;
} while (pageStart <= totalPages);
console.log(`Total transactions collected: ${allTransactions.length}`);
// Process all collected transactions
allTransactions.forEach((transaction, index) => {
console.log(`Transaction ${index + 1}:`, transaction.id);
console.log('Account Number:', transaction.thisAccount.number);
console.log('Other Account Number:', transaction.otherAccount.number);
console.log('Type:', transaction.details.type);
console.log('Description:', transaction.details.description);
console.log('Posted Date:', transaction.details.posted);
console.log('Amount:', transaction.details.value.amount);
console.log('Currency:', transaction.details.value.currency);
console.log('Narrative:', transaction.metadata.narrative);
if (transaction.transactionAttributes && transaction.transactionAttributes.length > 0) {
transaction.transactionAttributes.forEach(attribute => {
console.log(`${attribute.name}: ${attribute.value}`);
});
}
});
return allTransactions;
} catch (error) {
console.error('There was a problem with the fetch operation:', error.message);
throw error;
}
}
// Alternative: Get single page of transactions
async function getTransactionsPage(accountNumber, fromDate, toDate, pageStart = 1, pageToken = null) {
try {
let url = `https://api.bcb.bm/v1/accounts/${accountNumber}/transactions`;
const params = new URLSearchParams();
// Always include date range
params.append('fromDate', fromDate);
params.append('toDate', toDate);
if (pageStart === 1 && !pageToken) {
params.append('pageSize', '250'); // Custom page size
} else {
params.append('pageToken', pageToken);
params.append('pageStart', pageStart.toString());
}
url += '?' + params.toString();
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`Error: ${errorData.message || 'Unknown error'}`);
}
const data = await response.json();
console.log('Transactions page:', data);
return data;
} catch (error) {
console.error('There was a problem with the fetch operation:', error.message);
throw error;
}
}
// Example usage:
getAllTransactionsPaginated('1234567890', '2023-01-25', '2023-02-25'); // Retrieves all transactions across multiple pages
// OR
getTransactionsPage('1234567890', '2023-01-25', '2023-02-25', 1).then(firstPage => {
console.log('First page:', firstPage);
// Use firstPage.meta.pagination.page_token for subsequent requests
});Required Permission: get-transactions
This endpoint requires the permission claim get-transactions to be present in the JWT token. These permissions are embedded in the token during the authentication process and cannot be modified afterward. The token must be obtained with the appropriate permissions to access this endpoint.
- Mock serverhttps://developers.bcb.bm/_mock/apis/open-banking-api/open-banking-api/v1/accounts/{accountNumber}/transactions
- UAT Environment - Used for testing and integration purposeshttps://api-uat.bcb.bm/v1/accounts/{accountNumber}/transactions
- Production Environment - Live environment for production usehttps://api.bcb.bm/v1/accounts/{accountNumber}/transactions
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://developers.bcb.bm/_mock/apis/open-banking-api/open-banking-api/v1/accounts/{accountNumber}/transactions?fromDate=string&toDate=string&pageToken=string&pageStart=0&pageSize=0' \
-H 'Authorization: Bearer <YOUR_jwt_HERE>'{ "meta": { "pagination": { … } }, "data": [ { … }, { … }, { … } ] }