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

# Continuous Bank Feed for Accounting: Balances and Transactions

> Build a daily feed of balances and transactions for each of your clients: ongoing link, webhooks, change feed with a cursor, reset, consent end, stopping.

A continuous bank feed gives an accounting or bookkeeping product the balances and transactions of each client's bank accounts every day, without the client signing in again.
With Didit you create a link with ongoing access, receive webhooks when new data arrives, read only what changed with a cursor, watch when the consent ends, and stop or delete when the client leaves.

This guide takes you from zero to a daily feed for one client.
The same code runs for every client: one connection per client and bank.

## What you need

* An API key with the bank data permission, for your sandbox application. See the [quickstart](https://docs.didit.me/core-technology/bank-verification/quickstart.md#step-1-create-an-api-key-with-the-bank-data-permission).
* A webhook destination that receives the `bank.*` events. See [Bank webhooks](https://docs.didit.me/core-technology/bank-verification/webhooks.md).
* A table in your database for each client's connection id, change feed cursor and consent end.

## Step 1: create a link with ongoing access

```bash theme={null}
curl -X POST https://verification.didit.me/v3/bank/links/ \
  -H "x-api-key: $DIDIT_API_KEY" -H "content-type: application/json" \
  -d '{
    "access": "ongoing",
    "country": "ESP",
    "segment": "business",
    "data": ["accounts", "balances", "transactions"],
    "history_from": "2026-01-01",
    "consent_days": 180,
    "ownership": { "compare": "none" },
    "end_user": { "reference": "client-7731", "email": "ana@example.com" },
    "redirect_url": "http://localhost:3000/bank/return",
    "vendor_data": "client-7731"
  }'
```

* `access: ongoing` keeps access open until the consent ends. `consent_days` is a request: the bank decides the real date, shown on the connection.
* `history_from` asks for history from a date, for example the start of the year. Use `history_days` (1 to 365) instead if you prefer, never both. The bank may deliver less: each account reports `history_coverage`.
* `ownership.compare: none` skips the holder comparison, so no reference identity is needed. Use `business` to compare the holder with a company verified in Didit.
* `end_user.reference` is your id for the client. It is searchable and lets Didit recognise the same client connecting the same accounts again.
* Send the client to the [hosted page](https://docs.didit.me/integration/bank-link/hosted-link.md) and return them to your product with a [redirect URL](https://docs.didit.me/integration/bank-link/return-to-your-site.md).

Store the link `id` with the client.

## Step 2: wait for the connection

When the client finishes, `bank.link.completed` arrives with the `connection_id`.
Confirm it, as the browser is never trusted:

```bash theme={null}
curl https://verification.didit.me/v3/bank/links/$LINK_ID/ -H "x-api-key: $DIDIT_API_KEY"
```

Save the `connection_id` and wait for `bank.connection.created`: the accounts, balances and recent transactions are then readable (`sync.initial_status` is `succeeded` or `partial`).
`bank.connection.history_complete` follows when the backfill ends.
For each account, `history_coverage.oldest_booking_date` says how far back the bank really delivered.

## Step 3: load the first copy

An empty cursor returns every current transaction as `added` with `reset: true`.
Page through it and store the cursor only at the end:

```bash theme={null}
curl "https://verification.didit.me/v3/bank/connections/$CONNECTION_ID/transactions/sync/?limit=500" \
  -H "x-api-key: $DIDIT_API_KEY"
```

```python theme={null}
cursor, page_token = stored_cursor or "", None
while True:
    params = {"limit": 500, "page_token": page_token} if page_token else {"cursor": cursor, "limit": 500}
    page = get(f"/v3/bank/connections/{connection_id}/transactions/sync/", params)
    if page["reset"] and not page_token:
        wipe_local_copy(connection_id)       # replace, never append
    apply(page["added"], page["modified"], page["removed"])
    if not page["has_more"]:
        store_cursor(connection_id, page["next_cursor"])
        break
    page_token = page["next_page_token"]
```

* The first read is a true snapshot: it returns every transaction the connection had when the read started, each exactly once as `added`, in its current state, even if a sync runs while you page.
* Changes made while you were paging arrive in the next read from `next_cursor`: a transaction you already received comes again as `modified`, and a new one as `added`.
* Store `next_cursor` only after a response with `has_more: false`.
* If paging fails midway, restart from the cursor you stored.
* Read balances with `GET /v3/bank/accounts/{account_id}/balances/`.

## Step 4: stay current on every webhook

Didit syncs every active ongoing connection automatically between one and four times a day, depending on the bank (`sync.frequency_per_day`).
When a sync stores changes, `bank.data.updated` arrives with the `connection_id`, the `account_ids` and the counts.
Call the change feed with your stored cursor:

* `added` are new transactions, including pending ones.
* `modified` are transactions that changed, in their current state. Apply each as an upsert by `id`: one you already hold is updated, and one you do not hold yet is added.
* `removed` carry a `reason`. Ignore an `id` you do not have. When a pending transaction is booked, it leaves in `removed` with `pending_booked` and the booked one arrives in `added`.

Use the transaction `id` as your key: it stays the same across reads, syncs and renewals.
Check `identity_quality`: with `derived`, a bank correction can appear as one `removed` and one `added`.
Reads never bill, but the data only changes when a sync runs, so one read per webhook is enough.
To fetch sooner, use Sync Now: [Refresh bank data on demand](https://docs.didit.me/use-cases/refresh-bank-data-on-demand.md).

## Step 5: handle reset

A cursor older than the replay window answers `410 cursor_expired` with `bootstrap: true`.
The change log is replayable for 90 days, so this is rare for a daily job.
Start again from an empty cursor, and replace your copy with the result instead of adding to it.
Every read from an empty cursor carries `reset: true`, so the same code path handles a new connection and an expired cursor.

## Step 6: watch the consent end

The consent has an end date: `consent.expires_at`.
Didit sends `bank.connection.consent_expiring` 14, 7 and 1 day before it.

Call [`renew_connection`](https://docs.didit.me/standalone-apis/bank-connection-renew) when you want to renew: it answers `409 renewal_not_needed` until 30 days are left.
The page where the client completes a renewal is not available yet.

If the client lets it lapse, the connection is `renewal_required`: you can still read what was synced.
Details are in [Renew a bank consent](https://docs.didit.me/use-cases/renew-bank-consent.md).

## Step 7: stop access and delete

* The client leaves your product: call [`revoke_connection`](https://docs.didit.me/standalone-apis/bank-connection-revoke) to stop reading at once, or [`delete_connection`](https://docs.didit.me/standalone-apis/bank-connection-delete) to stop and delete the stored data.
* The client stops sharing at the bank: `bank.connection.revoked` arrives with `ended_by`. Stop your feed for that connection.

## Price

Ongoing access is billed per active connection per month.
The price includes every account of the connection, balances, transactions, up to 365 days of history where the bank delivers it, the automatic syncs, live syncs within the bank's limits, renewals, webhooks and all reads.
A link nobody completes is free, and so are `renewal_required`, `paused` and `revoked` connections.
See [pricing](https://docs.didit.me/getting-started/bank-verification-pricing.md#bank-data-and-ongoing-access).

## Checklist

* [ ] One connection per client and bank, stored with its cursor and consent end.
* [ ] Webhook handler idempotent, keyed on the event id.
* [ ] `reset: true` replaces your copy, never appends.
* [ ] `removed` handled, with its reason.
* [ ] Consent reminders wired to your own notice to the client.
* [ ] `bank.connection.revoked` stops the feed.
* [ ] The sandbox plan in [Sandbox](https://docs.didit.me/core-technology/bank-verification/sandbox.md#a-good-test-plan) passes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.