Account Aggregator Interoperability: Spring Boot AA Router
RBI mandates Account Aggregator interoperability by 31 Dec 2026. Build a multi-AA consent and FI-data router in Spring Boot with circuit breakers.

The RBI announced on 7 October 2026 that NBFC-Account Aggregators must be interoperable by 31 December 2026. Interoperability here means a customer registered with one AA can still approve a data pull from a bank or fund that is reachable through another. For anyone running lending or wealth software on top of AAs, that date turns a long-deferred ticket into a deadline. Below I cover what changes for a requester, then the router layer I would put in Spring Boot, with code, and the failure modes this kind of integration tends to produce.
I am writing for people who already know what a bank statement fetch looks like in code. The vocabulary is short: the FIU is you (the requester), the FIP holds the data, the AA carries consent and ciphertext between them. A consent request returns a handle; once the customer approves, you get a consent ID and use it to open a data session.
What changes on 31 December 2026
Today an AA is a mostly closed circle. A requester wired to one AA reaches the customers of that AA and the providers that AA integrated. Customers are addressed by a virtual user address, a VUA such as name@aaname, and the part after the @ names the AA that holds their consent UI. That detail matters later, because it already pins where approval happens.
Interoperability loosens the other side. The customer stays with their AA, but the providers behind it widen: a request can be satisfied from FIPs registered with other AAs. A separate thread I am tracking is deposit data flowing into the consolidated account statements produced via the SEBI-regulated depositories, with AA as one transport. One customer's money across banks, funds and shares then lands in a single view.
For a requester that is welcome and annoying at the same time. Coverage widens. But anything you wrote around one AA's quirks, such as its status codes, latency profile and the way it reports failure, now has to hold up against several AAs that disagree with each other. The European version of this problem is in my Open Banking and PSD2 API development write-up; the retry and consent-state ideas transfer almost unchanged, though India's intermediary model adds a hop that PSD2 does not have.
The legal frame you design inside
Two pieces of Indian regulation shape what an audit trail must contain. The RBI Master Direction on NBFC-Account Aggregators defines the AA's duties: it must not store or read the FI data it relays, and it must keep consent records. The Digital Personal Data Protection Act, 2023 introduces consent managers, registered entities that let people give, review and withdraw consent, and a lender processing the data is a data fiduciary with its own purpose-limitation and retention duties. In practice that means your system should be able to answer, for any stored statement, which consent authorised it, for what purpose, until when, and whether it was revoked. Design the data model for that question first; the router follows from it.
The shape of the fix: an AA-agnostic layer
Business code should say "six months of this customer's savings account transactions" and never learn which AA served it. Everything AA-specific hides behind a router.

