Unified Card & Bank Feeds
One card model for card-number, bulk and bank enrollment: when cards are created, the two card lists on a bank account, and what happens in each order.
For: developers
Introduction
Astrada represents every enrolled card the same way, whether it is a Visa, Mastercard, or American Express card: a card with a durable cardId, a card subscription that announces the enrollment, and transactions that carry that cardId. What differs per network is the transport:
- Visa and Mastercard data travels over direct network connections.
- American Express data typically travels through a bank connection that the cardholder authorizes.
This page explains which way of enrolling serves which network, what data each one delivers, and why the order in which cards and bank connections arrive does not change what you build.
Assign cards to cardholders before the first transaction, however they enrollCompleting a bank link connects the account and also creates cards. For each credit account it discovers that carries a usable last 4 that no card you already enrolled holds, Astrada creates a real card, with a real
cardIdand an active card subscription, at completion time. You can assign thatcardIdto the right cardholder in your system immediately, before any transaction exists.
The model
Three resources are involved (field-level detail: Core Resources):
- Card is the durable identity. Its
cardIdis what every transaction references, however the card was enrolled, for the card's lifetime. - Card subscription is created once per enrollment and announced by the
cardsubscription.createdwebhook. ItsenrollmentTyperecords how the enrollment happened:cardholder-single(the cardholder entered the number),network-bulk(captured from the network's data sources), orbank-feed(created from a bank connection). Everything else about the contract is the same. - Bank account is a connected account at a financial institution, created when a bank link completes. For
creditaccounts, itsmaskis the card number's last 4.
The two card lists on a bank account
A bank account response lists cards in two places, and they answer different questions.
cardIds | cards[] | |
|---|---|---|
| The question it answers | Which cards are linked to this account? | Which created bank-feed cards are currently linked to this account? |
| How a card gets in | A card gets linked when its last 4 digits match the account's mask, applied at bank-link completion and by a scheduled sweep that re-checks each cardless credit account every few hours, or when you link it manually via PATCH. | When a bank link completes and a credit account has a usable last 4 that no card you already enrolled holds, Astrada creates a card from that account, and it appears here together with its subscription. |
| Which cards | Linked cards can come from any way of enrolling. A card that was matched or manually linked shows up in cardIds only. | A created card is also linked to its own account, so it shows up in both lists. |
cards[] reflects the current link, not a permanent record: clearing it (see Linking Cards to Bank Accounts) removes the card from cards[], though the card and its bank-feed subscription continue to exist.
Two credit accounts that share a mask at the same institution get one card between them, and that single card links to one of the two accounts (a card links to at most one account at a time); the other account carries no card link.
A credit account behind an American Express connection reads like this:
{
"id": "059d5e6a-cfb1-46e6-ab84-6586582b6b58",
"subaccountId": "6103874b-248d-4825-af88-a0d24dd9b123",
"bankLinkId": "enrollment_amex_7f2c",
"institutionName": "American Express",
"institutionId": "ins_10",
"name": "Platinum Card",
"type": "credit",
"mask": "1005",
"currency": "USD",
"state": "active",
"cardIds": [
"9e107d9d-372b-4d1a-9f4a-654321abcdef"
],
"cards": [
{
"id": "9e107d9d-372b-4d1a-9f4a-654321abcdef",
"subscriptionId": "1b671a64-40d5-491e-99b0-da01ff1f3341",
"last4digits": "1005",
"network": "amex",
"enrollmentType": "bank-feed"
}
]
}The card's last4digits is always the account's mask, and network is set when the institution implies it (as it does here).
Which way to enroll each network
| How the card is enrolled | Networks | How enrollment starts | enrollmentType | Transaction data you receive |
|---|---|---|---|---|
| Single card enrollment | Visa, Mastercard | The cardholder enters their card number; 3DS verification activates the subscription. SDK v2: Quick Start | cardholder-single | Real-time authorizations as the cardholder spends, followed by the settlement. Fields include amount and currency, merchant name, category (MCC), and location. |
| Network bulk feed | Visa, Mastercard, American Express (eligible corporate programs) | A whole card program is captured from the network's data sources (for example Mastercard's commercial card data feed). Many cards at once, no cardholder interaction. | network-bulk | The same transaction contract, delivered from the network's feed. Cardholder records (name, employee ID) arrive populated when the program's feed carries them. |
| Bank-connection enrollment | American Express; Visa and other networks when the subaccount's bankEnrollment allows it ("amex-visa" or "on", see Bank Linking) | The cardholder connects the account behind their card through the hosted bank-linking flow; completion creates a card per credit account that exposes a usable last 4. Quick Start: Bank Linking | bank-feed | Settled transactions from the bank connection. Fields include amount, merchant name, dates, and category. No real-time authorization stream. |
Pick the entry point per network; everything downstream is shared. For Visa and Mastercard, enroll by card number (POST /card-subscriptions, see SDK v2: Quick Start) or by bulk feed at the program level. For American Express, create a bank link (POST /bank-links) and let the cardholder connect the account behind the card. SDK v2 detects the network and routes this automatically in one embedded flow.
The three orderings
Cards and bank connections can arrive in any order. Each ordering ends in the same state: one cardId per card, one subscription per enrollment, one transaction stream. None of them needs special handling. Here is what happens in each.
Bank first: connect, then assign
Create the bank link. For an American Express enrollment, narrow the hosted session to credit accounts, and pass the first 6 digits if your enrollment UI captured them before moving from card entry into the bank flow (they are attached to the created card when the completion has exactly one eligible candidate account):
POST /bank-links HTTP/1.1
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{
"id": "enrollment_amex_7f2c",
"subaccountId": "6103874b-248d-4825-af88-a0d24dd9b123",
"filters": { "accountTypes": ["credit"] },
"bin6": "371449"
}curl -X POST https://api.sandbox.astrada.co/bank-links \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "enrollment_amex_7f2c",
"subaccountId": "6103874b-248d-4825-af88-a0d24dd9b123",
"filters": { "accountTypes": ["credit"] },
"bin6": "371449"
}'{
"id": "enrollment_amex_7f2c",
"subaccountId": "6103874b-248d-4825-af88-a0d24dd9b123",
"filters": { "accountTypes": ["credit"] },
"bin6": "371449"
}The cardholder completes the hosted flow (see Quick Start: Bank Linking). At completion, each discovered credit account that carries a usable last 4 that no card you already enrolled holds creates a card: a real cardId plus an active bank-feed subscription, before any transaction exists.
Two webhooks tell you about it; treat them as independent, since delivery order is not guaranteed. banklink.completed fires exactly once for the completion, announcing the connection with each account's mask, type, and cards, including the created ones. One delivery carries every account, so there are no duplicate completion events to coalesce:
{
"bankLinkId": "enrollment_amex_7f2c",
"bankAccounts": [
{
"id": "059d5e6a-cfb1-46e6-ab84-6586582b6b58",
"name": "Platinum Card",
"mask": "1005",
"type": "credit",
"cardIds": ["9e107d9d-372b-4d1a-9f4a-654321abcdef"],
"cards": [
{
"id": "9e107d9d-372b-4d1a-9f4a-654321abcdef",
"subscriptionId": "1b671a64-40d5-491e-99b0-da01ff1f3341",
"last4digits": "1005",
"network": "amex",
"enrollmentType": "bank-feed"
}
]
}
]
}And cardsubscription.created fires for each created card. It is the same event every other way of enrolling sends, with enrollmentType: "bank-feed" and a bankAccountId reference back to the source account:
{
"_links": {
"card": { "href": "/cards/9e107d9d-372b-4d1a-9f4a-654321abcdef" },
"bankAccount": { "href": "/bank-accounts/059d5e6a-cfb1-46e6-ab84-6586582b6b58" },
"self": { "href": "/card-subscriptions/1b671a64-40d5-491e-99b0-da01ff1f3341" }
},
"cardId": "9e107d9d-372b-4d1a-9f4a-654321abcdef",
"enrollmentType": "bank-feed",
"bankAccountId": "059d5e6a-cfb1-46e6-ab84-6586582b6b58",
"networkBulkFeedId": null,
"id": "1b671a64-40d5-491e-99b0-da01ff1f3341",
"state": "active",
"subaccountId": "6103874b-248d-4825-af88-a0d24dd9b123",
"createdAt": "2026-07-14T12:00:00.000Z",
"effectiveDate": "2026-07-14T12:00:00.000Z",
"expirationDate": "2099-12-31T23:59:59.999Z",
"customerReferenceId": null,
"updatedAt": "2026-07-14T12:00:00.000Z"
}The expirationDate above (2099-12-31) is a placeholder on bank-feed subscriptions until a real card enrollment supplies the true expiry; see Bank first, card enrolled later.
Assign the cardId to your cardholder now. The card and its subscription exist before the first swipe, so every transaction that arrives later is already attributed to the right person.
Card first, bank connected later
If a card is already enrolled when its bank connection completes, the account resolves to the existing card instead of creating a duplicate identity. At completion, each discovered credit account's mask is compared against the subaccount's enrolled cards:
- The card is linked when its last 4 match exactly one way.
- When several cards share the mask, evidence from each card's number (the issuing bank it implies versus the connected institution, and its funding type) may single out the one plausible card.
- Anything still ambiguous, or a mask claimed by more than one active account, links nothing rather than risk a wrong merge.
What happens next depends on what that mask matched:
- If none of those matches is a card you've already enrolled, the account gets its own
bank-feedcard so its feed still has an identity, and the scheduled mask sweep remains the backstop for the enrolled cards. - If the mask matched a card you've already enrolled, no
bank-feedcard is created: the account uses the card you enrolled. Astrada does not create a second card for one you already enrolled.
The completed bank link shows the result on its account summaries:
{
"id": "enrollment_9d21",
"state": "completed",
"completedAt": "2026-07-14T12:00:00.000Z",
"bankAccounts": [
{
"id": "3a8f2c1d-5e7b-4d9a-b6c8-9f0e1d2a3b4c",
"name": "Corporate Card",
"type": "credit",
"mask": "4001",
"cardIds": ["5dec2c49-0aa5-4683-a317-427eb5d115f3"]
}
]
}The enrolled card's data keeps flowing exactly as before: same cardId, same subscription, same stream. What the link adds is bank-side evidence for that card's spend, which enables matching and earlier settlement, per Linking Cards to Bank Accounts.
Bank first, card enrolled later
The reverse order works too. If a card that was created from a bank connection is later enrolled by its card number (or delivered in a bulk feed), the enrollment resolves to the same cardId: the card is upgraded in place, not duplicated. The merge is deliberately conservative: it happens when the enrollment matches exactly one bank-derived card (same last 4, compatible network), and anything ambiguous keeps separate cards, because two identities are correctable and a wrong merge is not.
Because that card already has a bank-feed subscription, the enrollment upgrades that subscription in place rather than creating a second one. It keeps the same subscription id and its bankAccountId, its enrollmentType becomes cardholder-single, and its state moves to reqSCA. It announces itself with a cardsubscription.updated for the existing subscription, not a second cardsubscription.created:
{
"_links": {
"card": { "href": "/cards/9e107d9d-372b-4d1a-9f4a-654321abcdef" },
"bankAccount": { "href": "/bank-accounts/059d5e6a-cfb1-46e6-ab84-6586582b6b58" },
"self": { "href": "/card-subscriptions/1b671a64-40d5-491e-99b0-da01ff1f3341" }
},
"cardId": "9e107d9d-372b-4d1a-9f4a-654321abcdef",
"enrollmentType": "cardholder-single",
"bankAccountId": "059d5e6a-cfb1-46e6-ab84-6586582b6b58",
"networkBulkFeedId": null,
"id": "1b671a64-40d5-491e-99b0-da01ff1f3341",
"state": "reqSCA",
"subaccountId": "6103874b-248d-4825-af88-a0d24dd9b123",
"createdAt": "2026-07-14T12:00:00.000Z",
"effectiveDate": "2026-07-14T12:00:00.000Z",
"expirationDate": "2027-07-14T12:00:00.000Z",
"customerReferenceId": null,
"updatedAt": "2026-07-15T09:30:00.000Z"
}What changes: the card fills in the facts only the new way of enrolling can supply (network where it was null, the first 6 digits), and once the upgraded subscription activates, that enrollment's data begins. For a card-number enrollment that means the real-time authorization stream. What does not change: the cardId, the bank feed (which keeps flowing), and every reference you have stored. Richer data starts arriving under the identity you already assigned, with no re-integration and no deduplication on your side. This is also what happens if American Express single enrollment becomes available later: nothing to prepare for.
Reconnecting the same bank
On a company link, you get the same cardId back. A bank-derived card is keyed on the bank account's stable identity (the connected institution and the account's last 4 digits within the subaccount), not on the individual connection. So if a cardholder disconnects and links the same bank again, or the connection is re-authorized after it expires, the credit account resolves to the card you already stored rather than creating a duplicate. Your card-to-cardholder mapping stands, the bank feed resumes under the same identity, and there is nothing to re-map or deduplicate.
Two details on a company link:
- After a fresh link, the old, disconnected bank account can still list the card in
cardIds, so the samecardIdcan appear on two bank accounts. The card'sbank-feedsubscription points to the new account. - Two American Express cards under one login that share a last 4 each get their own card. Do not count on the same
cardIdfor that pair after a fresh link.
A company link is one created from an admin page, or by POST /bank-links without persona. A link from an employee page (persona: "cardholder") has an owner of its own, and two bank accounts resolve to the same card only when their links have the same owner:
- Employee links created with the same
cardholderKeyshare an owner. - An employee link without a
cardholderKeyis its own owner, so a fresh link from that page creates a new card. SDK v2 sends nocardholderKey. - Re-authorizing a link after it expires keeps its card, because the link and its accounts do not change.
If you store data by cardId and your employees link from their own pages through the SDK, expect a new cardId when one of them disconnects and links again.
Transactions
Every transaction on an enrolled card, however it was enrolled, carries the cardId (and a _links.card reference); bank-sourced activity on an account with no card is the one exception, covered in Event Types. One attribution model covers the whole stream. By way of enrolling:
- Single card enrollment: network messages (authorization, advice, reversal) arrive keyed to the enrolled card and aggregate into its transactions.
transactionmessage.createdandtransaction.created/transaction.updatedall carry thecardId. - Network bulk feed: the network's feed delivers each transaction already attributed to its bulk-enrolled card. Handling is identical to single enrollment; only the subscription's
enrollmentTypediffers. - Bank-connection enrollment: postings sync from the connection and surface as bank-sourced transaction messages attributed to the account's card, aggregating into SETTLED transactions with that
cardId. Payload markers for bank-sourced activity (thebankDatablock,bank_-prefixed references) are covered in Event Types.
When one account carries several physical cardsWith a bank connection, the institution decides how finely cards are split. Most card institutions expose one credit account per card, each with its own last 4, so each physical card gets its own created card. When an institution combines multiple physical cards into a single account, the connection carries one card identity per account: transactions attribute to that account's card, not to each piece of plastic. The account's
maskis not guaranteed to be per-card in that case. An account that exposes no usable last 4 gets no created card at all: its postings remain available as bank transactions but do not join the card-attributed stream.
Integrating
The whole model above is consumable with webhooks plus REST. Register for the events with POST /webhooks (see Webhooks), then:
- Watch
cardsubscription.created. It is the enrollment signal for every way of enrolling and fires once per enrollment: a card-number enrollment produces one, a bulk feed produces one per card in the program, and a completed bank link produces one per created card. There is no separate event type for bank-derived cards;enrollmentType: "bank-feed"on this event marks a card from a bank connection. - Expect one
banklink.completedper completion. A finished bank link delivers a single completion event that lists every account it discovered and every card it created. Key it bybankLinkId; there are no duplicates to merge. - Store
cardIdas your durable key. Assign it to your cardholder as soon as the event arrives. Subscriptions come and go (re-enrollment creates a new one for the same card), but the card's identity stays the same whichever way it is enrolled next. - Treat
enrollmentTypeas display metadata. It is useful for labeling and analytics, never for control flow. The payloads differ only in their back-references (networkBulkFeedIdfor bulk,bankAccountIdfor bank-feed) and initialstate: a bank-feed subscription startsactive, while a card-number enrollment starts atreqSCAuntil 3DS completes.
Because every way of enrolling shares these events, one handler covers all of them. You need no different webhook handling per way of enrolling. Switch on the event type and read enrollmentType as a label, never a branch:
// One endpoint for every way of enrolling. Register it once with POST /webhooks.
// eventType comes from the `webhook-event-type` header on each delivery.
export function handleAstradaWebhook(eventType, body) {
switch (eventType) {
case "cardsubscription.created": {
// Fires once per enrollment, however the card enrolled. The card already exists,
// so assign it to your cardholder now, before the first transaction.
// enrollmentType is "cardholder-single" | "network-bulk" | "bank-feed";
// read it for labels/analytics, don't branch your logic on it.
assignCardToCardholder(body.cardId);
break;
}
case "banklink.completed": {
// Exactly one per completed link, carrying every account and the
// cards created from them. No duplicate completions to coalesce.
for (const account of body.bankAccounts) {
for (const card of account.cards ?? []) {
assignCardToCardholder(card.id); // same mapping as above
}
}
break;
}
// transaction.created / transaction.updated carry the same cardId. Attribute by it.
}
}For the step-by-step walkthrough of these calls and events in a working integration, see Getting Started.
Updated 5 days ago
