Quick Start: Bank Linking

Bank linking with the API, step by step: create a link, the cardholder signs in through Plaid, detect completion, link cards, keep connections healthy.

For: developers

Introduction

Bank linking unifies a cardholder's card and bank activity into one transaction stream. Once a cardholder connects their bank, the transactionmessage.created, transaction.created, and transaction.updated webhooks you already operate start carrying bank-side activity (fees, transfers, payroll, loan payments, foreign-exchange markup) in the same schema, on the same handlers. Card transactions on linked cards also settle earlier: hours after the swipe rather than days.

This page maps the whole journey end to end and links out to the detail. Each step is a real API call; the cardholder's only interaction is Plaid's hosted bank-connect flow.

Bank linking is available to every Astrada customer, for the bank countries listed under Providers. In the sandbox environment it works straight away; for production, ask your Astrada contact to turn it on for your account.

📘

The two-step model

Bank linking is bank-first. The cardholder connects their bank, and that alone enables bank-only events (fees, transfers, payroll…). Linking cards is a second, optional step that adds earlier settlement for card spend. Do it now, later, or never. The two are independent; see Linking Cards to Bank Accounts.

What you get

Connecting a bank gives you three things: bank-only events (fees, transfers, payroll), earlier settlement for linked cards, and cards enrolled from the bank connection (each credit account with a usable last 4 becomes a bank-feed card, announced by cardsubscription.created). All three arrive on the webhooks you already handle. The Bank Linking overview breaks down what each delivers; Bank Linking Webhooks & Events has the payloads.

Depository-account activity (payroll, transfers in and out) requires depository accounts to be linkable under your account's bank-linking policy. The system default offers credit-card accounts only; contact Astrada to widen it.

The flow at a glance

Steps

1. Authenticate

Get an access token for the Astrada API. All calls below use the sandbox, https://api.sandbox.astrada.co, with a token from Get a token; sandbox clients hold all three banking scopes. Production is the same calls on https://api.astrada.co. The TypeScript, Python and Java tabs below make the same calls with the backend SDKs, which get the token for you; astrada (TypeScript) and client (Python, Java) are made as in Log in. Bank linking uses three scopes:

ScopeCovers
banking:readEverything readable: list links, list bank accounts, check state.
banking:writeThe per-cardholder write surface: create links, link/unlink cards, re-authenticate a connection, disconnect an account.
banking:adminOperational and destructive actions: on-demand sync, delete.

See Authentication.

Register a webhook first

Register an endpoint for the subaccount before you create the link (POST /webhooks with its subaccountId, see Creating webhooks): events sent before the subaccount has a webhook are not delivered later. List the event types this page uses: banklink.completed, bankaccount.state_changed, cardsubscription.created, transaction.created and transaction.updated. Bank Linking Webhooks & Events lists the others.

2. Create a bank link

POST /bank-links with your own id for the link and the cardholder's subaccountId. The response carries a Plaid hostedLink you distribute to the cardholder; it is valid for 4 hours.

Prefer an embedded flow? SDK v2 runs this connect step for you.

POST /bank-links HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "id": "enroll-user-456",
  "subaccountId": "81e7c267-0927-4234-a2bd-78cef799de54"
}
curl -X POST https://api.sandbox.astrada.co/bank-links \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "enroll-user-456",
    "subaccountId": "81e7c267-0927-4234-a2bd-78cef799de54"
  }'
const bankLink = await astrada.bankLinks.create({
  id: 'enroll-user-456',
  subaccountId: '81e7c267-0927-4234-a2bd-78cef799de54',
});
console.log(bankLink.hostedLink);
bank_link = client.bank_links.create({
    "id": "enroll-user-456",
    "subaccountId": "81e7c267-0927-4234-a2bd-78cef799de54",
})
print(bank_link.hosted_link)
import co.astrada.client.model.BankLink;
import co.astrada.client.model.BankLinkCreateParams;
import java.util.UUID;

