x-generator: NSwag v14.4.0.0 (NJsonSchema v11.3.2.0 (Newtonsoft.Json v13.0.0.0))
openapi: 3.0.0
info:
  title: Bermuda Commercial Bank RESTful Open Banking API Implementation
  description: >+
    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.


    ### Key Features

    - Account details retrieval

    - Internal transfers

    - Payments (Swift)

    - Transaction information access

    - Robust security and compliance

    - Comprehensive documentation

    ### Available Environments

    **UAT Environment**


    **URL:** https://api-uat.bcb.bm


    **Purpose:** Testing and integration


    **Production Environment**


    **URL:** https://api.bcb.bm


    **Purpose:** Live production use

  contact:
    name: >-
      Bermuda Commercial Bank Limited, 34 Bermudiana Road, Hamilton HM 11,
      Bermuda
    url: https://www.bcb.bm
    email: enquiries@bcb.bm
  version: v1
servers:
  - url: https://api-uat.bcb.bm
    description: UAT Environment - Used for testing and integration purposes
  - url: https://api.bcb.bm
    description: Production Environment - Live environment for production use
paths:
  /v1/accounts/{accountNumber}:
    get:
      tags:
        - Accounts
      summary: Account Details
      description: >-
        Retrieves the account details and balance. This endpoint requires
        authentication and returns comprehensive information for the specified
        account. The returned data includes:


        - **Number**: The human-readable account number assigned by the bank.

        - **Label**: A label provided by the account owner.

        - **Owners**: The list of users who own this account.

        - **Type**: The type of account.

        - **Balance**: The account's balance including currency and amount.

        - **Account Attributes**: Additional account information specific to
        Bermuda Commercial Bank.
                    
        ### 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 getAccountDetails(accountNumber) {
          try {
            const response = await fetch(`https://api.bcb.bm/v1/accounts/${accountNumber}`, {
              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('Account details:', data);

            // Example processing of the returned object
            const accountId = data.id;
            const accountNumber = data.number;
            const accountBalance = data.balance.amount;
            const accountCurrency = data.balance.currency;
            const accountStatus = data.accountAttributes.find(attr => attr.name === 'STATUS')?.value;
                    
            console.log('Account ID:', accountId);
            console.log('Account Number:', accountNumber);
            console.log('Account Balance:', accountBalance);
            console.log('Account Currency:', accountCurrency);
            console.log('Account Status:', accountStatus);
                    
            // Process all account attributes
            console.log('Account Attributes:');
            data.accountAttributes.forEach(attribute => {
              console.log(`${attribute.name}: ${attribute.value}`);
            });

            // Additional processing based on account status
            if (accountStatus === 'ACTIVE') {
              console.log('The account is active.');
            } else {
              console.log('The account is not active.');
            }
          } catch (error) {
            console.error('There was a problem with the fetch operation:', error.message);
          }
        }


        // Example usage:

        getAccountDetails('YOUR_ACCOUNT_NUMBER');

        ```


        **Required Permission:** `get-account`


        This endpoint requires the permission claim `get-account` 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.
      operationId: Accounts_Get
      parameters:
        - name: accountNumber
          in: path
          required: true
          description: The human-readable account number assigned by the bank.
          schema:
            type: string
          x-position: 1
      responses:
        '200':
          description: OK - The request was successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
              examples:
                Json:
                  value:
                    accountId: 1000078766-3000032
                    cif: 3000032
                    accountNumber: 1000078766
                    status: Active
                    currency: USD
                    availableBalance:
                      currency: USD
                      amount: 1000
                    accountSubType: BCB.CURRENT.ACCOUNT.C
                    accountType: Personal
                    nickname: CURRENT.ACCOUNTS
                    openingDate: '2023-01-01T00:00:00.0000000Z'
                    balanceEffectiveDate: '2023-12-31T00:00:00.0000000Z'
                    accountRoutings:
                      - scheme: AccountNumber
                        address: 1000078766
                    owners:
                      - displayName: John Doe
                        accountHolderType: Primary
                      - displayName: Jane Doe
                        accountHolderType: Joint
                    accountAttributes:
                      - name: BANK_ID
                        value: BPBKBMHM
                      - name: JOINT_CIF
                        value: 3000033
                      - name: CREDIT_INTEREST_RATE
                        value: 2.5
                      - name: DEBIT_INTEREST_RATE
                        value: 0
                      - name: DEBIT_ACCRUED_INTEREST
                        value: 0
                      - name: CREDIT_ACCRUED_INTEREST
                        value: 0
                      - name: ACCRUAL_INTEREST
                        value: 0
                Csv:
                  value:
                    - "\uFEFF\"account_id\",\"cif\",\"account_number\",\"status\",\"currency\",\"available_balance_currency\",\"available_balance_amount\",\"account_sub_type\",\"account_type\",\"nickname\",\"opening_date\",\"balance_effective_date\",\"account_routings_0_scheme\",\"account_routings_0_address\",\"owners_0_display_name\",\"owners_0_account_holder_type\",\"owners_1_display_name\",\"owners_1_account_holder_type\",\"account_attributes_0_name\",\"account_attributes_0_value\",\"account_attributes_1_name\",\"account_attributes_1_value\",\"account_attributes_2_name\",\"account_attributes_2_value\",\"account_attributes_3_name\",\"account_attributes_3_value\",\"account_attributes_4_name\",\"account_attributes_4_value\",\"account_attributes_5_name\",\"account_attributes_5_value\",\"account_attributes_6_name\",\"account_attributes_6_value\""
                    - >-
                      "1000078766-3000032","3000032","1000078766","Active","USD","USD","1000.00","BCB.CURRENT.ACCOUNT.C","Personal","CURRENT.ACCOUNTS","2023-01-01T00:00:00Z","2023-12-31T00:00:00Z","AccountNumber","1000078766","John
                      Doe","Primary","Jane
                      Doe","Joint","BANK_ID","BPBKBMHM","JOINT_CIF","3000033","CREDIT_INTEREST_RATE","2.5","DEBIT_INTEREST_RATE","0","DEBIT_ACCRUED_INTEREST","0","CREDIT_ACCRUED_INTEREST","0","ACCRUAL_INTEREST","0"
        '400':
          description: >-
            Bad Request - The request was invalid or cannot be served. Check the
            passed parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Authentication is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Forbidden – The client is authenticated but does not have permission
            to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too Many Requests - You have exceeded the allowed number of requests
            in a given timeframe. Please wait for the rate limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error - An unknown error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Authorization: []
        - Feature Permissions:
            - get-account
  /v1/accounts:
    get:
      tags:
        - Accounts
      summary: List User Accounts
      description: >-
        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


        ### 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 getAllAccounts() {
          try {
            const response = await fetch('https://api.bcb.bm/v1/accounts', {
              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:', data);

            // Example processing of the returned accounts
            data.data.forEach(account => {
              console.log(`Account Number: ${account.number}`);
              console.log(`Balance: ${account.balance.amount} ${account.balance.currency}`);
            });
          } catch (error) {
            console.error('There was a problem with the fetch operation:', error.message);
          }
        }


        // Example usage:

        getAllAccounts();

        ```


        **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.
      operationId: Accounts_GetAll
      responses:
        '200':
          description: OK - The request was successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseOfAccountOf'
              examples:
                Json:
                  value:
                    meta:
                      pagination:
                        page_start: 2
                        page_token: 202407250072428721.02,99
                        total_size: 955
                        page_size: 99
                    data:
                      - accountId: 12345678901
                        cif: 3000032
                        accountNumber: 1000078766
                        status: ACTIVE
                        currency: USD
                        availableBalance:
                          currency: USD
                          amount: 1000
                        accountSubType: CURRENT.ACCOUNTS
                        owners:
                          - displayName: John Doe
                            accountHolderType: Primary
                          - displayName: Jane Doe
                            accountHolderType: Joint
                        accountAttributes:
                          - name: OPEN_DATE
                            value: '2023-01-01'
                          - name: STATUS
                            value: ACTIVE
                          - name: ACCOUNT_TYPE
                            value: CURRENT.ACCOUNTS
                      - accountId: 98765432109
                        cif: 3000033
                        accountNumber: 2000087654
                        status: INACTIVE
                        currency: EUR
                        availableBalance:
                          currency: EUR
                          amount: 500
                        accountSubType: SAVINGS.ACCOUNTS
                        owners:
                          - displayName: Alice Smith
                            accountHolderType: Primary
                        accountAttributes:
                          - name: OPEN_DATE
                            value: '2022-06-15'
                          - name: STATUS
                            value: INACTIVE
                          - name: ACCOUNT_TYPE
                            value: SAVINGS.ACCOUNTS
                Csv:
                  value:
                    - "\uFEFF\"meta_pagination_page_start\",\"meta_pagination_page_token\",\"meta_pagination_total_size\",\"meta_pagination_page_size\",\"data_0_account_id\",\"data_0_cif\",\"data_0_account_number\",\"data_0_status\",\"data_0_currency\",\"data_0_available_balance_currency\",\"data_0_available_balance_amount\",\"data_0_account_sub_type\",\"data_0_owners_0_display_name\",\"data_0_owners_0_account_holder_type\",\"data_0_owners_1_display_name\",\"data_0_owners_1_account_holder_type\",\"data_0_account_attributes_0_name\",\"data_0_account_attributes_0_value\",\"data_0_account_attributes_1_name\",\"data_0_account_attributes_1_value\",\"data_0_account_attributes_2_name\",\"data_0_account_attributes_2_value\",\"data_1_account_id\",\"data_1_cif\",\"data_1_account_number\",\"data_1_status\",\"data_1_currency\",\"data_1_available_balance_currency\",\"data_1_available_balance_amount\",\"data_1_account_sub_type\",\"data_1_owners_0_display_name\",\"data_1_owners_0_account_holder_type\",\"data_1_account_attributes_0_name\",\"data_1_account_attributes_0_value\",\"data_1_account_attributes_1_name\",\"data_1_account_attributes_1_value\",\"data_1_account_attributes_2_name\",\"data_1_account_attributes_2_value\""
                    - >-
                      "2","202407250072428721.02,99","955","99","12345678901","3000032","1000078766","ACTIVE","USD","USD","1000.00","CURRENT.ACCOUNTS","John
                      Doe","Primary","Jane
                      Doe","Joint","OPEN_DATE","2023-01-01","STATUS","ACTIVE","ACCOUNT_TYPE","CURRENT.ACCOUNTS","98765432109","3000033","2000087654","INACTIVE","EUR","EUR","500.00","SAVINGS.ACCOUNTS","Alice
                      Smith","Primary","OPEN_DATE","2022-06-15","STATUS","INACTIVE","ACCOUNT_TYPE","SAVINGS.ACCOUNTS"
        '400':
          description: >-
            Bad Request - The request was invalid or cannot be served. Check the
            passed parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Authentication is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Forbidden – The client is authenticated but does not have permission
            to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too Many Requests - You have exceeded the allowed number of requests
            in a given timeframe. Please wait for the rate limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error - An unknown error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Authorization: []
        - Feature Permissions:
            - get-all-accounts
  /v1/internal-transfers:
    post:
      tags:
        - InternalTransfers
      summary: Internal Transfer
      description: >-
        Initiates an internal funds transfer between two accounts within the
        institution. 

        The request must include source and destination account details, along
        with the amount and currency to be transferred. 

        Optionally, clients may provide a transaction reference and remittance
        information describing the purpose of the payment.


        - debitAccountNumber: The account number from which funds will be
        debited.

        - debitAmountCurrency: The currency code for the debit amount. Must
        match the credit account currency.

        - creditAccountNumber: The account number to be credited.

        - creditAmountCurrency: The currency code for the credit amount. Must
        match the debit account currency.

        - debitAmount: The amount to be transferred.

        - endToEndIdentification: (Optional) A unique reference provided by the
        client to identify the transaction end-to-end.

        - remittanceInformation: (Optional) Free-text remittance information
        describing the purpose of the transaction.
                    
        ### Important Notes:

        - Transfers between accounts with different currencies are not allowed.
        The debit and credit account currencies must match.

        - Ensure all inputs are validated and the source account has sufficient
        funds before making the request.
                    
        ### Idempotency

        The API supports idempotency through the optional `Idempotency-Key`
        header:

        - If no idempotency key is provided, the request is processed normally
        (duplicates are possible).

        - If a valid UUID idempotency key is provided for a new transaction, the
        system stores the key and associates it with the transaction results.

        - If the same idempotency key is received again for the same
        endpoint/action, the system returns the previously stored response.

        - Idempotency keys are user-specific - different users don't share
        cached responses.

        - The idempotency key must be a valid UUID format (e.g.,
        "123e4567-e89b-12d3-a456-426614174000").
                    
        ### 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/internal-transfers
                    
        ### Sample Request in JavaScript:
                    
        ```javascript

        async function executeInternalTransfer() {
          try {
            const response = await fetch('https://api.bcb.bm/v1/internal-transfers', {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
                'Content-Type': 'application/json',
                'Accept': 'application/json',
                'Idempotency-Key': '123e4567-e89b-12d3-a456-426614174000' // Optional: UUID format required if provided
              },
              body: JSON.stringify({
                debitAccountNumber: "12345678901234567890123456",
                debitAmountCurrency: "USD",
                creditAccountNumber: "98765432109876543210987654",
                creditAmountCurrency: "USD", // Must match debitAmountCurrency
                debitAmount: "100.00",
                endToEndIdentification: "REF-INV-20250417-001", // Optional external transaction reference
                remittanceInformationUnstructured: "Payment for invoice #12345" // Optional payment description
              })
            });
                    
            if (!response.ok) {
              const errorData = await response.json();
              throw new Error(`Transfer failed: ${JSON.stringify(errorData)}`);
            }
                    
            const data = await response.json();
            console.log('Transfer result:', data);
                    
            // Example processing of the returned object
            const { id, status, uniqueIdentifier, internalTransferDetails, linkedActivities } = data;
            const { amountCredited, creditAmountCurrency, debitAmount, amountDebited, chargeAmount, valueDate, chargeAnalysisReceiver, chargeAnalysisSender, debitAccountNumber, creditAccountNumber, chargeAccountNumber } = internalTransferDetails;

            // Log the main transfer details.
            console.log('Transaction ID:', id);
            console.log('Status:', status);
            console.log('Unique Identifier:', uniqueIdentifier);
            console.log('Amount Credited:', amountCredited.amount, amountCredited.currency);
            console.log('Credit Amount Currency:', creditAmountCurrency);
            console.log('Debit Amount:', debitAmount.amount, debitAmount.currency);
            console.log('Amount Debited:', amountDebited.amount, amountDebited.currency);
            console.log('Charge Amount:', chargeAmount.amount, chargeAmount.currency);
            console.log('Value Date:', valueDate);
            console.log('Charge Analysis Receiver:', chargeAnalysisReceiver);
            console.log('Charge Analysis Sender:', chargeAnalysisSender);
                    
            // Process debit account information.
            console.log('Debit Account Number:', debitAccountNumber.number);
            if (debitAccountNumber.accountRoutings) {
              debitAccountNumber.accountRoutings.forEach(routing => {
                console.log('Debit Account Routing Scheme:', routing.scheme);
                console.log('Debit Account Routing Address:', routing.address);
              });
            }
                    
            // Process credit account information.
            console.log('Credit Account Number:', creditAccountNumber.number);
            if (creditAccountNumber.accountRoutings) {
              creditAccountNumber.accountRoutings.forEach(routing => {
                console.log('Credit Account Routing Scheme:', routing.scheme);
                console.log('Credit Account Routing Address:', routing.address);
              });
            }
                    
            // Process charge account information.
            console.log('Charge Account Number:', chargeAccountNumber.number);
            if (chargeAccountNumber.accountRoutings) {
              chargeAccountNumber.accountRoutings.forEach(routing => {
                console.log('Charge Account Routing Scheme:', routing.scheme);
                console.log('Charge Account Routing Address:', routing.address);
              });
            }
                    
            // Process linked activities.
            linkedActivities.forEach(activity => {
              console.log('Linked Activity ID:', activity.id);
              console.log('Linked Activity Transaction Status:', activity.transactionStatus);
              console.log('Linked Activity Status:', activity.status);
              console.log('Linked Activity Unique Identifier:', activity.uniqueIdentifier);
              const { arrangementId, activityId, productId, currencyId, effectiveDate } = activity.activityDetails;
              console.log('Linked Activity Arrangement ID:', arrangementId);
              console.log('Linked Activity Activity ID:', activityId);
              console.log('Linked Activity Product ID:', productId);
              console.log('Linked Activity Currency ID:', currencyId);
              console.log('Linked Activity Effective Date:', effectiveDate);
            });
                    
            // Final status logging.
            if (status === 'SUCCESS') {
              console.log('The transfer was successful.');
            } else {
              console.log('The transfer failed:', status);
            }
          } catch (error) {
            console.error('Error executing internal transfer:', error);
          }
        }
                    
        executeInternalTransfer();

        ```


        **Required Permission:** `internal-transfer`


        This endpoint requires the permission claim `internal-transfer` 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.
      operationId: InternalTransfers_Post
      requestBody:
        x-name: transfer
        description: The internal transfer request details.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InternalTransferRequest'
            example:
              debitAccountNumber: 9.876543210987655e+25
              debitAmountCurrency: USD
              creditAccountNumber: 1.2345678901234568e+25
              creditAmountCurrency: USD
              debitAmount: 100
              endToEndIdentification: REF-INV-20250417-001
              remittanceInformation: 'Payment for invoice #12345'
        x-position: 1
      responses:
        '201':
          description: The transfer was created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalTransfer'
              examples:
                Json:
                  value:
                    id: internal-transfer-123
                    status: COMPLETED
                    uniqueIdentifier: unique-identifier-123
                    internalTransferDetails:
                      amountCredited:
                        currency: USD
                        amount: 100
                      creditAmountCurrency: USD
                      debitAmount:
                        currency: USD
                        amount: 100
                      amountDebited:
                        currency: USD
                        amount: 100
                      chargeAmount:
                        currency: USD
                        amount: 5
                      valueDate: '2023-05-31'
                      chargeAnalysisReceiver: Receiver Charge Analysis
                      chargeAnalysisSender: Sender Charge Analysis
                      debitAccountNumber:
                        number: 123456789
                        accountRoutings:
                          - scheme: IBAN
                            address: IBAN123456789
                      creditAccountNumber:
                        number: 987654321
                        accountRoutings:
                          - scheme: IBAN
                            address: IBAN987654321
                      chargeAccountNumber:
                        number: charge123
                        accountRoutings:
                          - scheme: IBAN
                            address: IBANcharge123
                    linkedActivities:
                      - id: activity123
                        transactionStatus: SUCCESS
                        status: COMPLETED
                        uniqueIdentifier: unique-activity-123
                        activityDetails:
                          arrangementId: arrangement123
                          activityId: activity123
                          productId: product123
                          currencyId: USD
                          effectiveDate: '2023-05-31'
                Csv:
                  value:
                    - "\uFEFF\"id\",\"status\",\"unique_identifier\",\"internal_transfer_details_amount_credited_currency\",\"internal_transfer_details_amount_credited_amount\",\"internal_transfer_details_credit_amount_currency\",\"internal_transfer_details_debit_amount_currency\",\"internal_transfer_details_debit_amount_amount\",\"internal_transfer_details_amount_debited_currency\",\"internal_transfer_details_amount_debited_amount\",\"internal_transfer_details_charge_amount_currency\",\"internal_transfer_details_charge_amount_amount\",\"internal_transfer_details_value_date\",\"internal_transfer_details_charge_analysis_receiver\",\"internal_transfer_details_charge_analysis_sender\",\"internal_transfer_details_debit_account_number_number\",\"internal_transfer_details_debit_account_number_account_routings_0_scheme\",\"internal_transfer_details_debit_account_number_account_routings_0_address\",\"internal_transfer_details_credit_account_number_number\",\"internal_transfer_details_credit_account_number_account_routings_0_scheme\",\"internal_transfer_details_credit_account_number_account_routings_0_address\",\"internal_transfer_details_charge_account_number_number\",\"internal_transfer_details_charge_account_number_account_routings_0_scheme\",\"internal_transfer_details_charge_account_number_account_routings_0_address\",\"linked_activities_0_id\",\"linked_activities_0_transaction_status\",\"linked_activities_0_status\",\"linked_activities_0_unique_identifier\",\"linked_activities_0_activity_details_arrangement_id\",\"linked_activities_0_activity_details_activity_id\",\"linked_activities_0_activity_details_product_id\",\"linked_activities_0_activity_details_currency_id\",\"linked_activities_0_activity_details_effective_date\""
                    - >-
                      "internal-transfer-123","COMPLETED","unique-identifier-123","USD","100.00","USD","USD","100.00","USD","100.00","USD","5.00","2023-05-31","Receiver
                      Charge Analysis","Sender Charge
                      Analysis","123456789","IBAN","IBAN123456789","987654321","IBAN","IBAN987654321","charge123","IBAN","IBANcharge123","activity123","SUCCESS","COMPLETED","unique-activity-123","arrangement123","activity123","product123","USD","2023-05-31"
        '400':
          description: >-
            The request is invalid; verify account numbers, amounts, and ensure
            currencies match.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Forbidden – The client is authenticated but does not have permission
            to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests - Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: An error occurred processing the transfer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Authorization: []
        - Feature Permissions:
            - internal-transfer
  /v1/payments/swift:
    post:
      tags:
        - Payments
      summary: SWIFT Payment
      description: >-
        Initiates a SWIFT payment transfer. The request must include all
        required payment details including:

        - Source and destination account information

        - Payment amount and currency

        - Beneficiary details

        - Payment purpose and reference information
                    
        ### Key Features:

        - Supports international wire transfers via SWIFT network

        - Implements idempotency to prevent duplicate transactions

        - Validates payment requests before processing

        - Supports both JSON and CSV response formats


        ### 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/payments/swift
        ### Idempotency

        The API supports idempotency through the optional `Idempotency-Key`
        header:

        - If no idempotency key is provided, the request is processed normally
        (duplicates are possible)

        - If a valid UUID idempotency key is provided for a new transaction, the
        system stores the key and associates it with the transaction results

        - If the same idempotency key is received again for the same
        endpoint/action, the system returns the previously stored response

        - Idempotency keys are user-specific - different users don't share
        cached responses

        - The idempotency key must be a valid UUID format (e.g.,
        "123e4567-e89b-12d3-a456-426614174000")


        ### Sample Request in JavaScript:


        ```javascript

        async function processSwiftPayment() {
          try {
            const response = await fetch('https://api.bcb.bm/v1/payments/swift', {
              method: 'POST',
              headers: {
                'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
                'Content-Type': 'application/json',
                'Accept': 'application/json',
                'Idempotency-Key': '123e4567-e89b-12d3-a456-426614174000' // Optional: UUID format required if provided
              },
              body: JSON.stringify({
                instructionIdentification: "PAYMENT-123456",
                debtorAccount: {
                  identification: "DEBTOR-ACC-123"
                },
                instructedAmount: {
                  currency: "USD",
                  amount: "1000.00"
                },
                creditorAccount: {
                  identification: "CREDITOR-ACC-456",
                  name: "John Doe",
                  additionalInformation: ["Additional details"]
                },
                creditorAgent: {
                  identification: "BANKBIC123",
                  name: "Beneficiary Bank",
                  additionalInformation: ["SWIFT/BIC code"]
                },
                chargesType: "OUR",
                remittanceInformation: ["Payment for services"]
              })
            });

            if (!response.ok) {
              const errorData = await response.json();
              throw new Error(`Error processing payment: ${errorData.message || 'Unknown error'}`);
            }

            const result = await response.json();
            
            // Check payment status
            if (result.status === 'success') {
              console.log('Payment processed successfully');
              
              // Log payment details
              console.log('Payment ID:', result.id);
              console.log('Transaction Status:', result.transactionStatus);
              console.log('Unique Identifier:', result.uniqueIdentifier);
              
              // Process payment details
              const details = result.details;
              console.log('External Reference:', details.extReference);
              console.log('Instructed Amount:', details.instructedAmount.amount, details.instructedAmount.currency);
              
              // Process account information
              console.log('Debtor Account:', details.debtorAccount.identification);
              console.log('Creditor Account:', details.creditorAccount.identification);
              console.log('Beneficiary Account:', details.beneficiaryAccount.identification);
              
              // Process settlement details
              const settlement = details.settlementDetails;
              console.log('Amount Credited:', settlement.amountCredited.amount, settlement.amountCredited.currency);
              console.log('Amount Debited:', settlement.amountDebited.amount, settlement.amountDebited.currency);
              console.log('Value Date:', settlement.valueDate);
              console.log('Record Status:', settlement.recordStatus);
              
              // Process charge details
              const charges = details.chargeDetails;
              console.log('Charges Type:', charges.chargesType);
              console.log('Total Charges:', charges.chargeAmount.amount, charges.chargeAmount.currency);
              
              // Process charge analysis
              const chargeAnalysis = charges.chargeAnalysis;
              console.log('Sender Charges:', chargeAnalysis.sender.amount, chargeAnalysis.sender.currency);
              console.log('Receiver Charges:', chargeAnalysis.receiver.amount, chargeAnalysis.receiver.currency);
              
              // Process beneficiary information
              console.log('Beneficiary Name:', details.beneficiary.name);
              console.log('Beneficiary Bank:', details.beneficiaryAgent.name);
              
              // Process remittance information
              if (details.remittanceInformation) {
                console.log('Remittance Information:');
                details.remittanceInformation.forEach(info => console.log('-', info));
              }
              
              // Process linked activities
              if (result.linkedActivities && result.linkedActivities.length > 0) {
                console.log('Linked Activities:');
                result.linkedActivities.forEach(activity => {
                  console.log('- Activity ID:', activity.id);
                  console.log('  Status:', activity.status);
                  console.log('  Transaction Status:', activity.transactionStatus);
                  console.log('  Unique Identifier:', activity.uniqueIdentifier);
                });
              }
            } else {
              console.error('Payment processing failed:', result.status);
              // Handle failed payment
              if (result.details) {
                console.error('Error details:', result.details);
              }
            }
          } catch (error) {
            console.error('Error:', error);
            // Handle error appropriately
          }
        }


        // Example usage:

        processSwiftPayment();

        ```


        ### Response Structure

        The response follows the Open Banking standard and includes:


        | Field | Type | Description |

        |-------|------|-------------|

        | id | string | Unique identifier for the payment |

        | status | string | Payment status (`success` or `failed`) |

        | transactionStatus | string | Detailed transaction status |

        | uniqueIdentifier | string | Unique identifier for tracking |

        | details | object | Payment details object |

        | linkedActivities | array | Related financial activities |


        **Required Permission:** `payment-swift`


        This endpoint requires the permission claim `payment-swift` 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.
      operationId: Payments_Post
      requestBody:
        x-name: request
        description: The SWIFT payment request containing all necessary payment details.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentRequest'
            examples:
              Json:
                value:
                  instructionIdentification: PAY-2024-03-21-001
                  debtorAccount:
                    identification: BM12BCBK00001234567890
                  instructedAmount:
                    currency: USD
                    amount: 50000
                  creditorAccount:
                    identification: US12BCBK00001234567890
                    name: Global Investment Services Inc
                    additionalInformation:
                      - 350 Fifth Avenue
                      - New York, NY 10118
                      - United States
                  creditorAgent:
                    identification: CHASUS33
                    name: JPMorgan Chase Bank
                    additionalInformation:
                      - 'SWIFT/BIC: CHASUS33'
                      - 383 Madison Avenue
                      - New York, NY 10179
                      - United States
                  intermediaryAgent:
                    identification: BCBKBMHM
                    name: Bermuda Commercial Bank
                    additionalInformation:
                      - 'SWIFT/BIC: BCBKBMHM'
                      - Victoria Place
                      - 31 Victoria Street
                      - Hamilton HM 10, Bermuda
                  chargesType: OUR
                  remittanceInformation:
                    - Payment for investment management services Q1 2024
                    - 'Invoice #INV-2024-001'
                    - 'Service Period: Jan-Mar 2024'
              Csv:
                value:
                  - "\uFEFF\"instruction_identification\",\"debtor_account_identification\",\"instructed_amount_currency\",\"instructed_amount_amount\",\"creditor_account_identification\",\"creditor_account_name\",\"creditor_account_additional_information_0\",\"creditor_account_additional_information_1\",\"creditor_account_additional_information_2\",\"creditor_agent_identification\",\"creditor_agent_name\",\"creditor_agent_additional_information_0\",\"creditor_agent_additional_information_1\",\"creditor_agent_additional_information_2\",\"creditor_agent_additional_information_3\",\"intermediary_agent_identification\",\"intermediary_agent_name\",\"intermediary_agent_additional_information_0\",\"intermediary_agent_additional_information_1\",\"intermediary_agent_additional_information_2\",\"intermediary_agent_additional_information_3\",\"charges_type\",\"remittance_information_0\",\"remittance_information_1\",\"remittance_information_2\""
                  - >-
                    "PAY-2024-03-21-001","BM12BCBK00001234567890","USD","50000.00","US12BCBK00001234567890","Global
                    Investment Services Inc","350 Fifth Avenue","New York, NY
                    10118","United States","CHASUS33","JPMorgan Chase
                    Bank","SWIFT/BIC: CHASUS33","383 Madison Avenue","New York,
                    NY 10179","United States","BCBKBMHM","Bermuda Commercial
                    Bank","SWIFT/BIC: BCBKBMHM","Victoria Place","31 Victoria
                    Street","Hamilton HM 10, Bermuda","OUR","Payment for
                    investment management services Q1 2024","Invoice
                    #INV-2024-001","Service Period: Jan-Mar 2024"
        x-position: 1
      responses:
        '201':
          description: Created - The payment was successfully processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentResponse'
              examples:
                Json:
                  value:
                    id: PAY987654321
                    status: success
                    transactionStatus: COMPLETED
                    uniqueIdentifier: unique-identifier-987
                    details:
                      extReference: EXT98765
                      instructedAmount:
                        currency: USD
                        amount: 50000
                      debtorAccount:
                        schemeName: IBAN
                        identification: BM12BCBK00001234567890
                        Name: null
                      beneficiaryAccount:
                        schemeName: IBAN
                        identification: US12BCBK00001234567890
                        Name: null
                      creditorAccount:
                        schemeName: IBAN
                        identification: US12BCBK00001234567890
                        Name: null
                      settlementDetails:
                        amountCredited:
                          currency: USD
                          amount: 50000
                        amountDebited:
                          currency: USD
                          amount: 50100
                        valueDate: '2024-03-21'
                        recordStatus: COMPLETED
                      chargeDetails:
                        chargesType: OUR
                        chargeAmount:
                          currency: USD
                          amount: 100
                        chargeAccount:
                          schemeName: IBAN
                          identification: BM12BCBK00001234567890
                          Name: null
                        chargeAnalysis: null
                      remittanceInformation:
                        - unstructured: Payment for investment management services Q1 2024
                        - unstructured: 'Invoice #INV-2024-001'
                        - unstructured: 'Service Period: Jan-Mar 2024'
                      beneficiary:
                        identification: US12BCBK00001234567890
                        name: Global Investment Services Inc
                        additionalInformation:
                          - 350 Fifth Avenue
                          - New York, NY 10118
                          - United States
                      beneficiaryAgent:
                        identification: CHASUS33
                        name: JPMorgan Chase Bank
                        additionalInformation:
                          - 'SWIFT/BIC: CHASUS33'
                          - 383 Madison Avenue
                          - New York, NY 10179
                          - United States
                      intermediaryAgent:
                        identification: BCBKBMHM
                        name: Bermuda Commercial Bank
                        additionalInformation:
                          - 'SWIFT/BIC: BCBKBMHM'
                          - Victoria Place
                          - 31 Victoria Street
                          - Hamilton HM 10, Bermuda
                    linkedActivities:
                      - id: ACT987654
                        transactionStatus: COMPLETED
                        status: SUCCESS
                        uniqueIdentifier: act-987
                        activityDetails:
                          arrangementId: arr-987
                          activityId: act-987
                          productId: prod-987
                          currencyId: USD
                          effectiveDate: '2024-03-21'
                Csv:
                  value:
                    - "\uFEFF\"id\",\"status\",\"transaction_status\",\"unique_identifier\",\"details_ext_reference\",\"details_instructed_amount_currency\",\"details_instructed_amount_amount\",\"details_debtor_account_scheme_name\",\"details_debtor_account_identification\",\"details_beneficiary_account_scheme_name\",\"details_beneficiary_account_identification\",\"details_creditor_account_scheme_name\",\"details_creditor_account_identification\",\"details_settlement_details_amount_credited_currency\",\"details_settlement_details_amount_credited_amount\",\"details_settlement_details_amount_debited_currency\",\"details_settlement_details_amount_debited_amount\",\"details_settlement_details_value_date\",\"details_settlement_details_record_status\",\"details_charge_details_charges_type\",\"details_charge_details_charge_amount_currency\",\"details_charge_details_charge_amount_amount\",\"details_charge_details_charge_account_scheme_name\",\"details_charge_details_charge_account_identification\",\"details_remittance_information_0_unstructured\",\"details_remittance_information_1_unstructured\",\"details_remittance_information_2_unstructured\",\"details_beneficiary_identification\",\"details_beneficiary_name\",\"details_beneficiary_additional_information_0\",\"details_beneficiary_additional_information_1\",\"details_beneficiary_additional_information_2\",\"details_beneficiary_agent_identification\",\"details_beneficiary_agent_name\",\"details_beneficiary_agent_additional_information_0\",\"details_beneficiary_agent_additional_information_1\",\"details_beneficiary_agent_additional_information_2\",\"details_beneficiary_agent_additional_information_3\",\"details_intermediary_agent_identification\",\"details_intermediary_agent_name\",\"details_intermediary_agent_additional_information_0\",\"details_intermediary_agent_additional_information_1\",\"details_intermediary_agent_additional_information_2\",\"details_intermediary_agent_additional_information_3\",\"linked_activities_0_id\",\"linked_activities_0_transaction_status\",\"linked_activities_0_status\",\"linked_activities_0_unique_identifier\",\"linked_activities_0_activity_details_arrangement_id\",\"linked_activities_0_activity_details_activity_id\",\"linked_activities_0_activity_details_product_id\",\"linked_activities_0_activity_details_currency_id\",\"linked_activities_0_activity_details_effective_date\""
                    - >-
                      "PAY987654321","success","COMPLETED","unique-identifier-987","EXT98765","USD","50000.00","IBAN","BM12BCBK00001234567890","IBAN","US12BCBK00001234567890","IBAN","US12BCBK00001234567890","USD","50000.00","USD","50100.00","2024-03-21","COMPLETED","OUR","USD","100.00","IBAN","BM12BCBK00001234567890","Payment
                      for investment management services Q1 2024","Invoice
                      #INV-2024-001","Service Period: Jan-Mar
                      2024","US12BCBK00001234567890","Global Investment Services
                      Inc","350 Fifth Avenue","New York, NY 10118","United
                      States","CHASUS33","JPMorgan Chase Bank","SWIFT/BIC:
                      CHASUS33","383 Madison Avenue","New York, NY
                      10179","United States","BCBKBMHM","Bermuda Commercial
                      Bank","SWIFT/BIC: BCBKBMHM","Victoria Place","31 Victoria
                      Street","Hamilton HM 10,
                      Bermuda","ACT987654","COMPLETED","SUCCESS","act-987","arr-987","act-987","prod-987","USD","2024-03-21"
        '400':
          description: >-
            Bad Request - The request was invalid or cannot be served. Check the
            passed parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Authentication is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Forbidden - The client is authenticated but does not have permission
            to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too Many Requests - You have exceeded the allowed number of requests
            in a given timeframe.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error - An unknown error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Authorization: []
        - Feature Permissions:
            - payment-swift
  /auth/token:
    post:
      tags:
        - Token
      summary: Generate Token
      description: >-
        Generates a JWT access token based on provided client credentials. Use
        this POST endpoint to authenticate using your `clientId` and
        `clientSecret` and receive a JWT token.


        **Token Validity:** 40 minutes from the time of issuance.


        **Endpoint:** `https://api.bcb.bm/auth/token`


        **Required Headers:**

        - `Content-Type: application/json`

        - `Accept: application/json`


        ### Sample Request in JavaScript:


        ```javascript

        async function getToken() {
          try {
            const response = await fetch('https://api.bcb.bm/auth/token', {
              method: 'POST',
              headers: {
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              },
              body: JSON.stringify({
                clientId: 'your-client-id',
                clientSecret: 'your-client-secret'
              })
            });
            
            if (!response.ok) {
              const errorData = await response.json();
              throw new Error(`Error: ${errorData.message || response.statusText}`);
            }
            
            const data = await response.json();
            console.log('JWT Token:', data.token);
            // Store token securely
            localStorage.setItem('jwt', data.token);
          } catch (error) {
            console.error('Fetch error:', error);
          }
        }


        getToken();

        ```


        ### Legacy Sample Request in JavaScript (Then/Catch):


        ```javascript

        fetch('https://api.bcb.bm/auth/token', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json'
          },
          body: JSON.stringify({
            clientId: 'your-client-id',
            clientSecret: 'your-client-secret'
          })
        })
          .then(response => {
            if (!response.ok) {
              return response.json().then(errorData => {
                const error = new Error('Network response was not ok');
                error.data = errorData;
                throw error;
              });
            }
            return response.json();
          })
          .then(data => {
            console.log('JWT Token:', data.token);
            // Store token securely for use in subsequent requests.
            localStorage.setItem('jwt', data.token);
          })
          .catch(error => {
            console.error('Error during token generation:', error);
          });
        ```
      operationId: Token_GenerateToken
      requestBody:
        x-name: credentials
        description: >-
          An object containing the client credentials: clientId and
          clientSecret.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiCredentials'
            example:
              clientId: your-client-id-here
              clientSecret: your-client-secret-here
        required: true
        x-position: 1
      responses:
        '200':
          description: Token generated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiToken'
        '400':
          description: >-
            Invalid request. Ensure the client credentials are provided
            correctly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized. The client credentials are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests. You have exceeded the allowed number of requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error occurred during token generation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /v1/accounts/{accountNumber}/transactions:
    get:
      tags:
        - Transactions
      summary: Account Transactions
      description: >-
        Retrieves transaction details for the specified account and date range
        with pagination support. Provides bulk access to an account's
        transactions. The response includes a "meta" object containing
        pagination details and a "data" array with transaction records.


        ### Key Points:

        - Validates the provided date parameters. The accepted date formats are
        `yyyy-MM-dd` or `yyyyMMdd`.

        - Maximum date range is one year.

        - Up to 1,000 records per request.

        - Developers can specify the desired page size (maximum is 1,000
        records). It is recommended to keep this parameter unchanged during
        pagination iterations for consistent results.

        - Response includes a "meta.pagination" object with:
          - **page_start**: the starting page number
          - **page_token**: token for retrieving the next page
          - **total_size**: total available records
          - **page_size**: number of records per page

        ### 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/{accountNumber}/transactions

        ### Sample Request in JavaScript:
                    
        ```javascript

        async function fetchTransactions() {
          try {
            const response = await fetch('https://api.bcb.bm/v1/accounts/1234567890/transactions?fromDate=2023-01-25&toDate=2023-02-25', {
              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 fetching transactions: ${JSON.stringify(errorData)}`);
            }
            
            const { meta, data } = await response.json();
            
            // Log pagination details
            if (meta && meta.pagination) {
              console.log('Page Start:', meta.pagination.page_start);
              console.log('Page Token:', meta.pagination.page_token);
              console.log('Total Size:', meta.pagination.total_size);
              console.log('Page Size:', meta.pagination.page_size);

              // Optionally, store the page token for fetching subsequent pages
              localStorage.setItem('paginationToken', meta.pagination.page_token);
            }
            
            // Process each transaction record
            data.forEach(transaction => {
              console.log('Transaction ID:', 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}`);
                });
              }
            });
            
          } catch (error) {
            console.error('Error:', error);
          }
        }


        fetchTransactions();

        ```

        ### Pagination Example:


        After obtaining the page token from the initial request and storing it
        (e.g., in localStorage), you can retrieve subsequent pages.

        For example, to fetch results starting from page 2 using the stored
        token:
                    
        ```javascript

        async function fetchTransactionsPage() {
          try {
            // Retrieve the stored page token from localStorage
            const storedPageToken = localStorage.getItem('paginationToken');
            
            // Make the API call with the stored page token and other query parameters
            const response = await fetch(`https://api.bcb.bm/v1/accounts/1234567890/transactions?fromDate=2023-01-25&toDate=2023-02-25&pageToken=${storedPageToken}&pageStart=2`, {
              method: 'GET',
              headers: {
                'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              }
            });
            
            // Check if the response is OK; if not, throw an error with details
            if (!response.ok) {
              const errorData = await response.json();
              throw new Error(`Error fetching transactions: ${JSON.stringify(errorData)}`);
            }
            
            // Parse the JSON response
            const { meta, data } = await response.json();
            
            // Log pagination metadata and store the new page token
            console.log('Pagination Meta:', meta.pagination);
            localStorage.setItem('paginationToken', meta.pagination.page_token);
            
            // Process each transaction record
            data.forEach(transaction => console.log('Transaction ID:', transaction.id));
            
          } catch (error) {
            // Log any errors that occur during the fetch operation
            console.error('Error:', error);
          }
        }
                    
        // Execute the function to fetch transactions

        fetchTransactionsPage();

        ```


        **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.
      operationId: Transactions_Get
      parameters:
        - name: accountNumber
          in: path
          required: true
          description: The account number to retrieve transactions for.
          schema:
            type: string
          x-position: 1
        - name: fromDate
          in: query
          required: true
          description: 'The start date for the transaction range (format: yyyy-MM-dd).'
          schema:
            type: string
          x-position: 2
        - name: toDate
          in: query
          required: true
          description: 'The end date for the transaction range (format: yyyy-MM-dd).'
          schema:
            type: string
          x-position: 3
        - name: pageStart
          in: query
          description: 'Optional. The starting index for pagination (default: 1).'
          schema:
            type: integer
            format: int32
            nullable: true
          x-position: 4
        - name: pageSize
          in: query
          description: Optional. The number of records per page. Maximum allowed is 1,000.
          schema:
            type: integer
            format: int32
            nullable: true
          x-position: 5
        - name: pageToken
          in: query
          description: Optional. A token for retrieving the next page of results.
          schema:
            type: string
            nullable: true
          x-position: 6
      responses:
        '200':
          description: OK - The request was successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseOfTransactionOf'
              examples:
                Json:
                  value:
                    meta:
                      pagination:
                        page_start: 2
                        page_token: 202407250072428721.02,99
                        total_size: 955
                        page_size: 99
                    data:
                      - id: 1
                        thisAccount:
                          number: 123456789
                          accountRoutings:
                            - scheme: BIC
                              address: 123456789
                        otherAccount:
                          number: 987654321
                          accountRoutings:
                            - scheme: BIC
                              address: 987654321
                        details:
                          type: Credit
                          description: Payment
                          posted: '2019-01-01'
                          completed: null
                          newBalance: null
                          value:
                            currency: USD
                            amount: 100
                        metadata:
                          narrative: Payment for services
                        transactionAttributes:
                          - name: Service
                            value: Payment
                      - id: 2
                        thisAccount:
                          number: 123456789
                          accountRoutings:
                            - scheme: BIC
                              address: 123456789
                        otherAccount:
                          number: 987654321
                          accountRoutings:
                            - scheme: BIC
                              address: 987654321
                        details:
                          type: Credit
                          description: Payment
                          posted: '2019-01-01'
                          completed: null
                          newBalance: null
                          value:
                            currency: USD
                            amount: 100
                        metadata:
                          narrative: Payment for services
                        transactionAttributes:
                          - name: Service
                            value: Payment
                      - id: 3
                        thisAccount:
                          number: 123456789
                          accountRoutings:
                            - scheme: BIC
                              address: 123456789
                        otherAccount:
                          number: 987654321
                          accountRoutings:
                            - scheme: BIC
                              address: 987654321
                        details:
                          type: Credit
                          description: Payment
                          posted: '2019-01-01'
                          completed: null
                          newBalance: null
                          value:
                            currency: USD
                            amount: 100
                        metadata:
                          narrative: Payment for services
                        transactionAttributes:
                          - name: Service
                            value: Payment
                Csv:
                  value:
                    - "\uFEFF\"meta_pagination_page_start\",\"meta_pagination_page_token\",\"meta_pagination_total_size\",\"meta_pagination_page_size\",\"data_0_id\",\"data_0_this_account_number\",\"data_0_this_account_account_routings_0_scheme\",\"data_0_this_account_account_routings_0_address\",\"data_0_other_account_number\",\"data_0_other_account_account_routings_0_scheme\",\"data_0_other_account_account_routings_0_address\",\"data_0_details_type\",\"data_0_details_description\",\"data_0_details_posted\",\"data_0_details_value_currency\",\"data_0_details_value_amount\",\"data_0_metadata_narrative\",\"data_0_transaction_attributes_0_name\",\"data_0_transaction_attributes_0_value\",\"data_1_id\",\"data_1_this_account_number\",\"data_1_this_account_account_routings_0_scheme\",\"data_1_this_account_account_routings_0_address\",\"data_1_other_account_number\",\"data_1_other_account_account_routings_0_scheme\",\"data_1_other_account_account_routings_0_address\",\"data_1_details_type\",\"data_1_details_description\",\"data_1_details_posted\",\"data_1_details_value_currency\",\"data_1_details_value_amount\",\"data_1_metadata_narrative\",\"data_1_transaction_attributes_0_name\",\"data_1_transaction_attributes_0_value\",\"data_2_id\",\"data_2_this_account_number\",\"data_2_this_account_account_routings_0_scheme\",\"data_2_this_account_account_routings_0_address\",\"data_2_other_account_number\",\"data_2_other_account_account_routings_0_scheme\",\"data_2_other_account_account_routings_0_address\",\"data_2_details_type\",\"data_2_details_description\",\"data_2_details_posted\",\"data_2_details_value_currency\",\"data_2_details_value_amount\",\"data_2_metadata_narrative\",\"data_2_transaction_attributes_0_name\",\"data_2_transaction_attributes_0_value\""
                    - >-
                      "2","202407250072428721.02,99","955","99","1","123456789","BIC","123456789","987654321","BIC","987654321","Credit","Payment","2019-01-01","USD","100.00","Payment
                      for
                      services","Service","Payment","2","123456789","BIC","123456789","987654321","BIC","987654321","Credit","Payment","2019-01-01","USD","100.00","Payment
                      for
                      services","Service","Payment","3","123456789","BIC","123456789","987654321","BIC","987654321","Credit","Payment","2019-01-01","USD","100.00","Payment
                      for services","Service","Payment"
        '400':
          description: >-
            Bad Request - The request was invalid or cannot be served. Check the
            passed parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Authentication is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Forbidden – The client is authenticated but does not have permission
            to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too Many Requests - You have exceeded the allowed number of requests
            in a given timeframe. Please wait for the rate limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error - An unknown error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Authorization: []
        - Feature Permissions:
            - get-transactions
  /v1/accounts/{accountNumber}/payments:
    get:
      tags:
        - Payments
      summary: List payment statuses for an account
      description: >-
        Retrieves status information for all payments associated with a specific
        account. This endpoint provides a comprehensive view of payment status
        details including:


        - **Type**: The type of payment (e.g., "Outward Swift Payment MT103
        API")

        - **Status**: Current status of the payment (e.g., "Pending",
        "Completed", "Failed")

        - **TransactionId**: Unique payment identifier (or Transaction Id)

        - **ExternalReference**: External reference number for the payment

        - **RemittanceInformation**: Free-text information about the purpose of
        the payment

        - **DebitAmount**: The amount debited from the account, including
        currency code

        - **CreditAmount**: The amount credited to the account, including
        currency code

        - **ValueDate**: The date when the payment was/will be processed

        - **ExchangeRate**: The exchange rate applied to the payment


        ### 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/{accountNumber}/payments

        ### Sample Request in JavaScript:

        ```javascript

        async function getAccountPaymentStatuses(accountNumber) {
          try {
            const response = await fetch(`https://api.bcb.bm/v1/accounts/${accountNumber}/payments`, {
              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 { meta, data } = await response.json();
            console.log('Payment statuses:', data);

            // Process pagination metadata if available
            if (meta && meta.pagination) {
              console.log('Page Start:', meta.pagination.page_start);
              console.log('Total Size:', meta.pagination.total_size);
              console.log('Page Size:', meta.pagination.page_size);
              console.log('Page Token:', meta.pagination.page_token);
              
              // Optionally, store the page token for fetching subsequent pages
              localStorage.setItem('paginationToken', meta.pagination.page_token);
            }
            
            // Process each payment status
            data.forEach(payment => {
              console.log('Payment ID:', payment.transactionId);
              console.log('Type:', payment.type);
              console.log('Status:', payment.status);
              console.log('External Reference:', payment.externalReference);
              console.log('Remittance Information:', payment.remittanceInformation);
              console.log('Value Date:', payment.valueDate);
              console.log('Debit Amount:', `${payment.debitAmount.amount} ${payment.debitAmount.currency}`);
              if (payment.creditAmount && payment.creditAmount.amount) {
                console.log('Credit Amount:', `${payment.creditAmount.amount} ${payment.creditAmount.currency}`);
              }
              console.log('-------------------');
            });
          } catch (error) {
            console.error('There was a problem retrieving payment statuses:', error.message);
          }
        }


        // Example usage:

        getAccountPaymentStatuses('123456789');

        ```


        ### Pagination Example:


        After obtaining the page token from the initial request and storing it
        (e.g., in localStorage), you can retrieve subsequent pages.

        For example, to fetch results starting from page 2 using the stored
        token:


        ```javascript

        async function getAccountPaymentStatusesPage() {
          try {
            // Retrieve the stored page token from localStorage
            const storedPageToken = localStorage.getItem('paginationToken');
            
            // Make the API call with the stored page token and pagination parameters
            const response = await fetch(`https://api.bcb.bm/v1/accounts/123456789/payments?pageToken=${storedPageToken}&pageStart=2`, {
              method: 'GET',
              headers: {
                'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              }
            });
            
            // Check if the response is OK; if not, throw an error with details
            if (!response.ok) {
              const errorData = await response.json();
              throw new Error(`Error fetching payment statuses: ${JSON.stringify(errorData)}`);
            }
            
            // Parse the JSON response
            const { meta, data } = await response.json();
            
            // Log pagination metadata and store the new page token
            console.log('Pagination Meta:', meta.pagination);
            localStorage.setItem('paginationToken', meta.pagination.page_token);
            
            // Process each payment status record
            data.forEach(payment => console.log('Payment ID:', payment.paymentId));
            
          } catch (error) {
            // Log any errors that occur during the fetch operation
            console.error('Error:', error);
          }
        }


        // Execute the function to fetch payment statuses with pagination

        getAccountPaymentStatusesPage();

        ```


        **Required Permission:** `get-payment-status`


        This endpoint requires the permission claim `get-payment-status` 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.
      operationId: TransactionStatus_GetAccountTransactionStatuses
      parameters:
        - name: accountNumber
          in: path
          required: true
          description: The account number to retrieve payment statuses for.
          schema:
            type: string
          x-position: 1
        - name: pageStart
          in: query
          description: 'Optional. The starting index for pagination (default: 1).'
          schema:
            type: integer
            format: int32
            nullable: true
          x-position: 2
        - name: pageSize
          in: query
          description: Optional. The number of records per page. Maximum allowed is 1,000.
          schema:
            type: integer
            format: int32
            nullable: true
          x-position: 3
        - name: pageToken
          in: query
          description: Optional. A token for retrieving the next page of results.
          schema:
            type: string
            nullable: true
          x-position: 4
      responses:
        '200':
          description: OK - The request was successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseOfTransactionStatusOf'
              examples:
                Json:
                  value:
                    meta:
                      pagination:
                        page_start: 1
                        page_token: 202405250011428721.01,10
                        total_size: 3
                        page_size: 10
                    data:
                      - type: Outward Swift Payment MT103 API
                        externalReference: REF123456
                        status: Completed
                        remittanceInformation: 'Invoice payment #INV-2023-001'
                        transactionId: TX-001-2023
                        debitAmount:
                          currency: USD
                          amount: 1000
                        valueDate: '2023-05-15'
                        creditAmount:
                          currency: USD
                          amount: null
                        exchangeRate: null
                      - type: Internal Transfer API
                        externalReference: REF789012
                        status: Pending
                        remittanceInformation: Salary transfer
                        transactionId: TX-002-2023
                        debitAmount:
                          currency: EUR
                          amount: 2500
                        valueDate: '2023-05-16'
                        creditAmount:
                          currency: EUR
                          amount: null
                        exchangeRate: null
                      - type: Inward Swift Payment MT103
                        externalReference: REF345678
                        status: Processing
                        remittanceInformation: Investment return
                        transactionId: TX-003-2023
                        debitAmount:
                          currency: GBP
                          amount: 5000
                        valueDate: '2023-05-17'
                        creditAmount:
                          currency: GBP
                          amount: null
                        exchangeRate: null
                Csv:
                  value:
                    - "\uFEFF\"meta_pagination_page_start\",\"meta_pagination_page_token\",\"meta_pagination_total_size\",\"meta_pagination_page_size\",\"data_0_type\",\"data_0_external_reference\",\"data_0_status\",\"data_0_remittance_information\",\"data_0_transaction_id\",\"data_0_debit_amount_currency\",\"data_0_debit_amount_amount\",\"data_0_value_date\",\"data_0_credit_amount_currency\",\"data_1_type\",\"data_1_external_reference\",\"data_1_status\",\"data_1_remittance_information\",\"data_1_transaction_id\",\"data_1_debit_amount_currency\",\"data_1_debit_amount_amount\",\"data_1_value_date\",\"data_1_credit_amount_currency\",\"data_2_type\",\"data_2_external_reference\",\"data_2_status\",\"data_2_remittance_information\",\"data_2_transaction_id\",\"data_2_debit_amount_currency\",\"data_2_debit_amount_amount\",\"data_2_value_date\",\"data_2_credit_amount_currency\""
                    - >-
                      "1","202405250011428721.01,10","3","10","Outward Swift
                      Payment MT103 API","REF123456","Completed","Invoice
                      payment
                      #INV-2023-001","TX-001-2023","USD","1000.00","2023-05-15","USD","Internal
                      Transfer API","REF789012","Pending","Salary
                      transfer","TX-002-2023","EUR","2500.00","2023-05-16","EUR","Inward
                      Swift Payment MT103","REF345678","Processing","Investment
                      return","TX-003-2023","GBP","5000.00","2023-05-17","GBP"
        '400':
          description: >-
            Bad Request - The request was invalid or cannot be served. Check the
            passed parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Authentication is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Forbidden – The client is authenticated but does not have permission
            to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too Many Requests - You have exceeded the allowed number of requests
            in a given timeframe. Please wait for the rate limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error - An unknown error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Authorization: []
        - Feature Permissions:
            - get-payment-status
  /v1/payments/{paymentId}/status:
    get:
      tags:
        - Payments
      summary: Get payment status
      description: >-
        Retrieves detailed status information for a specific payment identified
        by its payment ID (also known as transaction ID). This endpoint provides
        comprehensive status details including:


        - **Type**: The type of payment (e.g., "Outward Swift Payment MT103
        API")

        - **Status**: Current status of the payment (e.g., "Pending",
        "Completed", "Failed")

        - **TransactionId**: Unique payment identifier (or Transaction Id)

        - **ExternalReference**: External reference number for the payment

        - **RemittanceInformation**: Free-text information about the purpose of
        the payment

        - **DebitAmount**: The amount debited from the account, including
        currency code

        - **CreditAmount**: The amount credited to the account, including
        currency code

        - **ValueDate**: The date when the payment was/will be processed

        - **ExchangeRate**: The exchange rate applied to the payment


        ### 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/payments/{paymentId}/status

        ### Sample Request in JavaScript:


        ```javascript

        async function getPaymentStatus(paymentId) {
          try {
            const response = await fetch(`https://api.bcb.bm/v1/payments/${paymentId}/status`, {
              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 paymentStatus = await response.json();
            console.log('Payment Status Details:');
            console.log('Payment ID:', paymentStatus.transactionId);
            console.log('Type:', paymentStatus.type);
            console.log('Status:', paymentStatus.status);
            console.log('External Reference:', paymentStatus.externalReference);
            console.log('Remittance Information:', paymentStatus.remittanceInformation);
            console.log('Value Date:', paymentStatus.valueDate);
            console.log('Debit Amount:', `${paymentStatus.debitAmount.amount} ${paymentStatus.debitAmount.currency}`);
            
            if (paymentStatus.creditAmount && paymentStatus.creditAmount.amount) {
              console.log('Credit Amount:', `${paymentStatus.creditAmount.amount} ${paymentStatus.creditAmount.currency}`);
            }
            
            // Implement business logic based on payment status
            if (paymentStatus.status === 'Completed') {
              console.log('Payment has been successfully completed.');
            } else if (paymentStatus.status === 'Pending') {
              console.log('Payment is still being processed.');
            } else if (paymentStatus.status === 'Failed') {
              console.log('Payment failed. Please check the details or contact support.');
            }
          } catch (error) {
            console.error('There was a problem retrieving the payment status:', error.message);
          }
        }


        // Example usage:

        getPaymentStatus('PAY-001-2023');

        ```


        **Required Permission:** `get-payment-status`


        This endpoint requires the permission claim `get-payment-status` 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.
      operationId: TransactionStatus_GetTransactionStatus
      parameters:
        - name: paymentId
          in: path
          required: true
          description: >-
            The unique identifier of the payment (also known as transactionId)
            to retrieve status for.
          schema:
            type: string
          x-position: 1
      responses:
        '200':
          description: OK - The request was successful.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionStatus'
              examples:
                Json:
                  value:
                    type: Outward Swift Payment MT103 API
                    externalReference: REF123456
                    status: Completed
                    remittanceInformation: 'Invoice payment #INV-2023-001'
                    transactionId: TX-001-2023
                    debitAmount:
                      currency: USD
                      amount: 1000
                    valueDate: '2023-05-15'
                    creditAmount:
                      currency: USD
                      amount: null
                    exchangeRate: null
                Csv:
                  value:
                    - "\uFEFF\"type\",\"external_reference\",\"status\",\"remittance_information\",\"transaction_id\",\"debit_amount_currency\",\"debit_amount_amount\",\"value_date\",\"credit_amount_currency\""
                    - >-
                      "Outward Swift Payment MT103
                      API","REF123456","Completed","Invoice payment
                      #INV-2023-001","TX-001-2023","USD","1000.00","2023-05-15","USD"
        '400':
          description: >-
            Bad Request - The request was invalid or cannot be served. Check the
            passed parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Authentication is required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Forbidden – The client is authenticated but does not have permission
            to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too Many Requests - You have exceeded the allowed number of requests
            in a given timeframe. Please wait for the rate limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error - An unknown error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Authorization: []
        - Feature Permissions:
            - get-payment-status
components:
  schemas:
    Account:
      allOf:
        - $ref: '#/components/schemas/AccountSummary'
        - type: object
          description: >-
            Bank Account following Open Banking API standards with bank-specific
            extensions
          additionalProperties: false
          properties:
            accountType:
              type: string
              description: Specifies the type of account (personal/business)
            nickname:
              type: string
              description: The nickname of the account, assigned by the account owner
            openingDate:
              type: string
              description: Date when the account was opened
            balanceEffectiveDate:
              type: string
              description: Date when the balance was last updated
            accountRoutings:
              type: array
              description: Routing details for the account
              items:
                $ref: '#/components/schemas/BankRouting'
    BankRouting:
      type: object
      additionalProperties: false
      properties:
        scheme:
          type: string
          description: Scheme value
        address:
          type: string
          description: Address value
    AccountSummary:
      type: object
      description: Summary view of a bank account for listing purposes
      additionalProperties: false
      properties:
        accountId:
          type: string
          description: A unique ID of the account, composed of account number and CIF
        cif:
          type: string
          description: 11-digit ID of the account holder
        currency:
          type: string
          description: Identification of the currency in which the account is held
        accountSubType:
          type: string
          description: Specifies the sub type of account (product)
        accountNumber:
          type: string
          description: Account number
        status:
          type: string
          description: Specifies the status of the account
        availableBalance:
          description: Account balance
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        owners:
          type: array
          description: Ownership details of an account object
          items:
            $ref: '#/components/schemas/AccountOwner'
        accountAttributes:
          type: array
          description: >-
            Additional details or characteristics associated with an account
            object
          items:
            $ref: '#/components/schemas/AccountAttribute'
    CurrencyAmount:
      type: object
      additionalProperties: false
      properties:
        currency:
          type: string
          description: Currency ISO code
        amount:
          type: string
          description: Amount
    AccountOwner:
      type: object
      additionalProperties: false
      properties:
        displayName:
          type: string
          description: Account owner name
        accountHolderType:
          type: string
          description: Type of account holder (Primary/Joint)
    AccountAttribute:
      type: object
      description: >-
        Attribute value in form of (name, value)

        This model is used to store additional metadata or characteristics of an
        account in a name-value pair format.
      additionalProperties: false
      properties:
        name:
          type: string
          description: Key or identifier of the account attribute.
        value:
          type: string
          description: Actual data associated with the attribute name
    ErrorResponse:
      type: object
      description: >-
        Represents a standardized error response in the Open Banking API.

        This model is used to provide consistent error information across all
        API endpoints.
      additionalProperties: false
      properties:
        error:
          type: string
          description: Error code or type that identifies the specific error condition
        message:
          type: string
          description: Human-readable error message that describes the error condition
    ApiResponseOfAccountOf:
      type: object
      additionalProperties: false
      properties:
        meta:
          description: Response metadata
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/Meta'
        data:
          type: array
          description: Response data
          nullable: true
          items:
            $ref: '#/components/schemas/Account'
    Meta:
      type: object
      additionalProperties: false
      properties:
        pagination:
          description: Pagination information
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/Pagination'
    Pagination:
      type: object
      additionalProperties: false
      properties:
        page_start:
          type: integer
          description: The record from which the response should be displayed
          format: int32
        page_token:
          type: string
          description: >-
            Unique id expected to get as part of response from Transact on every
            enquiry request.
          nullable: true
        total_size:
          type: integer
          description: Total number of records
          format: int32
        page_size:
          type: integer
          description: The total number of records per page
          format: int32
    InternalTransfer:
      type: object
      description: Represents an internal transfer between accounts
      additionalProperties: false
      properties:
        id:
          type: string
          description: Unique identifier for the internal transfer
        status:
          type: string
          description: >-
            The current processing status of the transaction, e.g. Completed,
            Pending, Failed
        uniqueIdentifier:
          type: string
          description: Unique identifier specific to this instance of the internal transfer
        internalTransferDetails:
          description: Transfer data
          oneOf:
            - $ref: '#/components/schemas/InternalTransferDetails'
        linkedActivities:
          type: array
          description: |-
            List of related financial activities
                        
          items:
            $ref: '#/components/schemas/Activity'
    InternalTransferDetails:
      type: object
      additionalProperties: false
      properties:
        amountCredited:
          description: >-
            Amount that has been deposited into or added to a recipient's
            account
                        
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        creditAmountCurrency:
          type: string
          description: |-
            Credit amount currency
                        
        debitAmount:
          description: >-
            Amount that was intended to be transferred or paid, not including
            any additional fees or charges. It's the raw amount before any
            processing fees or other costs are added.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        amountDebited:
          description: >-
            The total amount that has been debited from an account. This
            includes any and all deductions that have been finalized and
            processed out of an account.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        chargeAmount:
          description: >-
            Sum of money that is charged as a fee or cost associated with a
            financial transaction
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        valueDate:
          type: string
          description: >-
            Date on which the transaction is officially settled, meaning the
            funds are considered to have been transferred legally and are
            available for use by the recipient
                        
        chargeAnalysisReceiver:
          type: string
          description: >-
            Refers to the analysis or breakdown of charges that are applied to
            the receiver or beneficiary of an internal transfer.
        chargeAnalysisSender:
          type: string
          description: >-
            Refers to the breakdown or details of charges that are applied to
            the sender of a transaction
        debitAccountNumber:
          description: >-
            Unique identifier of a bank account from which funds are being
            withdrawn or debited
          oneOf:
            - $ref: '#/components/schemas/TransactionAccount'
        creditAccountNumber:
          description: Unique identifier of a bank account that is set to receive funds
          oneOf:
            - $ref: '#/components/schemas/TransactionAccount'
        chargeAccountNumber:
          description: >-
            Bank account number from which fees associated with a transaction
            are debited
          oneOf:
            - $ref: '#/components/schemas/TransactionAccount'
    TransactionAccount:
      type: object
      additionalProperties: false
      properties:
        number:
          type: string
          description: Account number
        accountRoutings:
          type: array
          description: Account routing details
          items:
            $ref: '#/components/schemas/BankRouting'
    Activity:
      type: object
      description: >-
        Refers to any transaction or operation performed within a financial
        institution that affects accounts or other financial products.
      additionalProperties: false
      properties:
        id:
          type: string
          description: The unique identifier for the activity.
        transactionStatus:
          type: string
          description: The current processing status of the transaction.
        status:
          type: string
          description: The general status of the activity.
        uniqueIdentifier:
          type: string
          description: A unique identifier specific to this instance of the activity.
        activityDetails:
          description: Detailed information about the activity.
          oneOf:
            - $ref: '#/components/schemas/ActivityDetails'
    ActivityDetails:
      type: object
      description: Holds details about a specific banking activity.
      additionalProperties: false
      properties:
        arrangementId:
          type: string
          description: Unique identifier for the arrangement associated with this activity.
        activityId:
          type: string
          description: Identifier for the type of activity.
        productId:
          type: string
          description: Product identifier related to the activity.
        currencyId:
          type: string
          description: Currency code for the activity.
        effectiveDate:
          type: string
          description: Date when the activity becomes effective.
    InternalTransferRequest:
      type: object
      description: >-
        Represents a request for an internal funds transfer between two
        accounts.
      additionalProperties: false
      required:
        - debitAccountNumber
        - debitAmountCurrency
        - creditAccountNumber
        - creditAmountCurrency
        - debitAmount
      properties:
        debitAccountNumber:
          type: string
          description: >-
            The account number from which the money will be taken. Please ensure
            this account has enough funds before initiating the transfer.
          minLength: 1
        debitAmountCurrency:
          type: string
          description: Gets or sets the currency code of the debit amount.
          minLength: 1
        creditAccountNumber:
          type: string
          description: The account number of the recipient's account.
          minLength: 1
        creditAmountCurrency:
          type: string
          description: The currency code for the credit amount, such as "USD", "EUR", etc.
          minLength: 1
        debitAmount:
          type: string
          description: >-
            The amount of money to be debited from the sender's account and
            credited to the recipient's account. Ensure

            the amount does not exceed the available balance in the debit
            account.
          minLength: 1
        endToEndIdentification:
          type: string
          description: >-
            Reference provided by the client to identify the transaction
            end-to-end.
          nullable: true
        remittanceInformation:
          type: string
          description: >-
            Free-text remittance information provided by the client, describing
            the purpose of the transaction.
          nullable: true
    PaymentResponse:
      type: object
      description: Represents the response to a SWIFT payment initiation request.
      additionalProperties: false
      properties:
        id:
          type: string
          description: >-
            Unique identifier assigned by the bank for the SWIFT transfer.

            This ID can be used for future reference and tracking of the
            payment.
        status:
          type: string
          description: |-
            The current status of the payment processing.
            Possible values include:
            - success: Payment has been accepted for processing
            - failed: Payment failed
        transactionStatus:
          type: string
          description: >-
            Detailed transaction status indicating the current state of the
            transfer.

            This provides more granular status information than the main status
            field.
        uniqueIdentifier:
          type: string
          description: >-
            A unique identifier specific to this instance of the SWIFT transfer.

            This identifier remains constant throughout the lifecycle of the
            payment

            and can be used for reconciliation purposes.
        details:
          description: |-
            Detailed information about the payment transaction including
            amounts, accounts, and settlement information.
          oneOf:
            - $ref: '#/components/schemas/PaymentResponseDetails'
        linkedActivities:
          type: array
          description: >-
            Collection of related financial activities associated with this
            payment.

            This may include charges, forex conversions, or other related
            transactions.
          items:
            $ref: '#/components/schemas/Activity'
    PaymentResponseDetails:
      type: object
      description: Contains detailed information about a processed SWIFT payment.
      additionalProperties: false
      properties:
        extReference:
          type: string
          description: >-
            External reference number assigned by the bank's payment processing
            system.

            This reference can be used for tracking and reconciliation purposes.
        instructedAmount:
          description: >-
            The amount and currency of the payment as instructed by the payment
            initiator.

            This represents the original payment amount before any charges or
            conversions.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        debtorAccount:
          description: >-
            Reference information for the account from which the payment is
            debited.

            Includes the account identifier and scheme information.
          oneOf:
            - $ref: '#/components/schemas/AccountReference'
        beneficiaryAccount:
          description: |-
            Reference information for the beneficiary's account.
            This may differ from the creditor account in certain scenarios.
          oneOf:
            - $ref: '#/components/schemas/AccountReference'
        creditorAccount:
          description: >-
            Reference information for the account to be credited with the
            payment.

            This represents the immediate recipient account of the funds.
          oneOf:
            - $ref: '#/components/schemas/AccountReference'
        settlementDetails:
          description: |-
            Details about the settlement of the payment, including credited and
            debited amounts, value dates, and settlement status.
          oneOf:
            - $ref: '#/components/schemas/SettlementDetails'
        chargeDetails:
          description: |-
            Information about the charges applied to the payment, including
            charge type, amounts, and the account to which charges are applied.
          oneOf:
            - $ref: '#/components/schemas/ChargeDetails'
        remittanceInformation:
          type: array
          description: |-
            Collection of unstructured information provided with the payment
            to help with reconciliation and payment identification.
          nullable: true
          items:
            $ref: '#/components/schemas/UnstructuredInformation'
        beneficiary:
          description: |-
            Detailed information about the ultimate beneficiary of the payment.
            Includes identification, name, and additional information.
          oneOf:
            - $ref: '#/components/schemas/PartyDetails'
        beneficiaryAgent:
          description: |-
            Information about the beneficiary's bank or financial institution.
            Typically, includes the BIC/SWIFT code and bank details.
          oneOf:
            - $ref: '#/components/schemas/PartyDetails'
        intermediaryAgent:
          description: >-
            Details of any intermediary bank involved in the payment chain.

            This is optional and only present for payments requiring
            intermediary processing.
          oneOf:
            - $ref: '#/components/schemas/PartyDetails'
    AccountReference:
      type: object
      description: Reference to a debtor or creditor account
      additionalProperties: false
      properties:
        schemeName:
          type: string
          description: >-
            The name of the identification scheme, e.g. "IBAN", "BBAN",
            "AccountNumber".
        identification:
          type: string
          description: The identifier within that scheme (e.g. the IBAN or account number).
        Name:
          type: string
          description: The name of the account, if available (optional).
    SettlementDetails:
      type: object
      description: Contains details about the settlement of a payment transaction.
      additionalProperties: false
      properties:
        amountCredited:
          description: >-
            The amount that was credited to the beneficiary account.

            This may differ from the instructed amount due to currency
            conversion

            or intermediary bank charges.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        amountDebited:
          description: |-
            The total amount debited from the sender's account.
            This includes the payment amount plus any applicable charges.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        valueDate:
          type: string
          description: |-
            The date on which the payment is settled between banks.
            This is the date when the funds become available to the beneficiary.
            Format: ISO 8601 date string (YYYY-MM-DD)
        recordStatus:
          type: string
          description: The current status of the settlement record.
    ChargeDetails:
      type: object
      description: Contains information about charges applied to a payment transaction.
      additionalProperties: false
      properties:
        chargesType:
          type: string
          description: |-
            Specifies how the charges for the payment are allocated.
            Possible values:
            - OUR: All charges are paid by the sender
            - BEN: All charges are paid by the beneficiary
            - SHA: Charges are shared between sender and beneficiary
        chargeAmount:
          description: |-
            The total amount of charges applied to the payment.
            Includes both sending and receiving bank charges.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        chargeAccount:
          description: >-
            Reference information for the account from which charges are
            collected.

            This may be different from the main debit account.
          oneOf:
            - $ref: '#/components/schemas/AccountReference'
        chargeAnalysis:
          description: |-
            Detailed breakdown of how charges are distributed between
            the sending and receiving parties.
          oneOf:
            - $ref: '#/components/schemas/ChargeAnalysis'
    ChargeAnalysis:
      type: object
      description: >-
        Provides a detailed breakdown of charges applied to a payment
        transaction.
      additionalProperties: false
      properties:
        sender:
          description: >-
            The amount of charges applied by and payable to the sending bank.

            This may include processing fees, wire transfer fees, or other
            sending bank charges.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        receiver:
          description: >-
            The amount of charges applied by and payable to the receiving bank.

            This may include processing fees, incoming wire fees, or other
            receiving bank charges.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
    UnstructuredInformation:
      type: object
      description: >-
        A single line of unstructured text, e.g. per Open Banking’s
        RemittanceInformation Unstructured field.
      additionalProperties: false
      properties:
        unstructured:
          type: string
          description: The narrative text (e.g. remittance line, beneficiary note, etc.).
    PartyDetails:
      type: object
      description: >-
        Represents details of a party involved in a payment transaction.

        This class can be used for various parties such as creditors, agents, or
        intermediaries.
      additionalProperties: false
      required:
        - identification
        - name
        - additionalInformation
      properties:
        identification:
          type: string
          description: >-
            Unique identification of the party, such as a BIC (Bank Identifier
            Code) for financial institutions

            or an account number for account holders.
          minLength: 1
        name:
          type: string
          description: >-
            Name by which the party is known and which is usually used to
            identify the party.
          minLength: 1
        additionalInformation:
          type: array
          description: >-
            Additional information about the party that may be required for
            processing the payment,

            such as address details, country codes, or specific payment
            instructions.
          items:
            type: string
    PaymentRequest:
      type: object
      description: |-
        Represents a payment initiation request in the Open Banking API.
        This is the root object for initiating a payment transaction.
      additionalProperties: false
      required:
        - instructionIdentification
        - debtorAccount
        - instructedAmount
        - creditorAccount
        - creditorAgent
        - chargesType
        - remittanceInformation
      properties:
        instructionIdentification:
          type: string
          description: >-
            Unique identification as assigned by an instructing party for an
            instructed party to unambiguously identify the instruction.
          minLength: 1
        debtorAccount:
          description: >-
            Unambiguous identification of the account of the debtor to which a
            debit entry will be made as a result of the transaction.
          oneOf:
            - $ref: '#/components/schemas/AccountDetails'
        instructedAmount:
          description: >-
            Amount of money to be moved between the debtor and creditor, before
            deduction of charges, expressed in the currency as ordered by the
            initiating party.
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        creditorAccount:
          description: >-
            Unambiguous identification of the account of the creditor to which a
            credit entry will be posted as a result of the payment transaction.
          oneOf:
            - $ref: '#/components/schemas/PartyDetails'
        creditorAgent:
          description: Financial institution servicing an account for the creditor.
          oneOf:
            - $ref: '#/components/schemas/PartyDetails'
        intermediaryAgent:
          description: Agent between the debtor's agent and the creditor's agent.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/PartyDetails'
        chargesType:
          type: string
          description: >-
            Specifies which party/parties will bear the charges associated with
            the processing of the payment transaction.
          minLength: 1
        remittanceInformation:
          type: array
          description: >-
            Information supplied to enable the matching/reconciliation of an
            entry with the items that the payment is intended to settle.
          items:
            type: string
    AccountDetails:
      type: object
      description: >-
        Represents basic account identification details used in payment
        transactions.

        This class is used for both debtor and creditor accounts.
      additionalProperties: false
      required:
        - identification
      properties:
        identification:
          type: string
          description: >-
            Unique identification of the account, such as an IBAN (International
            Bank Account Number)

            or a local account number.
          minLength: 1
    ApiToken:
      type: object
      description: Represents an API token with its value and expiration date.
      additionalProperties: false
      properties:
        token:
          type: string
          description: Gets or sets the JWT token.
        expiration:
          type: string
          description: Gets or sets the expiration date and time of the token.
          format: date-time
    ApiCredentials:
      type: object
      description: Represents the credentials required to generate an API token.
      additionalProperties: false
      required:
        - clientId
        - clientSecret
      properties:
        clientId:
          type: string
          description: Gets or sets the client ID assigned by the authorization server.
          minLength: 1
        clientSecret:
          type: string
          description: Gets or sets the client secret assigned by the authorization server.
          minLength: 1
    ApiResponseOfTransactionOf:
      type: object
      additionalProperties: false
      properties:
        meta:
          description: Response metadata
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/Meta'
        data:
          type: array
          description: Response data
          nullable: true
          items:
            $ref: '#/components/schemas/Transaction'
    Transaction:
      type: object
      description: Details related to a financial transaction
      additionalProperties: false
      properties:
        id:
          type: string
          description: A unique ID of the transaction
        thisAccount:
          description: |-
            Account associated with the transaction
             
          oneOf:
            - $ref: '#/components/schemas/TransactionAccount'
        otherAccount:
          description: Refers to the counter-party's account in a transaction
          oneOf:
            - $ref: '#/components/schemas/TransactionAccount'
        details:
          description: Provides further transaction details
          oneOf:
            - $ref: '#/components/schemas/TransactionDetails'
        metadata:
          description: Provides transaction metadata
          oneOf:
            - $ref: '#/components/schemas/TransactionMetadata'
        transactionAttributes:
          type: array
          description: >-
            Additional details or characteristics associated with an transaction
            object.
          items:
            $ref: '#/components/schemas/TransactionAttribute'
    TransactionDetails:
      type: object
      additionalProperties: false
      properties:
        type:
          type: string
          description: Balance type, in a coded form.
        description:
          type: string
        posted:
          type: string
          description: >-
            Date and time when a transaction entry is posted to an account on
            the account servicer's books
        completed:
          type: string
          description: >-
            Date and time at which assets become available to the account owner
            in case of a credit entry, or cease to be available to the account
            owner in case of a debit transaction entry.
        newBalance:
          description: >-
            New balance after a transaction entry is posted to an account on the
            account servicer's books
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        value:
          description: Amount of money in the transaction entry
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
    TransactionMetadata:
      type: object
      additionalProperties: false
      properties:
        narrative:
          type: string
          description: |-
            Provide additional details about the transaction
                        
    TransactionAttribute:
      type: object
      description: Attribute value in form of (name, value)
      additionalProperties: false
      properties:
        name:
          type: string
          description: >-
            refers to a specific property or characteristic associated with the
            transaction, such as "amount" or "transaction_type".
        value:
          type: string
          description: >-
            Corresponds to the actual data or content assigned to that
            particular property, e.g., "100.00" for "amount" or "debit" for
            "transaction_type"
    ApiResponseOfTransactionStatusOf:
      type: object
      additionalProperties: false
      properties:
        meta:
          description: Response metadata
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/Meta'
        data:
          type: array
          description: Response data
          nullable: true
          items:
            $ref: '#/components/schemas/TransactionStatus'
    TransactionStatus:
      type: object
      description: Represents the status of a transaction in the Open Banking API.
      additionalProperties: false
      properties:
        type:
          type: string
          description: The type of transaction (e.g., "Outward Swift Payment MT103 API")
        externalReference:
          type: string
          description: External reference number for the transaction
          nullable: true
        status:
          type: string
          description: >-
            Current status of the transaction (e.g., "Pending", "Completed",
            "Failed")
        remittanceInformation:
          type: string
          description: >-
            Free-text remittance information provided by the client, describing
            the purpose of the transaction.
          nullable: true
        transactionId:
          type: string
          description: Unique transaction number
        debitAmount:
          description: The amount debited from the account
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        valueDate:
          type: string
          description: The date when the transaction will be processed
        creditAmount:
          description: The amount credited from the account
          oneOf:
            - $ref: '#/components/schemas/CurrencyAmount'
        exchangeRate:
          type: number
          description: Exchange rate applied to the transaction
          format: decimal
          nullable: true
  securitySchemes:
    Authorization:
      type: http
      description: Access token
      in: header
      scheme: bearer
      bearerFormat: jwt
    Feature Permissions:
      type: http
      description: >-
        Feature-based permissions are claims contained in the JWT token. The
        token must include the specified permission claim to access the
        endpoint. These permissions are validated during token validation.
      in: header
      scheme: bearer
      bearerFormat: jwt