Six components, in request order:
- AA registry: base URLs, signing keys, health, and per-AA behaviour flags.
- Consent router: picks the AA for a consent and pins the choice.
- Per-AA circuit breakers.
- FI-data fetcher: idempotent, decrypting, retry-safe.
- Notification gate: deduplicates consent and FI callbacks.
- Audit trail: append-only record of every consent event.
Components 1 and 2 are where AA specifics leak in, so they get the most care. Consent templates are versioned per AA and per purpose code, handles have AA-specific formats and lifetimes, and the VUA decides which AA owns the approval screen.
The API calls underneath are the ones in the ReBIT specification (I work from v2.0.0): POST /Consent to create a consent, GET /Consent/handle/{handle} to read its status, POST /FI/request to open a data session once approved, and GET /FI/fetch/{sessionId} to pull the encrypted payload. Inbound, the AA calls your /Consent/Notification and /FI/Notification endpoints. Every request body is signed, and the signature travels in the x-jws-signature header as a detached JWS. FI data is encrypted with ECDH on Curve25519: you send your public key material when requesting data, and decrypt with the matching private key.
Names in the code below are mine, not from any vendor SDK. I use Spring Boot, Java 21 records and Resilience4j.
Piece 1: the AA registry and the routing decision
The routing question deserves a straight answer, because the VUA already names an AA. So what is there to route? Three things:
- Which AA creates the consent. When you know the VUA, the default is its AA, since the customer approves inside that AA's app. Routing only chooses when the VUA is unknown at request time (onboarding by mobile number, for example) or when the pinned AA is unavailable and the product can tolerate a fresh prompt.
- Which AA fetches a given FIP's data. Interoperability makes more than one path to a provider possible; the registry tracks which AA reaches which FIP and how reliably.
- Where follow-up calls go. Once a consent is created, status checks, data requests and revocations all must return to the AA that issued it. That pinning is why the choice is stored.
A hard-coded base URL is the single-AA assumption in one line. Moving URLs into a table is the first step, and validate them on load: a registry row pointing at an internal address is an outbound-request hazard, and the Spring Boot 4.1 SSRF mitigation post covers the guardrails.
public record AaProfile(
String aaId, // e.g. "aa-alpha"
URI baseUri,
String webhookSecretRef,
String signingKeyRef, // key used for the x-jws-signature header
int priority, // lower wins
boolean enabled,
boolean errorsInOkBody, // this AA reports failures inside HTTP 200
Set<String> knownFipIds // FIPs reachable via this AA, may be stale
) {}
@Component
public class AaRegistry {
private final AtomicReference<Map<String, AaProfile>> snapshot =
new AtomicReference<>(Map.of());
@Scheduled(fixedDelayString = "PT60S")
void refresh() {
snapshot.set(loadFromDb().stream()
.collect(Collectors.toUnmodifiableMap(AaProfile::aaId, p -> p)));
}
public Optional<AaProfile> byId(String id) {
return Optional.ofNullable(snapshot.get().get(id));
}
/** Candidates ordered: the VUA's own AA first, then FIP reach, then priority. */
public List<AaProfile> candidatesFor(String vuaAaId, String fipId) {
return snapshot.get().values().stream()
.filter(AaProfile::enabled)
.sorted(Comparator
.comparing((AaProfile p) -> !p.aaId().equals(vuaAaId))
.thenComparing(p -> !p.knownFipIds().contains(fipId))
.thenComparingInt(AaProfile::priority))
.toList();
}
}
The snapshot is swapped atomically, so request threads never read a half-built map. The sort puts the VUA's AA first for the reason above, then prefers AAs known to reach the FIP.
The router walks that list, asks each AA's breaker for permission, and records the AA that accepted the consent.
@Service
public class ConsentRouter {
private final AaRegistry registry;
private final AaClientFactory clients;
private final CircuitBreakerRegistry breakers;
private final ConsentRepository consents;
private final ConsentAudit audit;
@Transactional
public ConsentTicket request(ConsentRequest req) {
// same business request twice -> same ticket
var existing = consents.findByClientRequestId(req.clientRequestId());
if (existing.isPresent()) return existing.get().toTicket();
RuntimeException last = null;
for (AaProfile aa : registry.candidatesFor(req.vuaAaId(), req.fipId())) {
var breaker = breakers.circuitBreaker("aa-" + aa.aaId());
try {
String handle = breaker.executeSupplier(
() -> clients.forAa(aa).createConsent(req));
var saved = consents.save(ConsentRecord.pending(req, aa.aaId(), handle));
audit.append(saved.id(), "CONSENT_REQUESTED", aa.aaId(), handle);
return saved.toTicket();
} catch (CallNotPermittedException open) {
audit.append(null, "AA_SKIPPED_BREAKER_OPEN", aa.aaId(), req.clientRequestId());
last = open;
} catch (AaTransientException e) {
last = e;
}
}
throw new NoAaAvailableException(req.clientRequestId(), last);
}
}
clientRequestId comes from my own caller and sits behind a unique index. If the UI double-submits, or a retry fires after a timeout, the second call returns the first ticket instead of minting another consent and sending the customer a second approval prompt. The same idea on the consumer side is covered in transactional outbox and idempotent consumers. One catch with failover: if AA one timed out after it had actually created the consent, trying AA two produces a duplicate in a different AA. I accept that only for consent creation, and I make the customer flow tolerate one orphan pending handle, which simply expires.
Piece 2: per-AA circuit breakers, not one global one
A circuit breaker rejects calls quickly once failures cross a threshold, instead of letting every thread queue behind a dying dependency, then lets a few probe calls through to see whether it recovered. One breaker for all AAs is a mistake: a bad AA would trip the switch for healthy ones. Name breakers per AA, and give them separate instances for consent calls and FI fetch, since fetch is slower and heavier.
resilience4j:
circuitbreaker:
configs:
aa-default:
slidingWindowType: COUNT_BASED
slidingWindowSize: 20
minimumNumberOfCalls: 10
failureRateThreshold: 50
slowCallDurationThreshold: 4s
slowCallRateThreshold: 60
waitDurationInOpenState: 30s
permittedNumberOfCallsInHalfOpenState: 3
recordExceptions:
- com.example.aa.AaTransientException
- java.io.IOException
ignoreExceptions:
- com.example.aa.AaRejectedRequestException # our bug, not their outage
Two details earn their keep. Count slow calls as failures, because an AA that answers in 9 seconds hurts you as much as one that errors. And do not count 4xx responses caused by your own malformed request as AA failures, otherwise a bad deploy on your side opens every breaker.
The client translation layer is where AA quirks get flattened. If a profile says errorsInOkBody, the client inspects the body of a 200 and throws AaTransientException or AaRejectedRequestException accordingly, so the breaker sees truth rather than status codes.
class AaHttpClient {
String createConsent(ConsentRequest req) {
String body = json.write(ConsentMapper.toAaPayload(req, profile));
var resp = http.post(profile.baseUri().resolve("/Consent"),
body, Map.of("x-jws-signature", signer.detached(profile, body)));
if (resp.status() >= 500 || resp.status() == 429) throw new AaTransientException(resp);
if (resp.status() >= 400) throw new AaRejectedRequestException(resp);
if (profile.errorsInOkBody() && resp.json().has("errorCode")) {
throw classify(resp.json().get("errorCode").asText());
}
return resp.json().get("ConsentHandle").asText();
}
}
Piece 3: the FI-data fetcher
After approval, the sequence is POST /FI/request (with your key material and the consent ID), then, once the AA signals readiness, GET /FI/fetch/{sessionId}. Two rules keep it safe:
- A session is not a retry unit for the same data. Store the session ID against the consent and a data-range key. Re-fetching the same session is fine; opening a new session per retry multiplies load on the FIP and can hit its rate limits.
- Decrypt late and hold nothing longer than the purpose allows. Persist ciphertext only if you need replay, keep the private key material in a KMS or HSM-backed store, and rotate per session rather than per month.
@Service
public class FiFetcher {
@Transactional
public FetchOutcome fetch(UUID consentId, DateRange range) {
var consent = consents.require(consentId);
var session = sessions.findByConsentAndRange(consentId, range)
.orElseGet(() -> openSession(consent, range));
var client = clients.forAa(registry.byId(consent.aaId()).orElseThrow());
var cipher = breakers.circuitBreaker("aa-fetch-" + consent.aaId())
.executeSupplier(() -> client.fetch(session.sessionId()));
var plain = crypto.decryptX25519(cipher, session.privateKeyRef());
audit.append(consentId, "FI_FETCHED", consent.aaId(), session.sessionId());
return FetchOutcome.of(plain);
}
}
Piece 4: notification gate
The AA tells you about consent status changes and FI readiness through callbacks, and delivery is at-least-once, so duplicates are normal rather than exceptional. Verify the signature first, then deduplicate on a key made from notification type plus the identifier it concerns plus the status. Insert into a table with a unique index and treat a constraint violation as "already handled", acknowledging with a success response either way, otherwise the AA retries forever.
@PostMapping("/aa/{aaId}/Consent/Notification")
ResponseEntity<Ack> consentNotification(@PathVariable String aaId,
@RequestHeader("x-jws-signature") String sig, @RequestBody String raw) {
verifier.verify(aaId, sig, raw); // reject before parsing
var n = parser.consent(raw);
String key = "CONSENT:" + n.consentHandle() + ":" + n.status();
if (!dedupe.firstTime(key)) return ResponseEntity.ok(Ack.ok(n));
outbox.publish("aa.consent.events", n.consentHandle(), n); // Kafka via outbox
audit.append(null, "CONSENT_" + n.status(), aaId, n.consentHandle());
return ResponseEntity.ok(Ack.ok(n));
}
Publishing through a transactional outbox keeps the dedupe row and the Kafka event atomic. Without it a crash between the two loses the event or double-sends it.
Piece 5: the audit trail
Make it append-only: no updates, no deletes, with a hash chain if your auditors want tamper evidence. Record the consent ID, AA, event type, timestamp, purpose code, template version and the actor. When the customer revokes consent, the same trail should show your downstream deletion or restriction of derived data. That is what answers the DPDP question from earlier.
Failure modes to design for
These are the cases I would write tests for before going live, because each one breaks a naive single-AA client:
- A 200 that is an error. The body carries an error code while the HTTP status says success. Without body inspection your breaker stays closed while every call fails.
- Consent stuck in PENDING. The customer approved, but the notification never arrived or was dropped. Poll
GET /Consent/handle/{handle}on a schedule with backoff and a hard stop at consent expiry, and do not rely on callbacks alone. - Duplicate notifications. Same status delivered twice, sometimes seconds apart. The dedupe key above handles it; processing twice usually means charging a customer twice for a bureau pull or running credit logic again.
- Key material expiry. Key pairs sent for a session carry an expiry, and fetching with stale keys fails in an unhelpful way. Track expiry on the session and open a new one instead of retrying.
- Clock skew on signed requests. JWS headers include timestamps, and an AA may reject a request when your clock drifts. Run NTP monitoring on the hosts and alert on drift before it turns into a wave of signature failures.
- Partial FI data. A session can return some FIPs' accounts and an error for others. Model per-account status instead of one success flag.
- Stale registry reach.
knownFipIdsgoes out of date as AAs add providers. Treat it as a hint and let observed success rates reorder candidates over time.
Rolling it out
Start by moving your current AA behind the router with a single registry row and no behaviour change; that exercises the abstraction against production traffic. Add the second AA in shadow mode, creating consents only for internal test users. Watch breaker metrics per AA (open count, slow-call rate, failover frequency) before routing real customers. Keep a kill switch per AA in the registry, because the enabled flag is the fastest incident lever you will have.
Takeaways
- Treat the date as a design deadline: the code change is the router, not an AA swap.
- The VUA already pins consent approval to an AA; routing is about fallback, FIP reach and pinning follow-up calls.
- Per-AA breakers, body-aware error classification and idempotent consent creation cover most of the pain.
- Build the audit trail to the DPDP and NBFC-AA standard from the first commit; retrofitting it is much harder.