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

# Nightly Refreshes

> If you would like automatic account refreshes, read the following sections to enable Nightly Refreshes.

<Warning>
  <p class="h4">Nightly Refresh is no longer actively supported</p>

  Automatic nightly refresh (without end-user presence) is no longer a supported feature for most financial institutions. Due to the prevalence of one-time passwords and push-notification MFA, automatic refresh success rates are extremely low in Canada (except for a small number of OAuth-connected institutions).

  **What this means for your integration:**

  * Do not rely on automatic nightly refresh for your use case.
  * To refresh account data, the end-user must be present and complete a live connection through Flinks Connect.
  * You can implement a "Refresh" button in your application that triggers a live [/Authorize](/api/authorize/endpoints/authorize) call with `MostRecentCached: false` — the user will need to complete MFA if prompted.
  * [Reconnect](/guides/connect/resume-and-reconnect) can help reduce friction for end-user reconnections.

  Existing customers with active nightly refresh configurations will continue to be supported. Contact your Flinks Representative for details on your specific setup.
</Warning>

## Eligibility Criteria

A card must comply with certain eligibility criteria before being refreshed. For a card to be refreshed, it must satisfy the following conditions:

* The Schedule Refresh parameter must be set to true. You can enable it in two ways:
  * **Flinks Connect iframe**: Add `scheduleRefresh=true` to your iframe URL parameters
  * **API**: Call the [/SetScheduledRefresh](/api/connect/endpoints/account-linking/set-scheduled-refresh) endpoint to enable or disable nightly refresh for specific accounts
* The card must have had a successful refresh in the last seven days.
* (Not applicable for Webhooks integrations) The card must have received a cached call in the past seven days.
* The card should not have any errors during Authorization. However, if an error has occurred, the card will still be eligible for refresh if the error is one of the following:
  * `RETRY_LATER`
  * `AGGREGATION_ERROR`
  * `SESSION_EXPIRED`
  * `DISABLED_INSTITUTION`
  * `UNAUTHORIZED`
  * `SESSION_NONEXISTENT`
  * `BANK MAINTENANCE_RETRY_LATER`

<Note>
  Security questions are not always prompted during Nightly Refresh. If MFA answers have been stored using the [/AnswerMFAQuestions](/api/connect/endpoints/account-linking/answer-mfa-questions) endpoint and Enhanced MFA is enabled, Flinks can answer them automatically, minimizing MFA interruptions during nightly refreshes.
</Note>

## Enabling Nightly Refreshes

You can enable automatic account refreshes using Nightly Refresh and Enhanced MFA.

### Nightly Refresh

If your use case requires automatic account refresh to keep track of transactional history changes, you can enable `Nightly Refresh` for new accounts. For this, you need to set the scheduleRefresh parameter to true in the iframe URL.

### Enhanced MFA (Deprecated)

<Warning>
  <p class="h4">Enhanced MFA is no longer supported</p>

  Enhanced MFA is no longer an actively supported feature. Most Canadian financial institutions have moved to one-time passwords and push notifications for MFA, which cannot be answered automatically. The `enhancedMFA` and `skipEnhancedMFA` iframe parameters should not be used in new integrations.

  For refreshing account data, implement a user-initiated reconnection flow instead. See the [Reconnect](/guides/connect/resume-and-reconnect) guide for recommended approaches.
</Warning>

## Useful Endpoints

[/GetNightlyRefreshStatus](/api/connect/endpoints/account-linking/get-nightly-refresh-status): This endpoint returns a list with all of the `loginIds` that are set to Nightly Refresh (`"isScheduledRefresh"=true`), yet are no longer refreshing due to errors. The endpoint's JSON response will clarify what error was encountered on the refresh attempt.

[/Authorize](/api/authorize/endpoints/authorize): This endpoint will also return the error message from the previous refresh attempt when running the batched cached calls. In cases where the JSON response doesn't return any errors, please make sure you check the date of the latest refresh. An example can be seen in the image below:

If the date of your last refresh is too long ago for your use case, please perform a manual refresh. This can be done by changing the body parameters in [/Authorize](/api/authorize/endpoints/authorize) and by subsequently calling our aggregation endpoints with the provided `requestId`. You must change the following body parameters to:

* `"MostRecentCached": false`
* `"Save": true`

## Suggested daily routine

Complete the following steps in our suggested daily routine for refreshes:

### Step 1: Check which loginIds are no longer eligible

Call the `/GetNightlyRefreshStatus` endpoint to identify accounts that are set to refresh but no longer meet the eligibility criteria:

```mermaid theme={null}
flowchart LR
    A["/GetNightlyRefreshStatus"] -->|For each LoginId<br/>present on the list| B["Flinks Connect<br/><small>User needs to reconnect</small>"]
    
    style A fill:#4FC3F7,stroke:#333,stroke-width:2px
    style B fill:#B0C4DE,stroke:#333,stroke-width:2px
```

### Step 2: Handle loginIds not on the list

If any `loginIds` are not on the list, follow this flowchart to manually refresh them:

```mermaid theme={null}
flowchart TB
    A["/Authorize<br/>MostRecentCached=true<br/>Save=true"] --> B{200?}
    
    B -->|Yes| D["GetAccountsDetail"]
    B -->|No| C{"Error is RETRY_LATER,<br/>AGGREGATION_ERROR, SESSION_EXPIRED,<br/>DISABLED_INSTITUTION, UNAUTHORIZED,<br/>SESSION_NONEXISTENT, or<br/>BANK_MAINTENANCE_RETRY_LATER?"}
    
    C -->|Yes| F["/Authorize<br/>MostRecentCached=false<br/>Save=true"]
    C -->|No| E1["Flinks Connect<br/>User needs to reconnect"]

    F --> F1{Response?}
    F1 -->|200| D
    F1 -->|203 MFA| MFA["Flinks Connect<br/>with requestId + authorizeToken<br/>User answers MFA"]
    MFA --> D
    
    D --> G{200?}
    D --> H{"202<br/>OPERATION PENDING?"}
    
    G -->|Yes| I["Attributes endpoints"]
    G -->|No| E2["Flinks Connect<br/>User needs to reconnect"]
    
    H -->|Yes| J["GetAccountsDetailAsync"]
    
    J --> K{"202<br/>OPERATION PENDING?"}
    K -->|"Yes, wait 3 seconds"| J
    K -->|No| I2["Attributes endpoints"]

    style A fill:#4FC3F7,stroke:#333
    style D fill:#4FC3F7,stroke:#333
    style F fill:#4FC3F7,stroke:#333
    style J fill:#40E0D0,stroke:#333
    style I fill:#40E0D0,stroke:#333
    style I2 fill:#40E0D0,stroke:#333
    style E1 fill:#B0C4DE,stroke:#333
    style E2 fill:#B0C4DE,stroke:#333
    style MFA fill:#B0C4DE,stroke:#333
```

## Nightly Refresh routine

The Nightly Refresh job has a daily routine. The job is scheduled to run from 4 a.m. to 8 a.m. (UTC). It will only impact all cards that meet the Eligibility Criteria.

## Coverage

For more information about which financial institutions we support Nightly Refreshes for, contact your Flinks Representative.
