# List User Accounts Retrieves a list of all accounts associated with the authenticated user's profile. This endpoint: - Uses the customer account number from the authenticated user's session to fetch all associated accounts. - Requires valid authentication. - Supports both JSON and CSV response formats based on the Accept header. - Returns a summary version of account information (AccountSummary) containing only essential fields - Supports cursor-based pagination for efficient handling of large account lists. ### Pagination 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 a pageToken. - Subsequent Requests: Use the pageToken from previous responses with pageStart to navigate pages. - Page Token: Contains encoded pagination context including pageSize, so don't specify pageSize in subsequent requests. - Total Pages: Calculate using Math.ceil(total_size / page_size) from the response metadata. ### Content Negotiation Clients must use the HTTP Accept header to indicate the desired response format: - Set Accept: application/json for JSON responses (default). - Set Accept: text/csv for CSV responses. If the Accept header is omitted, application/json is assumed. ### Base URL All API requests use the versioned base URL: https://api.bcb.bm/v1/accounts ### Sample Request in JavaScript javascript async function getAllAccountsPaginated() { try { let allAccounts = []; let pageStart = 1; let pageToken = null; let totalPages = 0; do { // Build URL with pagination parameters let url = 'https://api.bcb.bm/v1/accounts'; const params = new URLSearchParams(); if (pageStart === 1) { // First request: optionally specify pageSize params.append('pageSize', '100'); } else { // Subsequent requests: use pageToken and pageStart params.append('pageToken', pageToken); params.append('pageStart', pageStart.toString()); } if (params.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 accounts from this page if (data.data && data.data.length > 0) { allAccounts.push(...data.data); console.log(Collected ${data.data.length} accounts from page ${pageStart}); } pageStart++; } while (pageStart { console.log(Account ${index + 1}: ${account.number}); console.log(Balance: ${account.balance.amount} ${account.balance.currency}); }); return allAccounts; } catch (error) { console.error('There was a problem with the fetch operation:', error.message); throw error; } } // Function to get a specific page of accounts async function getAccountsPage(pageStart, pageToken = null) { try { // Build URL let url = 'https://api.bcb.bm/v1/accounts'; const params = new URLSearchParams(); if (pageStart === 1) { // First request: optionally specify pageSize params.append('pageSize', '100'); } else { // Subsequent requests: use pageToken and pageStart params.append('pageToken', pageToken); params.append('pageStart', pageStart.toString()); } if (params.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('Accounts page:', data); return data; } catch (error) { console.error('There was a problem with the fetch operation:', error.message); throw error; } } // Example usage: getAllAccountsPaginated(); // Retrieves all accounts across multiple pages // OR getAccountsPage(1).then(firstPage => { console.log('First page:', firstPage); // Use firstPage.meta.pagination.page_token for subsequent requests }); Required Permission: get-all-accounts This endpoint requires the permission claim get-all-accounts 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. Endpoint: GET /v1/accounts Version: v1 Security: Authorization, Feature Permissions ## Query parameters: - `pageToken` (string,null) Optional. Unique cursor ID received from previous response for subsequent requests. Contains encoded pagination context including page_size. - `pageStart` (integer,null) Optional. The record from which the response should be displayed (default: 1). - `pageSize` (integer,null) Optional. The total number of records per page (default: 100, max: 1000). ## Response 200 fields (application/json): - `meta` (object,null) Response metadata - `meta.pagination` (object,null) Pagination information - `meta.pagination.page_start` (integer, required) The record from which the response should be displayed - `meta.pagination.page_token` (string,null) Unique id expected to get as part of response from Transact on every enquiry request. - `meta.pagination.total_size` (integer, required) Total number of records - `meta.pagination.page_size` (integer, required) The total number of records per page - `data` (array,null) Response data - `data.accountId` (string, required) A unique ID of the account, composed of account number and CIF - `data.cif` (string, required) 11-digit ID of the account holder - `data.currency` (string, required) Identification of the currency in which the account is held - `data.accountSubType` (string, required) Specifies the sub type of account (product) - `data.accountNumber` (string, required) Account number - `data.status` (string, required) Specifies the status of the account - `data.availableBalance` (object, required) Account balance - `data.availableBalance.currency` (string, required) Currency ISO code - `data.availableBalance.amount` (string, required) Amount - `data.accountType` (string,null) Specifies the type of account (personal/business) - `data.nickname` (string,null) The nickname of the account, assigned by the account owner - `data.owners` (array, required) Ownership details of an account object - `data.owners.displayName` (string, required) Account owner name - `data.owners.accountHolderType` (string, required) Type of account holder (Primary/Joint) - `data.accountAttributes` (array, required) Additional details or characteristics associated with an account object - `data.accountAttributes.name` (string, required) Key or identifier of the account attribute. - `data.accountAttributes.value` (string, required) Actual data associated with the attribute name - `data.openingDate` (string,null) Date when the account was opened - `data.balanceEffectiveDate` (string,null) Date when the balance was last updated - `data.accountRoutings` (array) Routing details for the account - `data.accountRoutings.scheme` (string, required) Scheme value - `data.accountRoutings.address` (string, required) Address value ## Response 400 fields (application/json): - `error` (string, required) Error code or type that identifies the specific error condition - `message` (string, required) Human-readable error message that describes the error condition ## Response 401 fields (application/json): - `error` (string, required) Error code or type that identifies the specific error condition - `message` (string, required) Human-readable error message that describes the error condition ## Response 403 fields (application/json): - `error` (string, required) Error code or type that identifies the specific error condition - `message` (string, required) Human-readable error message that describes the error condition ## Response 404 fields (application/json): - `error` (string, required) Error code or type that identifies the specific error condition - `message` (string, required) Human-readable error message that describes the error condition ## Response 429 fields (application/json): - `error` (string, required) Error code or type that identifies the specific error condition - `message` (string, required) Human-readable error message that describes the error condition ## Response 500 fields (application/json): - `error` (string, required) Error code or type that identifies the specific error condition - `message` (string, required) Human-readable error message that describes the error condition