# Data Synchronization
source: https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/accounts/data-sync/index.md

With the API, you can update and synchronize your users' accounts by following this guide. Just remember to have an access token. If you do not have an access token, see our [Quick Start Guide](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/quickstart/index.md) on how to get one.

#### Synchronization {#synchronization}

Data synchronization means synchronising both *accounts* and *transactions* , as both types might have changed since your last data update.
You can find out how to fetch a user's accounts in our [Account Information](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/accounts/account-information/index.md) guide and how to fetch transactions in our [Transactions](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/accounts/transactions/index.md) guide.

The flow of a data synchronization looks like this:

1. Fetch a user's accounts.

2. Fetch new transactions for each of the retrieved accounts. You can update your database of existing transactions by following our [Handling Changes](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/accounts/handling-changes/index.md) guide.

When you fetch new transactions, we recommend you set `fromDate` to seven days prior to the latest known transaction of the account.

Pseudo-code for synchronising data:

```js
// Fetch a user's accounts from the API
let accounts = getAccounts()

// Fetch new transactions for each account
for account in accounts:
  // A list of all existing transactions in your stored data
  let oldTransactionList = [...]
  // Find the latest known transaction for this account, in the data you already have (if any)
  let lastTransactionDate = getLastKnownTransactionDate(oldTransactionList)
  let fromDate = lastTransactionDate - (seven days)
  // Fetch new transactions for this account from the API
  let newTransactionList = getTransactions(account.Id, fromDate)
```

