with one click
plaid-link-setup
Integrate Plaid Link into web and mobile apps using react-plaid-link, token exchange, OAuth redirect handling, update mode, and multi-item flows. Use when the user needs to connect bank accounts via Plaid Link.
Menu
Integrate Plaid Link into web and mobile apps using react-plaid-link, token exchange, OAuth redirect handling, update mode, and multi-item flows. Use when the user needs to connect bank accounts via Plaid Link.
Verify bank accounts using Plaid Auth, micro-deposits, same-day micro-deposits, and database match. Use when the user needs account and routing numbers or ACH payment verification.
Search and retrieve Plaid API endpoint documentation including parameters, authentication requirements, response shapes, and rate limits. Use when the user needs to call a Plaid API or wants to know available endpoints.
Map Plaid personal finance categories to your application's taxonomy. Covers the primary/detailed hierarchy, building custom mapping layers, and common category use cases. Use when the user needs to categorize or display transaction categories.
Detect, classify, and recover from Plaid API errors including ITEM_LOGIN_REQUIRED, INVALID_CREDENTIALS, INSTITUTION_NOT_RESPONDING, rate limits, and network failures. Use when the user needs to handle Plaid errors gracefully.
Implement Plaid Identity and Identity Verification products for KYC flows, document verification, and match scores. Use when the user needs to verify account holder identity.
Search Plaid institutions by name, routing number, products supported, and country. Use when the user needs to find bank coverage, check institution availability, or look up institution details.
| name | plaid-link-setup |
| description | Integrate Plaid Link into web and mobile apps using react-plaid-link, token exchange, OAuth redirect handling, update mode, and multi-item flows. Use when the user needs to connect bank accounts via Plaid Link. |
| standards-version | 1.10.0 |
Use this skill when the user:
react-plaid-link or @plaid/link-webCreate a Link token on the server. The client never calls Plaid directly for token creation.
import { Configuration, PlaidApi, PlaidEnvironments, Products, CountryCode } from "plaid";
const plaidClient = new PlaidApi(
new Configuration({
basePath: PlaidEnvironments[process.env.PLAID_ENV!],
baseOptions: {
headers: {
"PLAID-CLIENT-ID": process.env.PLAID_CLIENT_ID,
"PLAID-SECRET": process.env.PLAID_SECRET,
},
},
})
);
const response = await plaidClient.linkTokenCreate({
user: { client_user_id: uniqueUserId },
client_name: "My App",
products: [Products.Transactions],
country_codes: [CountryCode.Us],
language: "en",
});
// Return response.data.link_token to the client
Launch Link on the client. Use react-plaid-link for React apps:
import { usePlaidLink } from "react-plaid-link";
function PlaidLinkButton({ linkToken }: { linkToken: string }) {
const { open, ready } = usePlaidLink({
token: linkToken,
onSuccess: (publicToken, metadata) => {
// Send publicToken to your server for exchange
fetch("/api/exchange-token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ public_token: publicToken }),
});
},
onExit: (error, metadata) => {
if (error) {
console.error("Link exit with error:", error);
}
},
});
return (
<button onClick={() => open()} disabled={!ready}>
Connect Bank Account
</button>
);
}
Exchange the public token on the server. The public token is short-lived (30 minutes). Exchange it immediately for a permanent access token:
const exchangeResponse = await plaidClient.itemPublicTokenExchange({
public_token: publicToken,
});
const accessToken = exchangeResponse.data.access_token;
const itemId = exchangeResponse.data.item_id;
// Store accessToken securely (encrypted, server-side only)
Handle OAuth redirects (required for many European banks and some US institutions). Add redirect_uri to the Link token request and configure it in the Plaid Dashboard:
const response = await plaidClient.linkTokenCreate({
user: { client_user_id: uniqueUserId },
client_name: "My App",
products: [Products.Transactions],
country_codes: [CountryCode.Us],
language: "en",
redirect_uri: "https://myapp.com/oauth-callback",
});
On the OAuth callback page, reinitialize Link with receivedRedirectUri:
const { open, ready } = usePlaidLink({
token: linkToken, // Same token from before redirect
receivedRedirectUri: window.location.href,
onSuccess: (publicToken, metadata) => {
// Same handler as above
},
});
useEffect(() => {
if (ready) open();
}, [ready, open]);
Update mode for fixing broken connections (ITEM_LOGIN_REQUIRED):
const response = await plaidClient.linkTokenCreate({
user: { client_user_id: uniqueUserId },
client_name: "My App",
country_codes: [CountryCode.Us],
language: "en",
access_token: existingAccessToken, // Triggers update mode
});
User: "I need to add Plaid Link to my Next.js app so users can connect their bank accounts for transaction data."
Agent:
/api/create-link-token that calls linkTokenCreate with Products.TransactionsusePlaidLink hook with onSuccess and onExit handlers/api/exchange-token that calls itemPublicTokenExchangeredirect_uri if you need OAuth support for institutions like Chase or Capital One"| Step | MCP Tool | Description |
|---|---|---|
| Create Link token | plaid_createLinkToken | Create a Link token for sandbox testing without writing backend code |
| Exchange token | plaid_exchangePublicToken | Exchange a public token to get an access token |
| Test the connection | plaid_getAccounts | Verify the item works by fetching accounts |
client_id and secret must never be exposed to the browser. Always create Link tokens server-side.onExit - users may close Link without completing. The onExit callback receives error details and metadata about what step they were on.redirect_uri, users at those banks will see an error. Register your redirect URI in the Plaid Dashboard under "Allowed redirect URIs".