> ## Documentation Index
> Fetch the complete documentation index at: https://docs2.finverse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# login_identity/refresh (User-present data refresh)

> Trigger a data refresh request for a Login Identity, requesting Finverse to start authenticating with the institution (using stored credentials), and if authentication succeeds, to fetch new data for the Login Identity.

This refresh request example uses the **user-present mode** see the next request for an example of the **background refresh mode.**

_Note: a success response only indicates that the refresh request has been accepted and is being processed. Authentication or data retrieval may still fail asynchronously (e.g. a user may have changed their credentials)._

**Authorization**: `login_identity_token`

### Refresh requirements

**When a refresh is requested, Finverse will first check that the refresh is allowed:**

- **All data refreshes:** Finverse first checks whether the Login Identity is eligible for refreshes, i.e. the Login Identity has `refresh.refresh_allowed = true` (see `GET /login_identity`). This means:
    
    - The user's credentials are available (i.e. the user provided consent to store the credentials for refreshes); and
        
    - The user's Login Identity is in refreshable state (e.g. previous linking/refresh attempts did not result in a persistent user-error).
        
- **Background data refreshes**: Finverse also checks whether the institution being refreshed is generally available for background refreshes, i.e. the institution has `login_details.refresh_supported` = `true`. (see `GET /institutions`).
    

If the refresh is allowed, Finverse will start re-authenticating the Login Identity with the institution, and if authentication succeeds, Finverse will then fetch new data for the Login Identity.

### link_customizations (object, optional)

Optional parameters to customize the behaviour of Finverse Link's UI to fit your implementation requirements.

## Monitoring refresh status

**To check the authentication & data retrieval progress**: see the section on "_Monitoring refresh status_" under "**Data Refresh**" above.

## Token handling

**Note: only applies if using** **`GET /link/fvlink/status/{login_identity_id}`** to check the refresh result.

**Usage:** `link_token` can be used by either back-end or front-end clients to check the linking status via `GET /link/fvlink/status/{login_identity_id}`. It is the only Finverse API token that is allowed for use by front-end clients.

**Renewal**: `link_token` expires after 5 minutes. Repeat the refresh request if the token has expired.

## Link URL handling

**Note: only applies to user-present refresh mode** (i.e. where `user_present` = `true`).

Depending on your preferred refresh UI, if the user is present, you can initiate a refresh and then either:

1. **Immediately open the Link URL**, so the user can see the refresh status & handle any 2FA action steps;
    
2. **(recommended) Store the** **`link_url`** **and monitor the refresh status in the background until the refresh status is updated,** and then either:
    
    1. If a 2FA action is required, open the `link_url` so the user can complete the action steps using the Finverse Link UI.
        
    2. If the refresh is successful or encounters an error, either directly display the refresh result to your user in your application, or open the `link_url` for the Finverse Link UI to display a success/error message to the user.



## OpenAPI

````yaml /api-reference/openapi.json post /login_identity/refresh
openapi: 3.0.0
info:
  description: Documentation of the early finverse services
  title: Finverse Public
  termsOfService: https://example.com
  contact:
    name: Maintainers
    email: info@finverse.com
  license:
    name: unknown license
  version: 0.0.1
servers:
  - url: https://api.prod.finverse.net
security:
  - Oauth2:
      - test
tags:
  - name: public
    description: Publicly accessible endpoints
    x-group: Public
  - name: customer
    description: Customer app and institution endpoints
    x-group: Customer
  - name: link
    description: Finverse Link flows
    x-group: Link
  - name: login_identity
    description: Login identity lifecycle and metadata
    x-group: Login identity
  - name: accounts
    description: Accounts, balances, and account numbers
    x-group: Accounts
  - name: statements
    description: Statements and composite statements
    x-group: Statements
  - name: transactions
    description: Transaction history
    x-group: Transactions
  - name: identity_income
    description: Identity and income insights
    x-group: Identity & income
  - name: payment_links
    description: Payment link creation and checkout
    x-group: Payment links
  - name: mandates
    description: Direct debit mandates
    x-group: Mandates
  - name: payments
    description: Payment initiation and status
    x-group: Payment operations
  - name: payouts
    description: Payouts and scheduled payouts
    x-group: Payouts
  - name: payment_users
    description: Payment user profiles
    x-group: Payment users
  - name: payment_accounts
    description: Payment accounts for users
    x-group: Payment accounts
  - name: payment_methods
    description: Stored payment methods
    x-group: Payment methods
  - name: bills
    description: Bill presentment
    x-group: Bills
  - name: disputes
    description: Payment disputes
    x-group: Disputes
  - name: ledger
    description: Ledger and statements
    x-group: Ledger
