Getting started overview

Integrating with Plaid involves several key steps, beginning with account creation and credential acquisition, followed by initiating your first API request within the Sandbox environment. This process validates your setup and introduces the fundamental components of Plaid’s API, including Plaid Link, for connecting user financial accounts.

The primary goal for getting started is to successfully exchange a public token (generated by Plaid Link) for an access token (which grants API access to a specific financial institution’s data). This involves client-side integration of Plaid Link and server-side logic to handle token exchange and subsequent data requests.

Here’s a quick reference table outlining the initial steps:

Step What to do Where
1. Sign up Create a free developer account Plaid Quickstart guide
2. Get API Keys Retrieve Client ID and Sandbox Secret Plaid Dashboard
3. Choose SDK Select a server-side SDK (e.g., Node.js, Python) Plaid Libraries documentation
4. Implement Link Integrate Plaid Link UI to get a public_token Client-side (web/mobile app)
5. Exchange Token Exchange public_token for an access_token Server-side (your backend)
6. Make API Call Use access_token to request data (e.g., transactions) Server-side (your backend)

Create an account and get keys

To begin using Plaid, you must first create a developer account. This process provides access to the Plaid Dashboard, which is where you manage your API keys, monitor API usage, and configure various settings for your applications.

  1. Sign Up for a Developer Account: Navigate to the Plaid account overview page and complete the registration. This typically involves providing an email address and creating a password.
  2. Access the Plaid Dashboard: After successful registration, log in to the Plaid Dashboard. The dashboard serves as your central hub for all Plaid-related development activities.
  3. Retrieve API Keys: Within the Dashboard, locate the “Keys” section (often under “Team Settings” or “API Keys”). You will find the following essential keys:
    • Client ID: A unique identifier for your application.
    • Sandbox Secret: Used for authenticating API requests in the Sandbox environment. This secret should be kept confidential and never exposed in client-side code.
    • Public Key: Primarily used for initializing Plaid Link on the client side. While less sensitive than the secret, it’s generally passed securely.

Plaid operates in different environments: Sandbox, Development, and Production. Your initial keys are for the Sandbox environment, which is designed for testing and development without using real financial data. As you progress, you will need to apply for access to the Development and Production environments, each with its own set of API keys.

Your first request

Making your first Plaid request typically involves two main phases: client-side integration of Plaid Link to obtain a public token, and server-side logic to exchange that public token for an access token, then retrieve data. This example will focus on using a server-side SDK (Node.js for illustration) after a successful Plaid Link flow.

Phase 1: Client-side with Plaid Link

Plaid Link is a secure, drop-in module that handles the entire user authentication flow for connecting financial accounts. It collects credentials, handles MFA, and returns a public_token to your application.

  1. Integrate Plaid Link: Include the Plaid Link SDK in your front-end application (web, iOS, Android, React Native). For web, this involves adding a script tag and initializing Link.
  2. Initialize Link: Call Plaid.create() with configuration options, including your public_key and the onSuccess callback.
// Example for web client-side Plaid Link initialization
const linkHandler = Plaid.create({
  token: 'GENERATED_LINK_TOKEN', // Generated on your server using /link/token/create
  onSuccess: async (public_token, metadata) => {
    // Send the public_token to your server to exchange for an access_token
    console.log('Public Token:', public_token);
    // Example: send to your backend
    await fetch('/api/set_access_token', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ public_token }),
    });
  },
  onExit: (err, metadata) => {
    if (err != null) {
      console.error('Plaid Link exited with error:', err);
    }
    console.log('Plaid Link exited.');
  },
});

// Trigger Link when a button is clicked
document.getElementById('connect-button').addEventListener('click', () => {
  linkHandler.open();
});

The token parameter in Plaid.create refers to a link_token, which must be generated on your server using the /link/token/create endpoint. This ensures that sensitive configuration specific to your application (like client ID and secret) is not exposed client-side. The link_token is a short-lived, one-time-use token that initializes the Plaid Link flow securely. You can find more details in the Plaid Link web integration guide.

Phase 2: Server-side token exchange and data retrieval

Once your client-side application receives a public_token from Plaid Link, it sends this token to your backend server. Your server then performs the following actions:

  1. Exchange Public Token for Access Token: Use the /item/public_token/exchange endpoint with your client_id, secret, and the received public_token to obtain an access_token. The access_token is a long-lived, unique identifier for an Item (a connected financial account).
  2. Store Access Token: Persist the access_token securely in your database, associated with the user. This token allows your application to access data for that specific financial account.
  3. Make a Data Request: Use the stored access_token to call a data endpoint, such as /transactions/get, /auth/get, or /identity/get, to retrieve financial data.
// Example for Node.js server-side (using plaid-node library)
const { Configuration, PlaidApi, Products, PlaidEnvironments } = require('plaid');