BankLink bankLink = client.bankLinks().create(new BankLinkCreateParams()
    .id("enroll-user-456")
    .subaccountId(UUID.fromString("81e7c267-0927-4234-a2bd-78cef799de54")));
System.out.println(bankLink.getHostedLink());
{
  "id": "enroll-user-456",
  "subaccountId": "81e7c267-0927-4234-a2bd-78cef799de54"
}
FieldTypeRequiredDescription
idstring (alphanumeric + _/-, ≤256)YesYour own key for the link. Map it back to your user/card row.
subaccountIdUUIDYesThe subaccount that routes events and scopes card linking.
filtersobjectNoOptional narrowing of the hosted session (e.g. accountTypes: ["credit"]). May only narrow your account's bank-linking policy; the system default is credit-card accounts only.
bin6stringNoFirst 6 digits captured before moving into the bank flow; attached to the created card when the completion has exactly one eligible candidate account. See Unified Card & Bank Feeds.
providerplaid or mastercardNoThe open-banking provider. Omitted, the subaccount's default applies (Plaid unless Astrada set another). See Providers.
countryCodestring (ISO 3166-1 alpha-3)NoThe bank's country, such as USA. Omitted, the subaccount's default applies (USA unless Astrada set another).
personaadmin or cardholderNoWhose bank login it is: the company's (admin, the default) or one person's (cardholder).
cardholderKeystring (1 to 256)NoWith persona: cardholder only: your stable, unguessable id for the person, so all their links share one owner.

language and consent are also accepted; every field is in the Create Bank Link reference.

Response (201 Created):

{
  "id": "enroll-user-456",
  "accountId": "d8fae7c0-0f5b-4d6b-8cce-71764e3f515f",
  "subaccountId": "81e7c267-0927-4234-a2bd-78cef799de54",
  "state": "pending",
  "hostedLink": "https://secure.plaid.com/link/lp9o97618r1r6p93oon62nr025950ro4s3",
  "linkExpiresAt": "2026-04-27T16:00:00Z",
  "createdAt": "2026-04-27T12:00:00Z"
}

3. The cardholder connects their bank

Distribute the hostedLink. The cardholder completes Plaid's hosted flow. There's no UI for you to build, and Astrada never sees their banking credentials. The clip below shows the whole window, including two short screens Plaid adds; the four stills after it are the main screens the cardholder walks through. Both name Astrada; to show your own name and logo there, see Your name in the bank window.

Clip: Plaid's bank window. The cardholder searches "Platypus", picks First Platypus Bank, signs in with the test username user_good and a password, ticks Plaid Credit Card on "Select accounts", presses Continue, passes Plaid's "Connect faster next time" offer with Finish without saving, and sees "Returning to Astrada".

The cardholder connects a test bank in Plaid's window, in sandbox (20 s).

a. Choose a bank

The cardholder searches for and selects their institution.

Plaid's bank search, where the cardholder picks their bank.

b. Sign in

Plaid collects the bank credentials and authenticates directly with the institution.

Plaid's sign-in screen for First Platypus Bank, the sandbox test bank: "Enter your First Platypus Bank credentials to connect your account to Astrada."

c. Select accounts

The cardholder chooses which accounts to share. By default the hosted session offers credit-card accounts only (accountTypes: [credit]); linking depository accounts (checking, savings) requires your account's bank-linking policy to be configured by Astrada. Contact your account manager to widen it.

Plaid's account list for First Platypus Bank, where the cardholder picks the account to share with Astrada.

This screen comes from a link that allowed every account type, so it lists checking, savings and other accounts. Under the default policy, only the credit card account is offered.

d. Done

Plaid confirms the connection and shows its success screen. You choose no return address: open the hostedLink in a new tab or window, and learn the result from step 4.

Plaid's success screen: "Your account has been successfully linked to Astrada."
🚧

Credentials never touch Astrada

The cardholder authenticates inside Plaid's UI. Plaid hands Astrada an opaque access token. The bank username and password never enter Astrada's systems. See Privacy below.

