Skip to main content
The Banking API provides endpoints to connect bank accounts through multiple providers (Plaid, GoCardless, EnableBanking), manage connections, and retrieve account data.

Plaid Integration

Create a Plaid Link token to initialize the Plaid Link flow for connecting bank accounts.
language
string
The language code for the Plaid Link interface (e.g., “en”, “es”)
accessToken
string
Existing access token for re-authentication or update mode
data
object
import { trpc } from '@/lib/trpc';

const { data } = await trpc.banking.plaidLink.mutate({
  language: 'en',
});

// Use link_token to initialize Plaid Link

plaidExchange

Exchange a Plaid public token for an access token after user completes the Link flow.
token
string
required
The public token received from Plaid Link onSuccess callback
data
object
const { data } = await trpc.banking.plaidExchange.mutate({
  token: publicToken,
});

console.log('Access token:', data.access_token);

GoCardless Integration

Build a GoCardless Link URL to initiate the bank connection flow.
institutionId
string
required
The GoCardless institution ID
agreement
string
End user agreement ID if already created
redirect
string
required
The redirect URL after completing the flow
data
object
const { data } = await trpc.banking.gocardlessLink.mutate({
  institutionId: 'SANDBOXFINANCE_SFIN0000',
  redirect: 'https://app.example.com/banking/callback',
});

window.location.href = data.link;

gocardlessAgreement

Create an end user agreement for GoCardless.
institutionId
string
required
The GoCardless institution ID
maxHistoricalDays
number
Maximum number of historical days to fetch (default: 90)
accessValidForDays
number
Number of days the access is valid (default: 90)
data
object

EnableBanking Integration

Create an EnableBanking authentication URL for connecting European bank accounts.
institutionId
string
required
The institution ID from the institutions list
countryCode
string
Two-letter country code (e.g., “GB”, “DE”)
state
string
State parameter for OAuth flow security
data
object
const { data } = await trpc.banking.enablebankingLink.mutate({
  institutionId: 'barclays_gb',
  countryCode: 'GB',
  state: randomState,
});

window.location.href = data.url;

enablebankingExchange

Exchange an authorization code for EnableBanking session and account data.
code
string
required
The authorization code from the OAuth callback
data
object

Connection Management

connectionStatus

Internal procedure - requires internal authentication
Get the status of a bank connection.
provider
string
required
Provider name: “plaid”, “gocardless”, or “enablebanking”
id
string
required
The connection/item ID
accessToken
string
required
The access token for the connection
data
object

deleteConnection

Internal procedure - requires internal authentication
Delete a bank connection from the provider.
provider
string
required
Provider name: “plaid”, “gocardless”, or “enablebanking”
id
string
required
The connection/item ID
accessToken
string
required
The access token for the connection
data
object

connectionByReference

Internal procedure - requires internal authentication
Get a GoCardless connection by reference ID.
reference
string
required
The reference ID
data
object

Account Data

getProviderAccounts

Retrieve all accounts from a provider connection.
provider
string
required
Provider name: “plaid”, “gocardless”, or “enablebanking”
id
string
required
The connection/item ID
accessToken
string
required
The access token for the connection
institutionId
string
The institution ID (required for some providers)
data
array
Array of account objects sorted by balance (highest first)
const { data } = await trpc.banking.getProviderAccounts.query({
  provider: 'plaid',
  id: itemId,
  accessToken: accessToken,
});

data.forEach(account => {
  console.log(`${account.name}: ${account.balance.amount} ${account.balance.currency}`);
});

getBalance

Internal procedure - requires internal authentication
Get the current balance for a specific account.
provider
string
required
Provider name
id
string
required
The account ID
accessToken
string
required
The access token
accountType
string
required
The account type
data
object

getProviderTransactions

Internal procedure - requires internal authentication
Retrieve transactions from a provider account.
provider
string
required
Provider name
accountId
string
required
The account ID
accessToken
string
required
The access token
accountType
string
required
The account type
latest
boolean
Whether to fetch only the latest transactions
data
array
Array of transaction objects from the provider

Exchange Rates

rates

Internal procedure - requires internal authentication
Get current exchange rates.
data
object
Object with currency codes as keys and exchange rates as values
const { data } = await trpc.banking.rates.query();

console.log('USD to EUR:', data.EUR);

Build docs developers (and LLMs) love