paths:
  /login_identity/refresh:
    post:
      tags:
        - login_identity
      summary: login_identity/refresh (User-present data refresh)
      description: >-
        Trigger a data refresh request for a Login Identity, requesting Finverse
        to start authenticating with the institution (using stored credentials),
        and if authentication succeeds, to fetch new data for the Login
        Identity.


        This refresh request example uses the **user-present mode** see the next
        request for an example of the **background refresh mode.**


        _Note: a success response only indicates that the refresh request has
        been accepted and is being processed. Authentication or data retrieval
        may still fail asynchronously (e.g. a user may have changed their
        credentials)._


        **Authorization**: `login_identity_token`


        ### Refresh requirements


        **When a refresh is requested, Finverse will first check that the
        refresh is allowed:**


        - **All data refreshes:** Finverse first checks whether the Login
        Identity is eligible for refreshes, i.e. the Login Identity has
        `refresh.refresh_allowed = true` (see `GET /login_identity`). This
        means:
            
            - The user's credentials are available (i.e. the user provided consent to store the credentials for refreshes); and
                
            - The user's Login Identity is in refreshable state (e.g. previous linking/refresh attempts did not result in a persistent user-error).
                
        - **Background data refreshes**: Finverse also checks whether the
        institution being refreshed is generally available for background
        refreshes, i.e. the institution has `login_details.refresh_supported` =
        `true`. (see `GET /institutions`).
            

        If the refresh is allowed, Finverse will start re-authenticating the
        Login Identity with the institution, and if authentication succeeds,
        Finverse will then fetch new data for the Login Identity.


        ### link_customizations (object, optional)


        Optional parameters to customize the behaviour of Finverse Link's UI to
        fit your implementation requirements.


        ## Monitoring refresh status


        **To check the authentication & data retrieval progress**: see the
        section on "_Monitoring refresh status_" under "**Data Refresh**" above.


        ## Token handling


        **Note: only applies if using** **`GET
        /link/fvlink/status/{login_identity_id}`** to check the refresh result.


        **Usage:** `link_token` can be used by either back-end or front-end
        clients to check the linking status via `GET
        /link/fvlink/status/{login_identity_id}`. It is the only Finverse API
        token that is allowed for use by front-end clients.


        **Renewal**: `link_token` expires after 5 minutes. Repeat the refresh
        request if the token has expired.


        ## Link URL handling


        **Note: only applies to user-present refresh mode** (i.e. where
        `user_present` = `true`).


        Depending on your preferred refresh UI, if the user is present, you can
        initiate a refresh and then either:


        1. **Immediately open the Link URL**, so the user can see the refresh
        status & handle any 2FA action steps;
            
        2. **(recommended) Store the** **`link_url`** **and monitor the refresh
        status in the background until the refresh status is updated,** and then
        either:
            
            1. If a 2FA action is required, open the `link_url` so the user can complete the action steps using the Finverse Link UI.
                
            2. If the refresh is successful or encounters an error, either directly display the refresh result to your user in your application, or open the `link_url` for the Finverse Link UI to display a success/error message to the user.
      operationId: refreshLoginIdentity
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefreshLoginIdentityRequest'
            examples:
              user_present_data_refresh:
                summary: login_identity/refresh (User-present data refresh)
                value:
                  link_customizations:
                    redirect_uri: '{{REDIRECT_URI}}'
                    state: '{{customer_app_id}}_stateparameter'
                    ui_mode: redirect
                  user_present: true
              background_data_refresh:
                summary: login_identity/refresh (Background data refresh)
                value: |2

                      
                          
                      
                      
      responses:
        '200':
          description: Refresh queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefreshTokenResponse'
              examples:
                success:
                  summary: Success
                  value:
                    access_token: >-
                      eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC9jcnlwdG9LZXlzL2p3dC1rZXkvY3J5cHRvS2V5VmVyc2lvbnMvMSIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2FwaS5wcm9kLmZpbnZlcnNlLm5ldCIsImNsaWVudElkIjoiMDFGNzMwWTIyTTdKSERZQjRFNEsxREsyV0ciLCJjdXN0b21lckFwcElkIjoiMDFGNzMwWTI0NjlDMzdHM0RCNTNHUFRYOTkiLCJleHAiOjE3MjcwNjYyNzYsImlhdCI6MTcyNzA2NTk3NiwiaW5zdGl0dXRpb25JZCI6InRlc3RiYW5rMiIsImlzcyI6ImZpbnZlcnNlLXByb2QiLCJsaW5rVG9rZW5SZXF1ZXN0Ijoie1wicmVkaXJlY3RfdXJpXCI6XCJodHRwczovL2VucTRhNjBqbjN6dXAueC5waXBlZHJlYW0ubmV0L2NhbGxiYWNrXCIsXCJzdGF0ZVwiOlwiMDFGNzMwWTI0NjlDMzdHM0RCNTNHUFRYOTlfc3RhdGVwYXJhbWV0ZXJcIixcInVpX21vZGVcIjpcInJlZGlyZWN0XCJ9IiwibG9naW5JZGVudGl0eUlkIjoiMDFKOEVKN1owQ0ZKVFdUS0U0Vlk5N0pENEciLCJwcm9kdWN0RmxvdyI6IlJFRlJFU0hfREFUQV9SRVRSSUVWQUwiLCJyZWRpcmVjdFVyaSI6Imh0dHBzOi8vZW5xNGE2MGpuM3p1cC54LnBpcGVkcmVhbS5uZXQvY2FsbGJhY2siLCJzY29wZSI6ImN1c3RvbWl6YXRpb246Z2V0IGluc3RpdHV0aW9uIGZ2TGlua1N0YXR1czpyZWFkIGxpbmtBcGk6dXBkYXRlIiwic3ViIjoiMDFGNzMwWTIyTTdKSERZQjRFNEsxREsyV0cifQ.T_RA97CZ0KRBHyX1sMIhpQX_NLWMaYKz2i3227yY_NKJ4uWYZ5SESqquwsGZITqCO-LlYMVwZNvJ3r2F-JlmKCs5-trtEiuTkNYN_dlgv8u8knY6YTsDHWegYwqZcR0DdTYZLeowbOpfsXzOTExXQaaowY3VWCQ78IWXo5fISy0LqZ4V-GMKs5un4V4CLKgYzWPOGaD-YDDrlSaFtOB-fSlymPaeOJ4nzRlsJr84IGII80NcC_3Z_A3qx5kru30pv4PDuXA5GcbUG_5FYFbWs4rRhhpNPcVa5wE8BlHZ4OF6QZimrd7zSo6mzIS9YuWA1OuXLK6aPiQnzEu-Bo-TT0jSMZCWOzOVc7sgLotjxMFMdUMo2DUQxLiiP-AzeyPjQFHae-uyY4OYkf5Ydsta46-Zr2GPeU1kpEo2hsSuYKfnmoq7VhfVUcyanvab6NqtJyBj5oCeYofSAHNAAJMwtV3hgpEWAuNaEm-45oDdyuhWHHreBGjjrKHAMnBVHolfnrHqK92becuGSpadeTpsmim2XDVijm4V0dRHKHrqDQYt2WWjR6GMBUqtaKJt0FrR-rZtzlNEiHTjIYzau1EsqY3Lso4dsf5DXjk8TDBzOwjAN4ZZd54DPRBbXAeS20ok3thDC2ljquIOOcsKjBRITQUdI-ooY7_dWVY7bm76FlU
                    expires_in: 300
                    issued_at: '2024-09-23T04:32:56.000Z'
                    link_url: >-
                      https://link.prod.finverse.net/onboarding/refresh?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC9jcnlwdG9LZXlzL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WXo5fISy0LqZ4V-GMKs5un4V4CLKgYzWPOGaD-YDDrlSaFtOB-fSlymPaeOJ4nzRlsJr84IGII80NcC_3Z_A3qx5kru30pv4PDuXA5GcbUG_5FYFbWs4rRhhpNPcVa5wE8BlHZ4OF6QZimrd7zSo6mzIS9YuWA1OuXLK6aPiQnzEu-Bo-TT0jSMZCWOzOVc7sgLotjxMFMdUMo2DUQxLiiP-AzeyPjQFHae-uyY4OYkf5Ydsta46-Zr2GPeU1kpEo2hsSuYKfnmoq7VhfVUcyanvab6NqtJyBj5oCeYofSAHNAAJMwtV3hgpEWAuNaEm-45oDdyuhWHHreBGjjrKHAMnBVHolfnrHqK92becuGSpadeTpsmim2XDVijm4V0dRHKHrqDQYt2WWjR6GMBUqtaKJt0FrR-rZtzlNEiHTjIYzau1EsqY3Lso4dsf5DXjk8TDBzOwjAN4ZZd54DPRBbXAeS20ok3thDC2ljquIOOcsKjBRITQUdI-ooY7_dWVY7bm76FlU&ui_mode=redirect
                    login_identity_id: 01J8EJ7Z0CFJTWTKE4VY97JD4G
                    token_type: Bearer
                success_2:
                  summary: Success
                  value:
                    access_token: >-
                      eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC9jcnlwdG9LZXlzL2p3dC1rZXkvY3J5cHRvS2V5VmVyc2lvbnMvMSIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2FwaS5wcm9kLmZpbnZlcnNlLm5ldCIsImNsaWVudElkIjoiMDFGNzMwWTIyTTdKSERZQjRFNEsxREsyV0ciLCJjdXN0b21lckFwcElkIjoiMDFGNzMwWTI0NjlDMzdHM0RCNTNHUFRYOTkiLCJleHAiOjE3MjcwNjU3NzUsImlhdCI6MTcyNzA2NTQ3NSwiaW5zdGl0dXRpb25JZCI6InRlc3RiYW5rIiwiaXNzIjoiZmludmVyc2UtcHJvZCIsImxpbmtUb2tlblJlcXVlc3QiOiJ7fSIsImxvZ2luSWRlbnRpdHlJZCI6IjAxSjhFSFFZWko3VFFTUk1RS0tBNEFDWlhRIiwicHJvZHVjdEZsb3ciOiJSRUZSRVNIX0RBVEFfUkVUUklFVkFMIiwicmVkaXJlY3RVcmkiOiIiLCJzY29wZSI6ImN1c3RvbWl6YXRpb246Z2V0IGluc3RpdHV0aW9uIGZ2TGlua1N0YXR1czpyZWFkIGxpbmtBcGk6dXBkYXRlIiwic3ViIjoiMDFGNzMwWTIyTTdKSERZQjRFNEsxREsyV0cifQ.ggudIRK2m7G5GSAbwFUkqNytmihRj2mX3jX5hA5pBDqnJpSx5FFSBUBKAw2CWjJn2gmQlGDDOptVYh_xBKZ4fwZN22vfDjuzCpe2GOxXlTbd4n4AjekpwXzsPP6BOUuu2DBEW_QGkU6ZMcouPcc7BgBLlvKmD3xkDXQaFd5CeYX_PIwCtWOod4UGSB71hAQ8MQukJC4p8aks4DaQtLksuMrlBsF4iidvVBDpe6VupI6AHmiek2hiS5-4rpxmxSCE_bN2D5CJ4_QetnFJNpSp8zLZi6buNpF0zO6uyq-NRCoKi2-gJb6isfpp4Q5b8WbBZv7BNG1FE8Al3nj955Aivi2oF3sIX-6RFtpntQOm7_adwo16LbNtmtWWIFJ-Ah-4yzjRgMzmuuv49OQLv_RldeNOfCEd2wuoKLRwWn8GCLQ8TGNyWi3xe-113Hm5yoPa7FOLd4K1qYclEC3P5JtfPy6fXDlXaodAhE53mreiD-7VwQ1v2DtSAxu5p4-QJxT-AbIp7j9nzrXoWMkw98YeKHZWuUfZqpHBT0I0059fv8FHy1M4R-TnSJN2_71yuNf2COJLhhtOYtdjWaLJz0mfmNhYX0lbeBtZF6tx8RV5tRRzjYk2CNv-pj7i1IXuCmTF-crUr4y_hOAKbz6reJ02n4yXuqL0KbhsGzoMtfaDXcc
                    expires_in: 300
                    issued_at: '2024-09-23T04:24:35.000Z'
                    link_url: >-
                      https://link.prod.finverse.net/onboarding/refresh?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Imp3dC9jcnlwdG9LZXlzL2p3dC1rZXkvY3J5cHRvS2V5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a7FOLd4K1qYclEC3P5JtfPy6fXDlXaodAhE53mreiD-7VwQ1v2DtSAxu5p4-QJxT-AbIp7j9nzrXoWMkw98YeKHZWuUfZqpHBT0I0059fv8FHy1M4R-TnSJN2_71yuNf2COJLhhtOYtdjWaLJz0mfmNhYX0lbeBtZF6tx8RV5tRRzjYk2CNv-pj7i1IXuCmTF-crUr4y_hOAKbz6reJ02n4yXuqL0KbhsGzoMtfaDXcc&ui_mode=iframe
                    login_identity_id: 01J8EHQYZJ7TQSRMQKKA4ACZXQ
                    token_type: Bearer
        '400':
          description: Refresh error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestModelV2'
              examples:
                no_credentials_stored:
                  summary: Error (no credentials stored)
                  value:
                    error:
                      code: 40013
                      error_code: LOGIN_IDENTITY_CREDENTIALS_NOT_STORED
                      message: >-
                        The user did not consent to storing their credentials.
                        Cannot perform refresh.
                      request_id: '1727066052'
                      type: API_ERROR
                login_identity_is_busy_or_not_available_for_refresh_due_to_a_previous_refresh_error:
                  summary: >-
                    Error (Login Identity is busy or not available for refresh
                    due to a previous refresh error)
                  value:
                    error:
                      code: 40011
                      error_code: LOGIN_IDENTITY_BUSY
                      message: The selected Login Identity is busy.
                      request_id: '1727080860'
                      type: API_ERROR
                no_credentials_stored_2:
                  summary: Error (no credentials stored)
                  value:
                    error:
                      code: 40013
                      error_code: LOGIN_IDENTITY_CREDENTIALS_NOT_STORED
                      message: >-
                        The user did not consent to storing their credentials.
                        Cannot perform refresh.
                      request_id: '1712918109'
                      type: API_ERROR
                institution_does_not_support_background_refresh_requests:
                  summary: >-
                    Error (institution does not support background refresh
                    requests)
                  value:
                    error:
                      code: 40012
                      error_code: INSTITUTION_REFRESH_NOT_SUPPORTED
                      message: >-
                        Institution does not support refresh requests, due to
                        MFA or other end-user authentication requirements. Ask
                        the end-user to complete the /relink flow instead.
                      request_id: '1727065840'
                      type: API_ERROR
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestModelV2'
      security:
        - Oauth2:
            - loginIdentity:update