4. Detect completion

There are two ways to know the cardholder finished, and you can use either:

The webhook: banklink.completed

{
  "bankLinkId": "enroll-user-456",
  "bankAccounts": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "Chase Checking",
      "mask": "6789",
      "type": "checking",
      "cardIds": []
    },
    {
      "id": "f9e8d7c6-b5a4-3210-fedc-ba0987654321",
      "name": "Chase Freedom Card",
      "mask": "4001",
      "type": "credit",
      "cardIds": ["9e107d9d-372b-4d1a-9f4a-654321abcdef"],
      "cards": [
        {
          "id": "9e107d9d-372b-4d1a-9f4a-654321abcdef",
          "subscriptionId": "1b671a64-40d5-491e-99b0-da01ff1f3341",
          "last4digits": "4001",
          "network": null,
          "enrollmentType": "bank-feed"
        }
      ]
    }
  ],
  "eventType": "banklink.completed"
}

The checking account in this example appears only when your policy allows depository accounts.

It fires once per completion, listing every account discovered under the link in that single delivery. A retry repeats the same webhook-id.

Each account row carries its mask, normalized type, and the cards attached to it at completion:

FieldWhich cards
cardIdsEvery linked card, including already-enrolled cards matched by last 4
cards[]The cards created from the account

For each credit account that carries a usable last 4 that no card you already enrolled holds, completion creates a real card with an active bank-feed subscription. Each created card is announced by its own cardsubscription.created event (enrollmentType: "bank-feed", with a bankAccountId back-reference), once per created card.

🚧

Do not rely on the order

Treat banklink.completed and those cardsubscription.created events as independent: delivery order is not guaranteed.

Polling: GET /bank-links/{id}

This endpoint (scope banking:read) doubles as a completion detector:

  • If the cardholder finished but the webhook hasn't arrived, calling GET transitions the link to completed and returns the discovered accounts inline: the same bankAccounts array shown above, alongside state: "completed" and a completedAt.
  • If you GET a pending link whose linkExpiresAt has passed, it transparently issues a fresh hostedLink. Left unread for 72 hours after that, the link is marked expired (see Get Bank Link).

At this point bank-only events already fire on the connected accounts. Read the full account records (including the cardIds currently linked to each) with GET /bank-accounts?subaccountId={subaccountId}.

5. Link cards for earlier settlement (optional)

Linking a card to a bank account is what turns on earlier settlement for that card. In most integrations you don't have to do anything: card links are established automatically, by one rule applied in two places. At bank-link completion, an already-enrolled card whose last 4 digits match a credit account's mask is linked immediately when the match is exactly one-to-one. After that, the same check re-runs every few hours for any account that still has no card, so a card you enroll later is linked on the next pass.

To pre-link a card before any spend exists, or to correct an assignment, call PATCH /bank-accounts/{id} with the desired cardIds:

PATCH /bank-accounts/a1b2c3d4-e5f6-7890-abcd-ef1234567890 HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "cardIds": ["5dec2c49-0aa5-4683-a317-427eb5d115f3"]
}
curl -X PATCH https://api.sandbox.astrada.co/bank-accounts/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cardIds": ["5dec2c49-0aa5-4683-a317-427eb5d115f3"]
  }'
await astrada.bankAccounts.update('a1b2c3d4-e5f6-7890-abcd-ef1234567890', {
  cardIds: ['5dec2c49-0aa5-4683-a317-427eb5d115f3'],
});
client.bank_accounts.update(
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    {"cardIds": ["5dec2c49-0aa5-4683-a317-427eb5d115f3"]},
)
import co.astrada.client.model.BankAccountCardsUpdate;
import java.util.Arrays;
import java.util.UUID;

