> ## 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.

# Retrieve Account Data

> Call /GetAccountsDetail to retrieve account data, then handle the 202 polling flow or use webhooks.

After a customer connects their bank account through Flinks Connect, you retrieve their financial data by calling the `/GetAccountsDetail` endpoint. This page explains the full data retrieval flow.

## Prerequisites

Before calling `/GetAccountsDetail`, you need a valid `RequestId`. To obtain one:

1. Retrieve the `loginId` from the Flinks Connect [event listener](./flinks-connect/use-event-listener) or [redirect URL](./next-steps#save-your-loginids).
2. Call [`/Authorize`](../../api/authorize/endpoints/authorize) with the `loginId` to get a `RequestId`.

<Warning>
  Store the `loginId` on your server. The `loginId` does not expire and is required for future data retrieval. The `RequestId` is session-scoped and expires.
</Warning>

## Call /GetAccountsDetail

Send a `POST` request to [`/GetAccountsDetail`](../../api/connect/endpoints/account-linking/get-accounts-detail) with the `RequestId` in the body.

The endpoint returns account data including personal information, account details, and transaction history. See the [API reference](../../api/connect/endpoints/account-linking/get-accounts-detail#accounts-detail) for the full list of returned fields.

## Handle the response

`/GetAccountsDetail` returns one of two responses:

* **`200`** — Data is ready. The response contains the full account payload.
* **`202`** — Data is still processing. You must poll `/GetAccountsDetailAsync` to retrieve the data when it's ready.

A `202` response is expected on the initial call. Most requests finish processing within a few seconds.

## Poll /GetAccountsDetailAsync on 202

When you receive a `202` from `/GetAccountsDetail`:

1. Call [`/GetAccountsDetailAsync`](../../api/connect/endpoints/account-linking/get-accounts-detail-async) with the same `RequestId` as a path parameter. This is a `GET` request.
2. If the response is `202`, the data is still processing. Wait 10 seconds, then call `/GetAccountsDetailAsync` again.
3. Repeat until you receive a `200` response. The `200` response contains the same payload as a `200` from `/GetAccountsDetail`.
4. Set a maximum timeout of 30 minutes to avoid infinite polling loops.

<Note>
  `/GetAccountsDetailAsync` is not a separate data endpoint. It is the polling mechanism for `/GetAccountsDetail`. You only call it after receiving a `202` from `/GetAccountsDetail`.
</Note>

## Refresh account data

To fetch fresh data for an already-connected user, call `/Authorize` with `MostRecentCached` set to `false`. This triggers a live re-authorization with the financial institution instead of returning cached data.

```bash theme={null}
curl --request POST \
  --url https://yourinstance-api.private.fin.ag/v3/{customerId}/BankingServices/Authorize \
  --header 'Content-Type: application/json' \
  --header 'flinks-auth-key: {authorize_token}' \
  --data '{
    "LoginId": "your-login-id",
    "MostRecentCached": false,
    "Save": true
  }'
```

The response determines your next step:

* **`200`** — Re-authorization succeeded without MFA. Use the returned `RequestId` to call `/GetAccountsDetail` with polling, same as the [initial retrieval flow](#call-getaccountsdetail).
* **`203`** — MFA is required. The user must answer security questions before fresh data can be retrieved.

### Handle 203 MFA during refresh

When `/Authorize` returns `203` during a refresh, the user needs to complete MFA. How you handle this depends on your frontend:

**With Flinks Connect (iframe):** Relaunch the Flinks Connect iframe with the `requestId` from the 203 response and a fresh `authorizeToken`. Flinks Connect will present the MFA challenge to the user automatically.

```
https://yourinstance-iframe.private.fin.ag/v2/?requestId={requestId}&authorizeToken={freshToken}
```

After the user answers MFA, Flinks Connect fires a `REDIRECT` event with the `loginId`. Use the `loginId` to call `/Authorize` with `MostRecentCached: true`, then proceed to `/GetAccountsDetail`.

**With direct API integration:** Extract the `SecurityChallenges` from the 203 response, present them to the user, and call `/Authorize` again with the `RequestId` and `SecurityResponses`. See the [/Authorize API reference](../../api/authorize/endpoints/authorize) for the full request format.

<Note>
  Generate a **fresh** authorize token before relaunching Flinks Connect for MFA. The original token used for the `/Authorize` call has already been consumed — authorize tokens are single-use.
</Note>

## Alternative: use webhooks

Instead of polling `/GetAccountsDetailAsync`, you can configure a [webhook](../../api/connect/webhooks) to receive the data automatically when processing completes.

With webhooks, Flinks sends a `POST` callback to your endpoint containing the same payload as a `/GetAccountsDetail` `200` response. This eliminates the need for polling logic.

Webhook setup requires a ticket via [Flinks Support Portal](https://help.flinks.com/support/home). Webhooks cannot be tested in sandbox environments.

For more details, see the [Webhooks documentation](../../api/connect/webhooks).