components:
  schemas:
    RefreshLoginIdentityRequest:
      properties:
        link_customizations:
          $ref: '#/components/schemas/RefreshLoginIdentityLinkCustomizations'
          description: >-
            Optional parameters to customize the behaviour of Finverse Link's UI
            to fit your implementation requirements
        user_present:
          description: >-
            Flag to indicate whether the user is present in the customer's app
            (to handle any 2FA action steps required during authorization).
            **If** **`user_present`** **\=** **`true`**: Finverse will use the
            "**user-present refresh**" mode. This allows initiating a refresh
            for any institution. **If** **`user_present`** **\=** **`false`**
            **or omitted:** Finverse will use the "**background refresh**" mode.
            This only allows refreshing when the institution's
            `login_details.refresh_supported` = `true`.
          type: boolean
    RefreshTokenResponse:
      required:
        - access_token
        - token_type
        - expires_in
        - link_url
        - issued_at
        - login_identity_id
      properties:
        access_token:
          type: string
          description: Link session token (referred to as `link_token`)
        expires_in:
          description: Token validity length (in seconds)
          type: integer
          format: int64
        issued_at:
          type: string
          format: date-time
          description: Token issue time
        link_url:
          type: string
          example: https://link.dev.finverse.net/onboarding?token=dasdsa8erhiu7rey78r
          description: >-
            URL to launch the Finverse Link UI flow associated with this
            `link_token`, for the end-user to view the refresh status, or to
            provide 2F action inputs.
        login_identity_id:
          type: string
          description: Finverse Login Identity ID for the Login Identity being refreshed.
        token_type:
          type: string
          description: 'Possible values: `Bearer`'
    BadRequestModelV2:
      properties:
        error:
          type: object
          required:
            - type
            - code
            - error_code
            - message
            - request_id
          properties:
            code:
              type: integer
              example: 40004
            details:
              type: string
            error_code:
              type: string
              example: CREDENTIALS_INVALID
            message:
              type: string
            request_id:
              description: The request_id provided in the request header
              type: string
            type:
              description: The error type
              type: string
              enum:
                - LINK_ERROR
                - API_ERROR
              example: LINKING_ERROR
    RefreshLoginIdentityLinkCustomizations:
      properties:
        history_date_limit:
          description: >-
            Sets a specific start date limit for the transaction history
            retrieved by Finverse from the institution. This is useful when you
            only need Finverse to fetch recent transactions and want to speed up
            data retrieval. If omitted, Finverse will fetch the full available
            transaction history (3-24 months depending on the institution).
          type: string
          format: date
          example: '2024-01-31'
        language:
          description: >-
            ISO639-1 language code. Language to display when user open the link,
            default to English (en) if not specified
          type: string
          enum:
            - en
            - vi
            - zh
            - ko
          example: en
        redirect_uri:
          description: >-
            Finverse Link will redirect to this uri after either success or
            failure. Only required if `ui_mode` = `redirect` or `auto_redirect`.
            To use `GET /link/fvlink/status/{login_identity_id}` to check the
            status of the refresh session, you must provide a redirect_uri.
            Note: if provided, `redirect_uri` must be valid and associated with
            the `client_id`.
          type: string
        state:
          type: string
          maxLength: 100
          example: user-state-passed
          description: >-
            Customer-supplied state (treated as an opaque value), used by
            customer to uniquely identify the linking session. Only required if
            `ui_mode` = `redirect` or `auto_redirect`. To use `GET
            /link/fvlink/status/{login_identity_id}` to check the status of the
            refresh session, you must provide a `state`.
        ui_mode:
          type: string
          enum:
            - iframe
            - redirect
            - auto_redirect
            - standalone
          example: redirect
          description: >-
            Specifies the behaviour of the Finverse Link UI upon completion of
            the linking flow (in both success or error cases). If left empty,
            Finverse Link will default to iframe behaviour for the Data
            institution linking UI. **Recommended values**: any (based on
            desired UI) **Accepted values**: \- "": defaults to iframe behaviour
            for the Data institution linking UI. \- iframe: for use when the
            Finverse Link UI is launched as an iframe/webview embedded within
            the customer's application. On success/error, the callback to the
            customer's redirect_uri is triggered in the background, and the
            response is silently discarded. Finverse will display an Exit ("X")
            button on each screen and a "Continue" button on final success/error
            screens, allowing the user to close the iframe/webview and return to
            the customer's application (requires customer's application to
            handle iframe/webview messages). \- redirect: for use when the
            Finverse Link UI is launched in a new window/webview. On
            success/error, the callback isn't triggered immediately, but is
            bound to the "Continue" and "Exit" buttons. When the user clicks
            either button, the UI will navigate to the customer's redirect_uri.
            \- auto_redirect: similar to redirect mode, for use when the
            Finverse Link UI is launched in a new window/webview. On
            success/error, the callback is automatically triggered after 1
            second, and the UI navigates to the customer's redirect_uri.
            standalone: for use when the Finverse Link UI is launched in a new
            window/webview without the need to navigate back to the customer's
            application. On success/error, the callback to the customer's
            redirect_uri is triggered in the background, and the response is
            silently discarded. Finverse will display a "You may close this
            window now" message on final success/error screens, guiding the user
            to manually close the window/webview.
  securitySchemes:
    Oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://finverse-dev.us.auth0.com/oauth/token
          scopes:
            account: Account
            balance: Balance
            credit: Credit
            institution: Institution
            investment: Investment
            link: Link
            test: Test
            transaction: Transaction

````