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

# Plaid

> Import your customers' external bank account and credit card activity into Layer with Plaid.

Layer uses [Plaid](https://plaid.com/) to connect to your customers' accounts at external financial institutions. Once an account is connected, Layer ingests its transactions and balances and incorporates them into the customer's books.

There are two ways to connect Plaid accounts, depending on whether your platform already has a Plaid integration:

* **Use Layer's Plaid connection** - Layer manages the Plaid relationship on your behalf. Best if you don't already integrate with Plaid.
* **Use your own Plaid connection** - Keep your existing Plaid relationship and grant Layer access to the data.

## Use Layer's Plaid connection

Your customers link their accounts through a Layer-powered flow, and Layer handles credential management, connection health, and data ingestion.

You can present the linking flow in two ways:

<CardGroup cols={2}>
  <Card title="Embedded components" icon="puzzle-piece" href="/embedded-components/components/link-accounts">
    Drop Layer's prebuilt, white-labeled account linking component into your app.
  </Card>

  <Card title="Custom Plaid Link UI" icon="paintbrush" href="/guides/custom-plaid-account-linking">
    Build your own account linking experience on top of Plaid Link, powered by Layer's Plaid connection.
  </Card>
</CardGroup>

Both options grant Layer read-only access to the customer's bank account and credit card activity. Once accounts are connected, transactions begin flowing into Layer automatically.

## Use your own Plaid connection

If your platform already integrates with Plaid, you don't need to ask customers to link their accounts again. Grant Layer access to your existing Plaid data using processor tokens.

<Steps>
  <Step title="Create a processor token">
    [Link](https://plaid.com/docs/link/#link-flow-overview) a customer's bank account with Plaid as usual, obtaining an `access_token`. Then create a processor token for each account via Plaid's [/processor/token/create](https://plaid.com/docs/api/processors/#processortokencreate) endpoint, specifying `layer` as the processor.

    ```bash Request theme={null}
    curl -X POST https://sandbox.plaid.com/processor/token/create \
      -H 'Content-Type: application/json' \
      -d '{
        "client_id": "PLAID_CLIENT_ID",
        "secret": "PLAID_SECRET",
        "access_token": "ACCESS_TOKEN",
        "account_id": "ACCOUNT_ID",
        "processor": "layer"
      }'
    ```
  </Step>

  <Step title="Attach the tokens to a business">
    Pass the processor tokens when [creating a business](/api-reference/v1/create-business), or [update an existing business](/api-reference/v1/update-business) with them. Layer begins ingesting data from the associated accounts immediately.

    ```bash Request theme={null}
    curl -X PUT https://sandbox.layerfi.com/v1/businesses/{businessId} \
      -H "Authorization: Bearer <access_token>" \
      -H "Content-Type: application/json" \
      -d '{
        "plaid_processor_tokens": [
          { "processor_token": "processor-sandbox-0asd1-a92nc" }
        ]
      }'
    ```

    <Warning>
      Updates replace the full list of processor tokens on the business. Include every token you want associated, since any existing tokens omitted from the request are removed.
    </Warning>
  </Step>
</Steps>

If a Plaid account's access token changes, its processor tokens are invalidated. Create a new processor token and update the business with the refreshed list. To see which processor tokens are currently associated with a business, call [List Plaid Accounts](/api-reference/plaid-account/list-plaid-accounts).

For the full walkthrough, see the [bank data guide](/guides/importing-bank-data).
