# Get Account Information
source: https://developer.mastercard.com/open-finance-europe/documentation/unlicensed/aiia-data/account-information/index.md

The Get Account Information endpoint enables you to get an end-user's accounts that your service has been granted access to.

Here is how you can get a list of all the end-user's accounts:

```shell
curl -X GET \
  https://api-sandbox.aiia.eu/v1/accounts \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
```

#### Query Parameters {#query-parameters}

|         **Name**          | **Required** |       **Type**       |                                                                                                                  **Description**                                                                                                                   |
|---------------------------|--------------|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `showNagMigrationDetails` | No           | `boolean`            | This parameter is intended for customers who have migrated to Aiia Data from our Aiia Enterprise product. If set to `true`, then `nagApiAccountId` will be returned, to help you reconcile against accounts you retrieved through Aiia Enterprise. |
| `includeOrphaned`         | No           | `boolean`            | This parameter is by default `true`. If you set this to `false`, you will not get any accounts that have `isOrphaned` set                                                                                                                          |
| `accountsGroupId`         | No           | `URL encoded string` | Optional parameter to return only account in a given account group                                                                                                                                                                                 |

Note: **Having trouble?**   
Make sure you have a valid access token when completing the Connect Flow as described in our [Quick Start Guide](https://developer.mastercard.com/open-finance-europe/documentation/unlicensed/aiia-data/quickstart/index.md).

#### Result {#result}

The call returns a JSON object in this format:

```json
{
  "accounts": [
    {
        "accountProvider": {
            "id": "TestDataBank1",
            "name": "Test bank with data #1 DKK"
        },
        "available": {
            "currency": "DKK",
            "value": 6439.15
        },
        "availableBalance": null,
        "booked": {
            "currency": "DKK",
            "value": 6439.15
        },
        "bookedBalance": 6439.15,
        "currency": "DKK",
        "id": "ZmExODkyNzEtZjk2NS00ZjVjLTk5ZjktZTQ1Y682zYmMyODM5fFRlc3REYXRhQmFuazF8N2aXM5ZFIzd0gzLWhSNWJhY21nSEZCdy4x",
        "isOrphaned": false,
        "lastSynchronized": "2019-09-02T08:52:16.5816944Z",
        "nagApiAccountId": "T6t4Pk9uNDgiz7JCKcK3vis9dR3wH3-hR5bacmgHFBw.1",
        "name": "Direct Debit",
        "number": {
            "bban": "0001-245787654",
            "bbanParsed": {
                "accountNumber": "245787654",
                "bankCode": "0001"
            },
            "bbanType": "0001-245787654",
            "card": null,
            "iban": null
        },
        "owner": "Christian Thomsen",
        "syncStatus" : "Queued",
        "type": "Consumption"
    },
    ...
}
```

The object contains useful information about:

* What you need in order to get transaction data
* What type of account it is
* What the balance on the account is and in what currency

|      **Name**      | **Type**  |                                                                               **Description**                                                                               |
|--------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `accountProvider`  | `object`  | Contains an ID and user-friendly name of the provider                                                                                                                       |
| `available`        | `object`  | Available balance is set when provided by the account provider, including the ISO 4217 currency code ([website](https://www.currency-iso.org/en/home/tables/table-a1.html)) |
| `booked`           | `object`  | Booked balance of the account, including the ISO 4217 currency code ([website](https://www.currency-iso.org/en/home/tables/table-a1.html))                                  |
| `currency`         | `string`  | The main currency of the account                                                                                                                                            |
| `id`               | `string`  | Unique ID of the account                                                                                                                                                    |
| `isOrphaned`       | `boolean` | This shows whether or not we can no longer find the account in the bank, this will be true if we cannot                                                                     |
| `lastSynchronized` | `string`  | The last time this account's data was synchronized                                                                                                                          |
| `nagApiAccountId`  | `string`  | The Aiia Enterprise account id, useful for migrating from Aiia Enterprise to Aiia Data                                                                                      |
| `name`             | `string`  | The name of the account                                                                                                                                                     |
| `number`           | `object`  | The account number                                                                                                                                                          |
| `owner`            | `string`  | The name of the account owner                                                                                                                                               |
| `syncStatus`       | `string`  | The current sync status of this account, can be "Queued", "Failed", "Updating" or "Finished                                                                                 |
| `type`             | `string`  | Type of account: `Consumption`, `Loan`, `Savings`, `LockedSavings`, etc.                                                                                                    |

Note: Take note of the `id` of each account as you will need it to get [transaction data](https://developer.mastercard.com/open-finance-europe/documentation/unlicensed/aiia-data/transactions/index.md) from the accounts. In this way, you will make your workday easier for you and your co-workers. Warning: This `id` could potentially change. Depending on the provider the following situations may cause the `id` to change for the same account:

* Bank side API updates
* Bank merges
* Consent renewal
* Re-authentication is required

For both consent renewal and re-authentication, you should be able to monitor the `id` change.

If you cache the account ids to later retrieve account transactions, you must have a mechanism to update the account `id` if it changes. A mechanism for validating if an `id` has changed might include things such as a match to the `IBAN` received.

#### Group ID and Group Name {#group-id-and-group-name}

If defined in the Connect flow, the Group ID and Group Name will be returned as fields in the JSON.

```JSON
            },
            "owner": "Christian Thomsen",
            "syncStatus": "Finished",
            "type": "Consumption",
            "verifiedForPayments": false,
            "groupId": "12345678",
            "groupName": "My Company Aps"
        },
```

|  **Name**   | **Type** |                                           **Description**                                            |
|-------------|----------|------------------------------------------------------------------------------------------------------|
| `groupId`   | `object` | Must be a unique ID that identifies that group or entity                                             |
| `groupName` | `string` | The name of the group identified by Group ID that will be displayed to the user in the Connect Flow. |

## Multi-currency accounts {#multi-currency-accounts}

Multi-currency accounts are accounts that enable you to send and receive money in multiple currencies without dealing with exchange fees upfront. Although these multi-currency accounts have the same BBAN/IBAN, they can have different balances and transaction histories.

#### What this means for you. {#what-this-means-for-you}

If an account is a multi-currency account, you'll get multiple accounts with the same BBAN/IBAN. Therefore, you have to differentiate them by the currency. For a multi-currency account, the BBAN/IBAN isn't unique.
Note: If the account is not a multi-currency account, the BBAN/IBAN is still unique.

## Orphaned accounts {#orphaned-accounts}

Sometimes banks stop providing previously known accounts. When this happens, we call the account an orphaned account, and you will receive a [Webhook](https://developer.mastercard.com/open-finance-europe/documentation/unlicensed/aiia-data/event-notifications/index.md) notification. We see that previously known accounts that have been marked as orphaned accounts come back again. In these cases, you will receive another [Webhook](https://developer.mastercard.com/open-finance-europe/documentation/unlicensed/aiia-data/event-notifications/index.md).
There can be several reasons as to why banks stop providing us with a specific account. We have listed them here:

* Your agreement with the bank has stopped for a specific account.
* Your account has been changed from a private account to a business account or vice versa.
* Sometimes you need to give explicit consent in your bank. If you revoke that consent, the account will be marked as orphaned.
* In some cases, we need to move you from one bank API to another, and that API might not support that type of account.
* If an account gets a new BBAN or IBAN, the old account will be marked as orphaned.

Note: If an account is marked as orphaned, you will still be able to fetch old data, but we cannot fetch any new data from the bank!

#### What should you do when an account is marked as orphaned? {#what-should-you-do-when-an-account-is-marked-as-orphaned}

If you get the webhook saying that an account has been marked as orphaned, we cannot do much about it. We often see that an agreement with the bank has somehow changed. If this happens our recommendation is to send the end user through [Connect Flow](https://developer.mastercard.com/open-finance-europe/documentation/unlicensed/aiia-data/connect/connect-flow/index.md) again.

## Sync Status {#sync-status}

Since our synchronization is asynchronous, a way is needed to inform clients about the status of accounts/transactions synchronization. To do this, we introduced `syncStatus` property.

#### What does this mean? {#what-does-this-mean}

* **Queued:** Accounts with transactions are queued for synchronization, but have not started yet.
* **Updating:** Both accounts and transactions are being synchronized at the moment.
* **Failed:** Something went wrong updating the account or transactions.
* **Finished:** Synchronization for both accounts and transactions finished. The latest data is now available for the client.
