### Full Example: Express Server with Plaid Integration Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/quickstart.md A complete Express.js server demonstrating Plaid Link token creation, token exchange, and account retrieval. This example includes basic error handling and server setup. ```typescript import express from 'express'; import { Configuration, PlaidApi, PlaidEnvironments } from 'plaid'; const app = express(); app.use(express.json()); const configuration = new Configuration({ basePath: PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID, 'PLAID-SECRET': process.env.PLAID_SECRET, }, }, }); const plaidClient = new PlaidApi(configuration); app.post('/create_link_token', async (req, res) => { try { const response = await plaidClient.linkTokenCreate({ user: { client_user_id: req.body.userId }, client_name: 'My App', products: ['transactions'], country_codes: ['US'], language: 'en', }); res.json({ link_token: response.data.link_token }); } catch (error) { res.status(500).json({ error: error.message }); } }); app.post('/exchange_token', async (req, res) => { try { const response = await plaidClient.itemPublicTokenExchange({ public_token: req.body.public_token, }); // Store response.data.access_token securely res.json({ success: true }); } catch (error) { res.status(500).json({ error: error.message }); } }); app.get('/accounts/:userId', async (req, res) => { try { const accessToken = await getStoredAccessToken(req.params.userId); const response = await plaidClient.accountsGet({ access_token: accessToken, }); res.json(response.data.accounts); } catch (error) { res.status(500).json({ error: error.message }); } }); app.listen(3000, () => { console.log('Server running on port 3000'); }); ``` -------------------------------- ### Installation Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/README.md Install the Plaid Node.js SDK using npm. ```APIDOC ## Installation ### Description Install the Plaid Node.js SDK using npm. ### Command ```bash npm install plaid ``` ``` -------------------------------- ### Example - Get All Auth Data Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md Demonstrates how to retrieve all authentication data for an Item's accounts using `authGet`. It iterates through accounts and logs their associated ACH numbers. ```typescript const response = await plaidClient.authGet({ access_token: 'access-token-abc123', }); response.data.accounts.forEach((account, index) => { const achNumbers = response.data.numbers.ach.find( n => n.account_id === account.account_id ); console.log(`Account: ${account.name}`); console.log(` Account #: ${achNumbers.account_number}`); console.log(` Routing #: ${achNumbers.routing_number}`); }); ``` -------------------------------- ### Complete Auth Flow Example Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md A comprehensive example illustrating the complete authentication flow, including fetching account numbers and then verifying them using authVerify. ```APIDOC ## Complete Auth Flow Example ```typescript // 1. Get account and routing numbers for user const authResponse = await plaidClient.authGet({ access_token: userAccessToken, }); const achAccounts = authResponse.data.numbers.ach; // 2. For payment/ACH setup, verify the account details const verificationResponse = await plaidClient.authVerify({ access_token: userAccessToken, options: { account_number: achAccounts[0].account_number, routing_number: achAccounts[0].routing_number, }, }); if (verificationResponse.data.accounts[0].verification_status === 'VERIFIED') { // Safe to process ACH transaction console.log('Account verified - safe for ACH processing'); } else { // Request additional verification console.log('Account verification failed'); } ``` ``` -------------------------------- ### Install Plaid Node.js library Source: https://github.com/plaid/plaid-node/blob/master/README.md Use npm to install the official Plaid client library. ```console $ npm install plaid ``` -------------------------------- ### Basic Setup Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/README.md Initialize the Plaid client with configuration and credentials. ```APIDOC ## Basic Setup ### Description Initialize the Plaid client with configuration and credentials. ### Code Example ```typescript import { Configuration, PlaidApi, PlaidEnvironments } from 'plaid'; const configuration = new Configuration({ basePath: PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': CLIENT_ID, 'PLAID-SECRET': SECRET, }, }, }); const plaidClient = new PlaidApi(configuration); ``` ``` -------------------------------- ### Example - Get Specific Accounts Auth Data Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md Shows how to use the `account_ids` option within `authGet` to retrieve authentication data for only specific accounts. ```typescript const response = await plaidClient.authGet({ access_token: 'access-token-abc123', options: { account_ids: ['account-id-1', 'account-id-2'], }, }); // Process only requested accounts ``` -------------------------------- ### Example - Verify with Account Details Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md Example demonstrating how to verify an account using provided account number, routing number, and account holder name. ```APIDOC ## Example - Verify with Account Details ```typescript const response = await plaidClient.authVerify({ access_token: 'access-token-abc123', options: { account_number: '123456789', routing_number: '123456780', account_holder_name: 'John Doe', }, }); ``` ``` -------------------------------- ### Example - Get Routing Number for ACH Origination Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md Illustrates how to retrieve the routing and account numbers for ACH origination using `authGet` with a specific `account_id`. ```typescript const response = await plaidClient.authGet({ access_token: 'access-token-abc123', options: { account_ids: [checkingAccountId], }, }); const achNumbers = response.data.numbers.ach[0]; const routingNumber = achNumbers.routing_number; const accountNumber = achNumbers.account_number; // Use for ACH origination/direct deposit setup ``` -------------------------------- ### Example - Verify Single Account Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md Example of how to verify a single account using the authVerify method with an access token and account ID. ```APIDOC ## Example - Verify Single Account ```typescript const response = await plaidClient.authVerify({ access_token: 'access-token-abc123', account_ids: ['account-id-1'], }); const account = response.data.accounts[0]; if (account.verification_status === 'VERIFIED') { console.log('Account verified successfully'); } else { console.log(`Verification status: ${account.verification_status}`); } ``` ``` -------------------------------- ### Complete Processor Token Workflow Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/processor-methods.md This comprehensive example demonstrates the full lifecycle of using processor tokens, from creation to various data retrieval and processor-specific token generation. ```typescript // 1. Create processor token (backend) const tokenResponse = await plaidClient.processorTokenCreate({ access_token: userAccessToken, account_id: accountId, processor: 'stripe', }); const processorToken = tokenResponse.data.processor_token; // 2. Send to frontend or use directly // For Stripe: send to frontend to use with Stripe Payment Method API // For other processors: use backend // 3. Use processor token to get account data const accountResponse = await plaidClient.processorAccountGet({ processor_token: processorToken, }); // 4. Get banking numbers for verification const authResponse = await plaidClient.processorAuthGet({ processor_token: processorToken, }); // 5. Get real-time balance const balanceResponse = await plaidClient.processorBalanceGet({ processor_token: processorToken, }); // 6. Retrieve transactions const txnsResponse = await plaidClient.processorTransactionsSync({ processor_token: processorToken, }); // 7. For Stripe: create bank account token const stripeTokenResponse = await plaidClient.processorStripeBankAccountTokenCreate({ processor_token: processorToken, }); // Use Stripe token with Stripe API ``` -------------------------------- ### Full Sandbox Testing Workflow Example Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/sandbox-methods.md Demonstrates a complete testing workflow in the Sandbox environment, from item creation to data retrieval and error simulation. This is useful for end-to-end testing of your Plaid integration. ```typescript // 1. Create test item const publicTokenResponse = await plaidClient.sandboxPublicTokenCreate({ institution_id: 'ins_109508', initial_products: ['transactions', 'auth'], }); // 2. Exchange for access token const exchangeResponse = await plaidClient.itemPublicTokenExchange({ public_token: publicTokenResponse.data.public_token, }); const accessToken = exchangeResponse.data.access_token; // 3. Create test transactions await plaidClient.sandboxTransactionsCreate({ access_token: accessToken, transactions: [ { account_id: 'account-123', amount: 100, date: '2024-01-15', description: 'Test purchase', direction: 'OUTFLOW', }, ], }); // 4. Fire webhook to notify await plaidClient.sandboxItemFireWebhook({ access_token: accessToken, webhook_code: 'TRANSACTIONS_READY', }); // 5. Retrieve data const transactions = await plaidClient.transactionsSync({ access_token: accessToken, }); console.log(`Retrieved ${transactions.data.added.length} transactions`); // 6. Test error scenarios await plaidClient.sandboxItemResetLogin({ access_token: accessToken, }); // Now requests will fail with ITEM_LOGIN_REQUIRED ``` -------------------------------- ### Basic Promise Chaining Example Source: https://github.com/plaid/plaid-node/blob/master/README.md Illustrates the fundamental promise-based structure of Plaid API methods, showing a generic success and error handler. ```typescript plaidPromise .then((successResponse) => { // ... }) .catch((err) => { // ... }); ``` -------------------------------- ### Complete Auth Flow Example Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md Demonstrates a complete authentication flow, including fetching account and routing numbers and then verifying them using the authVerify API. This is useful for setting up ACH transactions. ```typescript // 1. Get account and routing numbers for user const authResponse = await plaidClient.authGet({ access_token: userAccessToken, }); const achAccounts = authResponse.data.numbers.ach; // 2. For payment/ACH setup, verify the account details const verificationResponse = await plaidClient.authVerify({ access_token: userAccessToken, options: { account_number: achAccounts[0].account_number, routing_number: achAccounts[0].routing_number, }, }); if (verificationResponse.data.accounts[0].verification_status === 'VERIFIED') { // Safe to process ACH transaction console.log('Account verified - safe for ACH processing'); } else { // Request additional verification console.log('Account verification failed'); } ``` -------------------------------- ### Environment Variables Setup Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/quickstart.md Configure Plaid API credentials and environment using a .env file. Load these variables into your application using the dotenv package for secure credential management. ```bash PLAID_CLIENT_ID=your_client_id PLAID_SECRET=your_secret PLAID_ENV=sandbox # or production ``` -------------------------------- ### Load Environment Variables and Configure Plaid Client Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/quickstart.md Load environment variables using dotenv and configure the Plaid client with the correct environment and credentials. This setup is essential for initializing the Plaid API client. ```typescript import dotenv from 'dotenv'; dotenv.config(); const configuration = new Configuration({ basePath: process.env.PLAID_ENV === 'production' ? PlaidEnvironments.production : PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID, 'PLAID-SECRET': process.env.PLAID_SECRET, }, }, }); ``` -------------------------------- ### Promise-based API Usage with Error Handling Source: https://github.com/plaid/plaid-node/blob/master/README.md Demonstrates how to use Plaid API methods with promises, including `then/catch` for handling success and error responses. This example sets up an Express server for token exchange. ```typescript import * as bodyParser from 'body-parser'; import * as express from 'express'; import { Configuration, PlaidApi, PlaidEnvironments } from 'plaid'; const configuration = new Configuration({ basePath: PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': CLIENT_ID, 'PLAID-SECRET': SECRET, 'Plaid-Version': '2020-09-14', }, }, }); const plaidClient = new PlaidApi(configuration); const app = express(); const port = process.env.PORT || 3000; app.use( bodyParser.urlencoded({ extended: true, }), ); app.use(bodyParser.json()); app.post('/plaid_exchange', (req, res) => { var public_token = req.body.public_token; return plaidClient .itemPublicTokenExchange({ public_token }) .then((tokenResponse) => tokenResponse.access_token) .then((access_token) => plaidClient.accountsGet({ access_token })) .then((accountsResponse) => console.log(accountsResponse.data.accounts)) .catch((error) => { const err = error.response.data; // Indicates plaid API error console.error('/exchange token returned an error', { error_type: err.error_type, error_code: err.error_code, error_message: err.error_message, display_message: err.display_message, documentation_url: err.documentation_url, request_id: err.request_id, }); // Inspect error_type to handle the error in your application switch (err.error_type) { case 'INVALID_REQUEST': // ... break; case 'INVALID_INPUT': // ... break; case 'RATE_LIMIT_EXCEEDED': // ... break; case 'API_ERROR': // ... break; case 'ITEM_ERROR': // ... break; default: // fallthrough } res.sendStatus(500); }); }); app.listen(port, () => { console.log(`Listening on port ${port}`); }); ``` -------------------------------- ### linkTokenCreate() Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/link-token-methods.md Create a Link token to initialize the Plaid Link flow. This method is essential for starting the Plaid Link user experience, whether for new item creation or updating existing items. ```APIDOC ## linkTokenCreate() ### Description Create a Link token to initialize the Plaid Link flow. ### Method POST ### Endpoint /link/token/create ### Parameters #### Request Body - **linkTokenCreateRequest** (LinkTokenCreateRequest) - Required - Request object with configuration - **client_id** (string) - Optional - Plaid client ID - **secret** (string) - Optional - Plaid secret - **client_name** (string) - Required - Name of your application - **user** (LinkTokenCreateRequestUser) - Required - End user object (client_user_id required) - **client_user_id** (string) - Required - Unique identifier for the user - **language** (string) - Optional - Language for Link UI (default: 'en') - **country_codes** (string[]) - Optional - Array of ISO 3166-1 alpha-2 country codes - **products** (Products[]) - Optional - Array of Plaid products to request - **optional_products** (Products[]) - Optional - Array of optional products to offer - **required_if_supported_products** (Products[]) - Optional - Products to require if institution supports them - **account_filters** (AccountFilter) - Optional - Filter accounts by type/subtype - **auth** (LinkTokenCreateRequestAuth) - Optional - Auth-specific options - **transactions** (LinkTokenCreateRequestTransactions) - Optional - Transactions-specific options - **investments** (object) - Optional - Investments-specific options - **income_verification** (LinkTokenCreateRequestIncomeVerification) - Optional - Income verification options - **redirect_uri** (string) - Optional - Redirect URI for mobile web flow - **webhook** (string) - Optional - Webhook URL for events - **access_token** (string) - Optional - Access token for updating existing Item - **institution_data** (LinkTokenCreateRequestInstitutionData) - Optional - Institution selection options - **payment_initiation** (LinkTokenCreateRequestPaymentInitiation) - Optional - Payment initiation options - **deposit_switch** (LinkTokenCreateRequestDepositSwitch) - Optional - Deposit switch options #### Options - **options** (object) - Optional - Axios request options override ### Response #### Success Response (200) - **link_token** (string) - Token to initialize Plaid Link - **expiration** (string) - Token expiration timestamp (ISO 8601) - **request_id** (string) - Unique request identifier ### Example - Basic Flow ```typescript const response = await plaidClient.linkTokenCreate({ user: { client_user_id: 'user-123', }, client_name: 'My App', products: ['transactions', 'auth'], country_codes: ['US'], language: 'en', }); const linkToken = response.data.link_token; // Pass linkToken to Plaid Link on the frontend ``` ### Example - With Advanced Options ```typescript const response = await plaidClient.linkTokenCreate({ user: { client_user_id: 'user-123', legal_name: 'John Doe', }, client_name: 'Financial App', products: ['transactions', 'income_verification'], optional_products: ['assets'], country_codes: ['US', 'CA'], language: 'en', transactions: { days_requested: 730, // Request 2 years of history }, income_verification: { income_source_types: ['paystub', 'tax_documents'], verification_method: 'documentary', }, account_filters: { investment: { account_subtypes: ['taxable'], }, }, webhook: 'https://yourserver.com/plaid-webhook', }); ``` ### Example - Update Mode (Re-authentication) ```typescript const response = await plaidClient.linkTokenCreate({ user: { client_user_id: 'user-123', }, client_name: 'My App', access_token: 'existing-access-token', // Update existing Item }); const linkToken = response.data.link_token; // Use in Link update mode ``` ### Notes - Link tokens expire after 1 hour - Required for initializing Plaid Link - Can specify multiple products and optional products - Supports account filtering and institution selection - Can be used for creating new Items or updating existing ones ``` -------------------------------- ### identityVerificationCreate() Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/identity-methods.md Initiates a new identity verification process. This method is used to start a user verification flow, typically for KYC (Know Your Customer) purposes. ```APIDOC ## identityVerificationCreate() ### Description Create an identity verification process. ### Method `identityVerificationCreate` ### Parameters #### Path Parameters - `identityVerificationCreateRequest` (IdentityVerificationCreateRequest) - Required - Request object for creating an identity verification - `options` (object) - Optional - Axios request options override ### IdentityVerificationCreateRequest Interface #### Fields - `client_user_id` (string) - Required - A unique identifier for the user in your system - `templates` (array) - Required - An array of template IDs to use for verification - `give_consent` (boolean) - Required - Indicates if the user has given consent for verification - `is_shareable` (boolean) - Required - Whether the verification results can be shared ### Request Example ```typescript const response = await plaidClient.identityVerificationCreate({ client_user_id: 'user-123', templates: ['kyc_basic'], give_consent: true, is_shareable: false, }); const verificationToken = response.data.id; ``` ``` -------------------------------- ### Verify Account with Details Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/auth-methods.md Example of verifying an account using the authVerify API with provided account number, routing number, and account holder name. ```typescript const response = await plaidClient.authVerify({ access_token: 'access-token-abc123', options: { account_number: '123456789', routing_number: '123456780', account_holder_name: 'John Doe', }, }); ``` -------------------------------- ### Get Processor Transactions Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/processor-methods.md Retrieve transactions for a specified date range using a processor token. The request requires a processor token, start date, and end date. ```typescript const response = await plaidClient.processorTransactionsGet({ processor_token: processorToken, start_date: '2024-01-01', end_date: '2024-01-31', }); response.data.transactions.forEach(transaction => { console.log(`${transaction.name}: ${transaction.amount}`); }); ``` -------------------------------- ### Transactions User Insights Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Get user-level transaction insights. ```APIDOC ## transactionsUserInsightsGet ### Description Get user-level transaction insights. ### Method POST ### Endpoint /transactions/user_insights/get ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item data is being requested for. ### Request Example { "example": "{\"access_token\": \"access-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **user_insights** (object) - Description #### Response Example { "example": "{\"user_insights\": {...}}" } ``` -------------------------------- ### Bank Transfer Sweep Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Get bank transfer sweep details. ```APIDOC ## bankTransferSweepGet ### Description Get bank transfer sweep details. ### Method POST ### Endpoint /bank_transfer/sweep/get ### Parameters #### Request Body - **sweep_id** (string) - Required - The ID of the sweep to retrieve. ### Request Example { "example": "{\"sweep_id\": \"sweep-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **sweep** (object) - Description #### Response Example { "example": "{\"sweep\": {...}}" } ``` -------------------------------- ### Bank Transfer Balance Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Get balance of Bank Transfer account. ```APIDOC ## bankTransferBalanceGet ### Description Get balance of Bank Transfer account. ### Method POST ### Endpoint /bank_transfer/balance/get ### Parameters #### Request Body - **account_id** (string) - Required - The ID of the Bank Transfer account. ### Request Example { "example": "{\"account_id\": \"your_account_id\"}" } ### Response #### Success Response (200) - **balance** (object) - Description #### Response Example { "example": "{\"balance\": {...}}" } ``` -------------------------------- ### Plaid Client Initialization with Custom Axios Options Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/configuration.md Initializes the Plaid client with production environment settings and custom Axios options including timeout and redirects. ```typescript const configuration = new Configuration({ basePath: PlaidEnvironments.production, baseOptions: { headers: { 'PLAID-CLIENT-ID': CLIENT_ID, 'PLAID-SECRET': SECRET, }, timeout: 30000, maxRedirects: 5, }, }); const plaidClient = new PlaidApi(configuration); ``` -------------------------------- ### Get Real-Time Balance Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/README.md Get real-time balance information for all accounts associated with an Item. ```APIDOC ## Get Real-Time Balance ### Description Get real-time balance information for all accounts associated with an Item using the provided access token. ### Method `accountsBalanceGet(request: { access_token: string })` ### Request Body Example ```json { "access_token": "userAccessToken" } ``` ### Response Example ```json { "accounts": [ { "account_id": "123", "name": "Checking", "balances": { "current": 1000, "available": 900 } } ] } ``` ``` -------------------------------- ### Build Docker Image for Plaid Node Tests Source: https://github.com/plaid/plaid-node/blob/master/CONTRIBUTING.md Use this command to build the Docker image required for running the client tests. Ensure you are in the project's root directory. ```bash docker build -t plaid-node . ``` -------------------------------- ### Basic Plaid Client Initialization Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/configuration.md Initializes the Plaid client using the sandbox environment and provides client ID and secret via base options headers. ```typescript import { Configuration, PlaidApi, PlaidEnvironments } from 'plaid'; const configuration = new Configuration({ basePath: PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID, 'PLAID-SECRET': process.env.PLAID_SECRET, }, }, }); const plaidClient = new PlaidApi(configuration); ``` -------------------------------- ### Configure Plaid API client Source: https://github.com/plaid/plaid-node/blob/master/README.md Initialize the Plaid client with credentials and environment settings. ```typescript import { Configuration, PlaidApi, PlaidEnvironments } from 'plaid'; const configuration = new Configuration({ basePath: PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': CLIENT_ID, 'PLAID-SECRET': SECRET, }, }, }); ``` ```typescript const configuration = new Configuration({ basePath: PlaidEnvironments.sandbox, baseOptions: { // Axios request options }, }); ``` -------------------------------- ### Item Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve Item details. ```APIDOC ## itemGet ### Description Retrieve Item details. ### Method POST ### Endpoint /item/get ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item data is being requested for. ### Request Example { "example": "{\"access_token\": \"access-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **item** (object) - Description - **status** (string) - Description #### Response Example { "example": "{\"item\": {...}, \"status\": \"active\"}" } ``` -------------------------------- ### Accounts Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve account information. ```APIDOC ## accountsGet ### Description Retrieve account information. ### Method POST ### Endpoint /accounts/get ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item data is being requested for. ### Request Example { "example": "{\"access_token\": \"access-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **accounts** (array) - Description - **item** (object) - Description #### Response Example { "example": "{\"accounts\": [...], \"item\": {...}}" } ``` -------------------------------- ### Sandbox Methods Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/INDEX.md Utilities for testing and simulating Plaid integrations. ```APIDOC ## sandboxPublicTokenCreate() ### Description Create a sandbox public token for testing. ### Method POST ### Endpoint `/sandbox/public_token/create` ### Parameters #### Request Body - **institution_id** (string) - Required - The ID of the sandbox institution. - **initial_ பயனர்_data** (object) - Optional - Initial data for the sandbox account. ### Response #### Success Response (200) - **public_token** (string) - The sandbox public token. #### Response Example { "public_token": "public-sandbox", "request_id": "req_123" } ``` ```APIDOC ## sandboxItemResetLogin() ### Description Simulate a login error for a sandbox Item. ### Method POST ### Endpoint `/sandbox/item/reset_login` ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item. ### Response #### Success Response (200) - **item** (object) - Details about the Item. #### Response Example { "item": { "item_id": "item-sandbox", "institution_id": "ins-sandbox" }, "request_id": "req_123" } ``` ```APIDOC ## sandboxItemFireWebhook() ### Description Trigger a webhook for a sandbox Item. ### Method POST ### Endpoint `/sandbox/item/webhook/fire` ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item. - **webhook_type** (string) - Required - The type of webhook to fire. - **webhook_code** (string) - Required - The code of the webhook to fire. ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example { "message": "Webhook fired successfully.", "request_id": "req_123" } ``` ```APIDOC ## sandboxTransactionsCreate() ### Description Create sandbox transactions for an Item. ### Method POST ### Endpoint `/sandbox/transactions/create` ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item. - **transactions** (array) - Required - An array of transaction objects to create. - **override_date_range** (boolean) - Optional - Whether to override the date range. ### Response #### Success Response (200) - **transaction_ids** (array) - An array of created transaction IDs. #### Response Example { "transaction_ids": ["txn_sandbox_1", "txn_sandbox_2"], "request_id": "req_123" } ``` ```APIDOC ## sandboxTransferSimulate() ### Description Simulate transfers in the sandbox environment. ### Method POST ### Endpoint `/sandbox/transfer/simulate` ### Parameters #### Request Body - **transfer_id** (string) - Required - The ID of the transfer to simulate. - **status** (string) - Required - The status to simulate (e.g., `pending`, `posted`, `failed`). ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example { "message": "Transfer simulation successful.", "request_id": "req_123" } ``` ```APIDOC ## sandboxBankTransferSimulate() ### Description Simulate bank transfers in the sandbox environment. ### Method POST ### Endpoint `/sandbox/bank_transfer/simulate` ### Parameters #### Request Body - **bank_transfer_id** (string) - Required - The ID of the bank transfer to simulate. - **status** (string) - Required - The status to simulate (e.g., `pending`, `posted`, `failed`). ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example { "message": "Bank transfer simulation successful.", "request_id": "req_123" } ``` ```APIDOC ## sandboxPaymentSimulate() ### Description Simulate payments in the sandbox environment. ### Method POST ### Endpoint `/sandbox/payment/simulate` ### Parameters #### Request Body - **payment_id** (string) - Required - The ID of the payment to simulate. - **status** (string) - Required - The status to simulate (e.g., `pending`, `posted`, `failed`). ### Response #### Success Response (200) - **message** (string) - A confirmation message. #### Response Example { "message": "Payment simulation successful.", "request_id": "req_123" } ``` -------------------------------- ### Transactions Recurring Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve recurring transactions. ```APIDOC ## transactionsRecurringGet ### Description Retrieve recurring transactions. ### Method POST ### Endpoint /transactions/recurring/get ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item data is being requested for. ### Request Example { "example": "{\"access_token\": \"access-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **accounts** (array) - Description - **recurring_transactions** (array) - Description #### Response Example { "example": "{\"accounts\": [...], \"recurring_transactions\": [...]}" } ``` -------------------------------- ### Bank Transfer Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve a bank transfer. ```APIDOC ## bankTransferGet ### Description Retrieve a bank transfer. ### Method POST ### Endpoint /bank_transfer/get ### Parameters #### Request Body - **transfer_id** (string) - Required - The ID of the bank transfer to retrieve. ### Request Example { "example": "{\"transfer_id\": \"transfer-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **bank_transfer** (object) - Description #### Response Example { "example": "{\"bank_transfer\": {...}}" } ``` -------------------------------- ### Asset Report Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve an Asset Report. ```APIDOC ## assetReportGet ### Description Retrieve an Asset Report. ### Method POST ### Endpoint /asset_report/get ### Parameters #### Request Body - **asset_report_token** (string) - Required - The token or ID returned by the Create Asset Report endpoint. ### Request Example { "example": "{\"asset_report_token\": \"report-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **report** (object) - Description - **warnings** (array) - Description #### Response Example { "example": "{\"report\": {...}, \"warnings\": []}" } ``` -------------------------------- ### Link Delivery Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve Link delivery details. ```APIDOC ## linkDeliveryGet ### Description Retrieve Link delivery details. ### Method POST ### Endpoint /link/delivery/get ### Parameters #### Request Body - **link_delivery_id** (string) - Required - The ID of the Link delivery. ### Request Example { "example": "{\"link_delivery_id\": \"ldlvry-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **link_delivery** (object) - Description #### Response Example { "example": "{\"link_delivery\": {...}}" } ``` -------------------------------- ### Payment Initiation Methods Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Methods for payment initiation. ```APIDOC ## Payment Initiation Methods for payment initiation: - `paymentInitiationConsentCreate()` - Create payment consent - `paymentInitiationConsentGet()` - Retrieve payment consent - `paymentInitiationConsentPaymentExecute()` - Execute payment from consent - `paymentInitiationConsentRevoke()` - Revoke payment consent - `paymentInitiationPaymentCreate()` - Create payment - `paymentInitiationPaymentGet()` - Retrieve payment - `paymentInitiationPaymentList()` - List payments - `paymentInitiationPaymentReverse()` - Reverse payment - `paymentInitiationRecipientCreate()` - Create payment recipient - `paymentInitiationRecipientGet()` - Retrieve payment recipient - `paymentInitiationRecipientList()` - List payment recipients ``` -------------------------------- ### Link Token Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve Link token details. ```APIDOC ## linkTokenGet ### Description Retrieve Link token details. ### Method POST ### Endpoint /link/token/get ### Parameters #### Request Body - **link_token** (string) - Required - The token for the Link instance. ### Request Example { "example": "{\"link_token\": \"link-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **link_token** (object) - Description #### Response Example { "example": "{\"link_token\": {...}}" } ``` -------------------------------- ### Create Link Token - Advanced Options Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/link-token-methods.md This snippet demonstrates creating a Link token with advanced options, including requesting specific products, optional products, account filters, income verification details, and setting a webhook. ```typescript const response = await plaidClient.linkTokenCreate({ user: { client_user_id: 'user-123', legal_name: 'John Doe', }, client_name: 'Financial App', products: ['transactions', 'income_verification'], optional_products: ['assets'], country_codes: ['US', 'CA'], language: 'en', transactions: { days_requested: 730, // Request 2 years of history }, income_verification: { income_source_types: ['paystub', 'tax_documents'], verification_method: 'documentary', }, account_filters: { investment: { account_subtypes: ['taxable'], }, }, webhook: 'https://yourserver.com/plaid-webhook', }); ``` -------------------------------- ### Create Sandbox Public Token Source: https://github.com/plaid/plaid-node/blob/master/README.md Demonstrates the transition from callback-based endpoint calls to request model objects and async/await. ```javascript pCl.sandboxPublicTokenCreate( testConstants.INSTITUTION, testConstants.PRODUCTS, {}, cb, ); ``` ```typescript const request: SandboxPublicTokenCreateRequest = { institution_id: TestConstants.INSTITUTION, initial_products: TestConstants.PRODUCTS as Products[], options, }; const response = await plaidClient.sandboxPublicTokenCreate(request); ``` -------------------------------- ### Transactions Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve transactions (legacy method, use transactionsSync). ```APIDOC ## transactionsGet ### Description Retrieve transactions (legacy method, use transactionsSync). ### Method POST ### Endpoint /transactions/get ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item data is being requested for. - **start_date** (string) - Required - The start date of the period to search, in 'YYYY-MM-DD' format. - **end_date** (string) - Required - The end date of the period to search, in 'YYYY-MM-DD' format. ### Request Example { "example": "{\"access_token\": \"access-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\", \"start_date\": \"2023-01-01\", \"end_date\": \"2023-01-31\"}" } ### Response #### Success Response (200) - **accounts** (array) - Description - **transactions** (array) - Description - **total_transactions** (integer) - Description #### Response Example { "example": "{\"accounts\": [...], \"transactions\": [...], \"total_transactions\": 100}" } ``` -------------------------------- ### Asset Report PDF Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve an Asset Report as a PDF. ```APIDOC ## assetReportPdfGet ### Description Retrieve an Asset Report as a PDF. ### Method POST ### Endpoint /asset_report/pdf/get ### Parameters #### Request Body - **asset_report_token** (string) - Required - The token or ID returned by the Create Asset Report endpoint. ### Request Example { "example": "{\"asset_report_token\": \"report-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **content** (string) - Description (PDF content) #### Response Example { "example": "JVBERi0xLjQKJc... (PDF content)" } ``` -------------------------------- ### Loading Credentials from Environment Variables Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/configuration.md Shows a recommended pattern for loading Plaid credentials and environment settings from environment variables. ```typescript // Recommended pattern for loading credentials from environment const configuration = new Configuration({ basePath: process.env.PLAID_ENV === 'production' ? PlaidEnvironments.production : PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': process.env.PLAID_CLIENT_ID || '', 'PLAID-SECRET': process.env.PLAID_SECRET || '', }, }, }); ``` -------------------------------- ### Verify Documentation Files Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/00-START-HERE.md A bash command to list all markdown files in the output directory, used to verify that all documentation files are present. ```bash ls -1 /workspace/home/output/*.md ls -1 /workspace/home/output/api-reference/*.md ``` -------------------------------- ### Accounts Balance Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve real-time balance data for accounts. ```APIDOC ## accountsBalanceGet ### Description Retrieve real-time balance data for accounts. ### Method POST ### Endpoint /accounts/balance/get ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item data is being requested for. ### Request Example { "example": "{\"access_token\": \"access-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **accounts** (array) - Description - **item** (object) - Description #### Response Example { "example": "{\"accounts\": [...], \"item\": {...}}" } ``` -------------------------------- ### Deployment Structure Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/COMPLETION-REPORT.md Lists the directory structure and markdown files generated for the Plaid Node SDK documentation. ```markdown output/ ├── 00-START-HERE.md # Entry point ├── README.md # Main overview ├── INDEX.md # Complete index ├── COMPLETION-REPORT.md # This file ├── configuration.md ├── quickstart.md ├── types.md ├── errors.md └── api-reference/ ├── plaid-api-class.md ├── accounts-methods.md ├── auth-methods.md ├── transactions-methods.md ├── items-methods.md ├── link-token-methods.md ├── identity-methods.md ├── transfers-methods.md ├── sandbox-methods.md └── processor-methods.md ``` -------------------------------- ### Auth Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve auth data, including account and routing numbers. ```APIDOC ## authGet ### Description Retrieve auth data, including account and routing numbers. ### Method POST ### Endpoint /auth/get ### Parameters #### Request Body - **access_token** (string) - Required - The access token associated with the Item data is being requested for. ### Request Example { "example": "{\"access_token\": \"access-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **accounts** (array) - Description - **item** (object) - Description #### Response Example { "example": "{\"accounts\": [...], \"item\": {...}}" } ``` -------------------------------- ### Asset Report Audit Copy Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve an Asset Report Audit Copy. ```APIDOC ## assetReportAuditCopyGet ### Description Retrieve an Asset Report Audit Copy. ### Method POST ### Endpoint /asset_report/audit_copy/get ### Parameters #### Request Body - **asset_report_audit_copy_token** (string) - Required - The token for the Asset Report Audit Copy. ### Request Example { "example": "{\"asset_report_audit_copy_token\": \"audit-copy-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **report** (object) - Description - **warnings** (array) - Description #### Response Example { "example": "{\"report\": {...}, \"warnings\": []}" } ``` -------------------------------- ### Get Real-Time Balance Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/README.md Retrieve the current balance for each account associated with a user's Item. ```typescript const response = await plaidClient.accountsBalanceGet({ access_token: userAccessToken, }); response.data.accounts.forEach(account => { console.log(`${account.name}: ${account.balances.current}`); }); ``` -------------------------------- ### Sandbox Methods Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/README.md Utilities for testing with Plaid's sandbox environment. ```APIDOC ## Sandbox Methods ### Description Utilities for testing with Plaid's sandbox environment. ### Methods - `sandboxPublicTokenCreate()` - Create test public token - `sandboxItemResetLogin()` - Simulate login error - `sandboxItemFireWebhook()` - Trigger test webhook - `sandboxTransactionsCreate()` - Create test transactions - `sandboxTransferSimulate()` - Simulate transfer - `sandboxBankTransferSimulate()` - Simulate bank transfer ``` -------------------------------- ### Initialize Plaid Client Source: https://github.com/plaid/plaid-node/blob/master/README.md Updates the client initialization pattern from a configuration object to a Configuration class instance. ```javascript const configs = { clientID: CLIENT_ID, secret: SECRET, env: plaid.environments.sandbox, options: { version: '2020-09-14', }, }; new plaid.Client(configs); ``` ```typescript const configuration = new Configuration({ basePath: PlaidEnvironments.sandbox, baseOptions: { headers: { 'PLAID-CLIENT-ID': CLIENT_ID, 'PLAID-SECRET': SECRET, 'Plaid-Version': '2020-09-14', }, }, }); new PlaidApi(configuration); ``` -------------------------------- ### Asset Report Audit Copy PDF Get Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/plaid-api-class.md Retrieve an Asset Report Audit Copy as PDF. ```APIDOC ## assetReportAuditCopyPdfGet ### Description Retrieve an Asset Report Audit Copy as PDF. ### Method POST ### Endpoint /asset_report/audit_copy/pdf/get ### Parameters #### Request Body - **asset_report_audit_copy_token** (string) - Required - The token for the Asset Report Audit Copy. ### Request Example { "example": "{\"asset_report_audit_copy_token\": \"audit-copy-sandbox-xxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}" } ### Response #### Success Response (200) - **content** (string) - Description (PDF content) #### Response Example { "example": "JVBERi0xLjQKJc... (PDF content)" } ``` -------------------------------- ### sandboxProcessorTokenCreate() Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/api-reference/sandbox-methods.md Creates a processor token in the sandbox environment. This token is used to connect Plaid with third-party processors. ```APIDOC ## sandboxProcessorTokenCreate() ### Description Create a processor token in sandbox. ### Method POST ### Endpoint /sandbox/processor/token/create ### Parameters #### Request Body - **access_token** (string) - Required - The access token for the Item - **institution_id** (string) - Required - The ID of the institution - **account_id** (string) - Required - The ID of the account - **processor** (string) - Required - The processor for which to create the token (e.g., "stripe", "dwolla", "apex") ### Request Example ```json { "access_token": "access-sandbox-xxxxxxxx", "institution_id": "ins_109508", "account_id": "account-123", "processor": "stripe" } ``` ### Response #### Success Response (200) - **processor_token** (string) - The created processor token. ``` -------------------------------- ### Get Accounts for an Item Source: https://github.com/plaid/plaid-node/blob/master/README.md Retrieve account details for a specific Plaid Item. You can optionally filter by `account_ids`. ```typescript const response = await plaidClient.accountsGet({ access_token, options: { account_ids: ['123456790'], }, }); console.log(response.data.accounts); ``` -------------------------------- ### Get Identity Information Source: https://github.com/plaid/plaid-node/blob/master/_autodocs/quickstart.md Fetch identity information for the user, such as name and date of birth. This requires the 'identity' product to be enabled. ```typescript const response = await plaidClient.identityGet({ access_token: userAccessToken, }); const identity = response.data.identity; console.log(`Name: ${identity.first_name} ${identity.last_name}`); console.log(`DOB: ${identity.date_of_birth}`); ```