const configuration = new Configuration({
  basePath: PlaidEnvironments.sandbox,
  baseOptions: {
    headers: {
      'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID,
      'PLAID-SECRET': process.env.PLAID_SANDBOX_SECRET,
    },
  },
});

const client = new PlaidApi(configuration);

// Endpoint to handle public_token exchange and initial data fetch
app.post('/api/set_access_token', async (req, res) => {
  const { public_token } = req.body;
  try {
    // 1. Exchange public_token for access_token
    const tokenExchangeResponse = await client.itemPublicTokenExchange({
      publicToken: public_token,
    });
    const access_token = tokenExchangeResponse.data.access_token;
    // In a real app, save this access_token to your database with the user ID
    console.log('Access Token:', access_token);

    // 2. (Optional) Fetch some initial data, e.g., transactions
    const transactionsResponse = await client.transactionsGet({
      accessToken: access_token,
      startDate: '2023-01-01',
      endDate: '2023-01-31',
    });
    const transactions = transactionsResponse.data.transactions;
    console.log('Initial Transactions:', transactions);

    res.json({ success: true, transactions });
  } catch (error) {
    console.error('Error exchanging public token or fetching data:', error);
    res.status(500).json({ error: error.response?.data || error.message });
  }
});

This sequence completes a basic Plaid integration, allowing your application to connect an account and retrieve data. Ensure your PLAID_CLIENT_ID and PLAID_SANDBOX_SECRET are loaded from environment variables for security, as shown in the example.

Common next steps

After successfully completing your first API call, consider these next steps to further develop your Plaid integration:

  • Explore More Products: Plaid offers various products beyond basic authentication and transactions. Investigate Plaid Auth for account and routing numbers, Plaid Identity for user verification, or Plaid Investments for brokerage data based on your application’s requirements. Each product has specific API endpoints and data structures.
  • Handle Webhooks: Plaid uses webhooks to notify your application of important events, such as new transactions, account updates, or errors. Implement a webhook receiver endpoint on your server to process these notifications and keep your data synchronized. The Plaid webhooks documentation provides comprehensive guidance. Proper webhook handling is crucial for maintaining up-to-date financial data and responding to critical events.
  • Implement Error Handling: Develop robust error handling for both Plaid Link and API responses. Plaid provides detailed error codes and messages that can help diagnose issues and provide informative feedback to users. Review the Plaid API error codes.
  • Move to Development Environment: Once testing in Sandbox is complete, apply for access to the Development environment. This environment uses real financial institutions (though often with limited data or test accounts) and is suitable for more extensive testing before going live. Refer to the Plaid environments documentation for details on transitioning.
  • Secure Your Access Tokens: Ensure that access_token values are stored securely in your database and transmitted only over HTTPS. These tokens grant access to sensitive financial data, so protecting them is paramount. General best practices for API key management, as described by Google Cloud’s API key best practices, are applicable here.
  • User Experience and Reconnection: Design a user experience around account re-authentication and error states. If an access token becomes invalid (e.g., due to user credential changes), your application needs to prompt the user to reconnect their account through Plaid Link.

Troubleshooting the first call

When making your first Plaid API call, common issues can arise. Here are some troubleshooting steps:

  • Incorrect API Keys: Double-check that you are using the correct PLAID_CLIENT_ID and PLAID_SANDBOX_SECRET. Ensure they are configured for the Sandbox environment. A common mistake is using Production keys in Sandbox or vice-versa. Verify your keys in the Plaid Dashboard under your API keys settings.
  • Environment Mismatch: Confirm that your API client is configured to connect to the PlaidEnvironments.sandbox URL. If your client is pointing to production or development while using Sandbox keys, requests will fail with authentication errors.
  • Missing link_token for Plaid Link: If Plaid Link isn't opening or throws an error, verify that you are generating a link_token on your server using the /link/token/create endpoint and passing it correctly to Plaid.create() on the client side. The link_token is required for secure initialization of Link.
  • Invalid public_token: The public_token returned by Plaid Link is ephemeral and can only be exchanged for an access_token once. If you try to exchange it multiple times, it will fail. Additionally, ensure the public_token is being sent from the client to your server correctly.
  • Network Issues or Firewalls: Ensure your server has outbound access to Plaid’s API endpoints. Corporate firewalls or misconfigured network settings can block API calls. Check your server logs for network errors.
  • SDK Configuration: If you are using an official Plaid SDK, ensure it is installed correctly and that you are passing the client ID and secret as per the SDK’s documentation. Refer to the Plaid client libraries documentation for language-specific setup.
  • Plaid Dashboard Logs: The Plaid Dashboard includes API logs that can help troubleshoot requests. Navigate to the “Activity” or “Logs” section in your dashboard to view the status and details of recent API calls made from your account. This can often reveal the exact error Plaid encountered.
  • Check Status Page: Occasionally, issues may be on Plaid’s side. Check the Plaid Status Page to see if there are any ongoing incidents or outages.