client.bankAccounts().update(UUID.fromString("a1b2c3d4-e5f6-7890-abcd-ef1234567890"),
    new BankAccountCardsUpdate()
        .cardIds(Arrays.asList(UUID.fromString("5dec2c49-0aa5-4683-a317-427eb5d115f3"))));
{
  "cardIds": ["5dec2c49-0aa5-4683-a317-427eb5d115f3"]
}

Multi-card linking, backfill, and the linking constraints (a card links to one account at a time, etc.) are covered in Linking Cards to Bank Accounts.

📘

Bank-only mode

You can skip card linking entirely and use bank linking as a standalone bank-data source. Completion still creates a card for each credit account with a usable last 4 (announced by cardsubscription.created), and every bank transaction surfaces (as banktransaction.created and a SETTLED transaction.created), but you won't receive card authorizations or transaction.match.created. See Bank-only mode.

6. Receive events

From here, bank activity arrives on the webhooks you registered in step 1. A payroll deposit arrives as a transaction.created; a linked card's swipe settles early as a transaction.updated. See Bank Linking Webhooks & Events for every event and its payload.

Keep connections healthy

Plaid connections occasionally need re-authentication: a changed bank password, an expiring consent, or the bank asking for a new one-time code. When that happens the bank account's state changes to auth_required, a bankaccount.state_changed webhook fires with the reason, and bank-driven events stop for that account until the cardholder re-connects.

  • Detect it: subscribe to bankaccount.state_changed, or poll GET /bank-accounts?state=auth_required (hourly is plenty).
  • Fix it: POST /bank-accounts/{id}/refresh (scope banking:write, re-auth is customer self-serve) returns a fresh Plaid update-mode hosted link. The cardholder completes the same Plaid flow to re-authenticate; the bank account ID stays the same and events resume on the next sync.
  • When it can't be fixed: if the connection is revoked or gone for good, the account goes to disconnected instead. Refresh won't recover it, so you disconnect it and re-enroll with a new bank link.

Disconnect a connection

When a cardholder opts out, stop the feed with PATCH /bank-accounts/{id} and { "state": "disconnected" } (scope banking:write); the account and its transactions stay readable. To delete the data as well, or to clear a disconnected connection before re-enrolling, use one of these calls (scope banking:admin):

  • Remove the whole connection: DELETE /bank-links/{id} ends the connection at Plaid and deletes its bank accounts and their transactions. Returns 204 No Content.
  • Remove a single account: DELETE /bank-accounts/{id} drops one bank account and its transactions while leaving the rest of the connection intact. Returns 204 No Content.
📘

On-demand sync

Bank data syncs on its own (once when the link completes, then on Plaid's update webhooks), so you rarely pull by hand. When you need data now (for example, reconciling right after a known deposit), POST /bank-links/{id}/sync (scope banking:admin) forces a sync immediately. To ask the bank itself to check for new transactions instead of waiting for its schedule, use POST /bank-accounts/{id}/transactions/refresh (scope banking:admin, charged per successful call). POST /bank-accounts/{id}/refresh is only for an account that needs the cardholder to sign in again.

Privacy

Three guarantees, each with a concrete control:

  • Astrada never stores Plaid credentials. The cardholder authenticates inside Plaid's hosted UI; Astrada holds only the opaque access token Plaid returns.
  • Account numbers are stored only as a short mask. Every bank account exposes mask (typically the last 4 digits). The full account number and routing number are not stored, logged, or returned in any payload.
  • Events stay in their subaccount. Events go only to webhooks registered for the link's subaccountId, never to another subaccount's.

With an SDK, cards created from a bank link need no consent record from you: the cardholder gives consent in the bank connection, and the SDK records which consent text the bank-connect screen showed. A direct API integration sends that record itself, as consent on POST /bank-links (or on PATCH /bank-links/{id} while the link is pending); without it Astrada keeps no consent record for those cards. Astrada relays that record to each card subscription the bank link creates, and for a Plaid connection adds the Plaid Link session. Consent never blocks a card created from a bank link: the record is kept unless the subaccount's consent policy is off.

Next steps


Did this page help you?