> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bigcapital.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Plaid Setup

> This guide will walk you through configuring Plaid for your self-managed Bigcapital instance. You will learn how to obtain your Plaid credentials, set up the required environment variables, and configure webhooks. 

### 1. Obtain Your Plaid Credentials

To connect Bigcapital (self-hosted) to Plaid, you need your **Client ID** and **Secret**. These can be found in your Plaid Dashboard:

1. Log in to your [Plaid Dashboard](https://dashboard.plaid.com/).
2. Navigate to **Developers** > **Keys** or go directly to [Account Keys](https://dashboard.plaid.com/account/keys).
3. Copy your **Client ID** and **Secret** for the environment you wish to use (Sandbox, Development, or Production).

<Warning>
  Never share your secret key publicly. Treat it like a password.
</Warning>

### 2. Configure Environment Variables

Add the following environment variables to your `.env` file or your deployment environment:

```bash theme={null}
# The Plaid environment to use ('sandbox', 'development', or 'production').
# See: https://plaid.com/docs/#api-host
PLAID_ENV=sandbox

# Your Plaid keys, which can be found in the Plaid Dashboard.
# https://dashboard.plaid.com/account/keys
PLAID_CLIENT_ID=your_client_id_here
PLAID_SECRET=your_secret_here

# (Optional) Webhook URL for Plaid Link events.
PLAID_LINK_WEBHOOK=https://your-domain.com/api/banking/plaid/webhooks
```

<Warning>
  If your <code>PLAID\_SECRET</code> is for the <strong>production</strong>{' '}
  environment, make sure to set <code>PLAID\_ENV=production</code> to match.
  Using the wrong environment may cause authentication errors or prevent access
  to live data.
</Warning>

### Variable Descriptions

* **PLAID\_ENV**: The Plaid environment to use. Use `sandbox` for testing, `development` for real data with limited access, or `production` for live data.
* **PLAID\_CLIENT\_ID**: Your unique Plaid client ID from the dashboard.
* **PLAID\_SECRET**: Your Plaid secret key from the dashboard.
* **PLAID\_LINK\_WEBHOOK**: (Optional) The URL where Plaid will send webhook events. This should be publicly accessible if you want to receive real-time updates from Plaid.

### 4. Setting Up the Webhook (Optional)

If you want to receive real-time updates from Plaid (such as transaction updates), you need to set up a webhook:

1. Deploy your API endpoint to a publicly accessible URL (e.g., using [ngrok](https://ngrok.com/) for local development).
2. Set the `PLAID_LINK_WEBHOOK` variable to your endpoint URL.
3. Ensure your endpoint is configured to handle Plaid webhook events. See [Plaid Webhooks Documentation](https://plaid.com/docs/api/webhooks/) - To configure your webhook URL in the Plaid Dashboard.
   * From [Plaid Dashboard](https://dashboard.plaid.com/). Go to **Developers** > **Webhook URLs**.
   * Click **Add webhook URL** (or edit an existing one).
   * Enter your endpoint URL (the same as `PLAID_LINK_WEBHOOK`).
   * Save your changes. For more details, see the [Plaid Webhook Configuration Guide](https://plaid.com/docs/api/webhooks/#registering-webhooks).

### 5. Enable Bank Feeds Feature

After completing the Plaid configuration, you must enable the bank feeds feature in your environment. Add the following variable to your `.env` file or deployment environment:

```bash theme={null}
BANK_FEED_ENABLED=true
```

This setting activates the bank feeds integration, allowing your Bigcapital instance to sync and process bank transactions via Plaid.

### Additional Resources

* [Plaid API Documentation](https://plaid.com/docs/)
* [Plaid Dashboard](https://dashboard.plaid.com/)
* [Plaid Webhooks](https://plaid.com/docs/api/webhooks/)
