# Create Bank Account (Plaid)

<table data-header-hidden><thead><tr><th width="74.8046875" align="center"></th><th></th></tr></thead><tbody><tr><td align="center"><mark style="color:blue;"><strong>POST</strong></mark> </td><td>https://api.sfox.com/v1/bank-accounts/plaid-processors</td></tr></tbody></table>

Link and verify an end user's bank account via Plaid processor token(s).

***

sFOX and Plaid have partnered to enable end users to instantly link and verify a bank account. sFOX will use the Plaid `processor_token` provided to securely retrieve bank account details from Plaid and enable ACH transfers.

## Request

{% hint style="info" %}

* Requires a [User Auth Token](https://docs.sfox.com/connect/rest-api/end-users/create-user-auth-token) for authentication. Requests attempted using an Connect API Key will result in an error.
* There is a limit of one linked bank account per sFOX account. If you would like to link a different bank account, you must first [disconnect the currently linked bank](https://docs.sfox.com/connect/rest-api/payments/delete-bank-account).
  {% endhint %}

### Body Parameters

<table><thead><tr><th width="202.58203125">Name</th><th width="105">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>data</code></strong> <mark style="color:red;">required</mark></td><td>[object]</td><td>The Plaid <code>processor_token</code>s and associated processors</td></tr><tr><td>    <strong><code>processor</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>The processor associated with this <code>token</code>.<br><br><em>Possible values: <code>sfox</code>, <code>dwolla</code></em></td></tr><tr><td>    <strong><code>token</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>The <code>processor_token</code> retrieved from Plaid.</td></tr></tbody></table>

### Example Requests

{% tabs %}
{% tab title="Shell" %}

```shell
#sFOX & Dwolla p-token: Link bank account and enable ACH transfers
curl -X POST 'https://api.sfox.com/v1/bank-accounts/plaid-processors' \
  -H 'Content-type: application/json' \
  -H "Authorization: Bearer ${USER_AUTH_TOKEN}" \
  -d '{ 
      "data": [
        {
          "processor": "sfox",
          "token": "${SFOX_PLAID_PROCESSOR_TOKEN}"
        },
        {
          "processor": "dwolla",
          "token": "${DWOLLA_PLAID_PROCESSOR_TOKEN}"
        }
      ]
   }'

#sFOX p-token only: Links bank account, does not enable ACH transfers
curl -X POST 'https://api.sfox.com/v1/bank-accounts/plaid-processors' \
  -H 'Content-type: application/json' \
  -H "Authorization: Bearer ${USER_AUTH_TOKEN}" \
  -d '{ 
      "data": [{
        "processor": "sfox",
        "token": "${SFOX_PLAID_PROCESSOR_TOKEN}"
      }]
   }'
```

{% endtab %}

{% tab title="NodeJS" %}
{% code overflow="wrap" %}

```javascript
//sFOX & Dwolla p-token: Link bank account and enable ACH transfers
const axios = require('axios');

const payload = JSON.stringify({
    "data": [
      {
        "processor": "sfox",
        "token": "${SFOX_PLAID_PROCESSOR_TOKEN}"
      },
      {
        "processor": "dwolla",
        "token": "${DWOLLA_PLAID_PROCESSOR_TOKEN}"
      }
    ]
})

const config = {
  method: 'post',
  url: 'https://api.sfox.com/v1/bank-accounts/plaid-processors',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.USER_AUTH_TOKEN}`
  },
  data: data
}

axios(config)
  .then(response => {
    console.log(response.status)
    console.log(response.data)
  }).catch(err => {
    console.error(err.response.status)
    console.error(err.response.data)
  });


  
//sFOX p-token only: Links bank account, does not enable ACH transfers
const axios = require('axios');

const payload = JSON.stringify({
    "data": [
      {
        "processor": "sfox",
        "token": "${SFOX_PLAID_PROCESSOR_TOKEN}"
      }
    ]
})

const config = {
  method: 'post',
  url: 'https://api.sfox.com/v1/bank-accounts/plaid-processors',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.USER_AUTH_TOKEN}`
  },
  data: data
}

axios(config)
  .then(response => {
    console.log(response.status)
    console.log(response.data)
  }).catch(err => {
    console.error(err.response.status)
    console.error(err.response.data)
  });
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}

```python
#sFOX & Dwolla p-token: Link bank account and enable ACH transfers
import requests
import os

data = requests.post(
  "https://api.sfox.com/v1/bank-accounts/plaid-processors",
  headers={
    "Authorization": f"Bearer {os.environ['USER_AUTH_TOKEN']}"
  },
  json={
    "data": [
      {
        "processor": "sfox",
        "token": "SFOX_PLAID_PROCESSOR_TOKEN"
      },
      {
        "processor": "dwolla",
        "token": "DWOLLA_PLAID_PROCESSOR_TOKEN"
      }      
    ]
  }
)
print(data.status_code)
print(data.json())



#sFOX p-token only: Links bank account, does not enable ACH transfers
import requests
import os

data = requests.post(
  "https://api.sfox.com/v1/bank-accounts/plaid-processors",
  headers={
    "Authorization": f"Bearer {os.environ['USER_AUTH_TOKEN']}"
  },
  json={
    "data": [
      {
        "processor": "sfox",
        "token": "PLAID_PROCESSOR_TOKEN"
      }
    ]
  }
)
print(data.status_code)
print(data.json())
```

{% endtab %}
{% endtabs %}

## Response

### Response Body

<table><thead><tr><th width="191.47265625">Name</th><th width="105">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>data</code></strong></td><td>[object]</td><td>The Plaid <code>processor_token</code>s and associated processors</td></tr><tr><td>    <strong><code>processor</code></strong></td><td>string</td><td>The processor associated with the token that was processed.<br><br><em>Possible values: <code>sfox</code>, <code>dwolla</code></em></td></tr><tr><td>    <strong><code>status</code></strong></td><td>string</td><td>The status of processing the token.</td></tr><tr><td>    <strong><code>bank_account_id</code></strong></td><td>string</td><td>The ID of the associated bank account. (<code>id</code> from <a href="get-bank-account">Get Bank Account</a>)</td></tr><tr><td>    <strong><code>date_added</code></strong></td><td>string</td><td>Date-time the token was added.</td></tr><tr><td>    <strong><code>date_updated</code></strong></td><td>string</td><td>Date-time the token was last updated.</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;">201</mark>: Created</summary>

sFOX and Dwolla p-tokens processed successfully

{% code overflow="wrap" %}

```json
{
    "data": [
        {
            "processor": "sfox",
            "status": "created",
            "bank_account_id": "05a59670-e7c2-4611-a356-d20cae93e939",
            "date_added": "2025-05-14T01:55:35.664Z",
            "date_updated": "2025-05-14T01:55:35.664Z"
        },
        {
            "processor": "dwolla",
            "status": "created",
            "bank_account_id": "05a59670-e7c2-4611-a356-d20cae93e939",
            "date_added": "2025-05-14T01:55:38.786Z",
            "date_updated": "2025-05-14T01:55:38.786Z"
        }
    ]
}
```

{% endcode %}

sFOX p-token successfully processed

{% code overflow="wrap" %}

```json
{
    "data": [
        {
            "processor": "sfox",
            "status": "created",
            "bank_account_id": "05a59670-e7c2-4611-a356-d20cae93e939",
            "date_added": "2025-05-14T01:55:35.664Z",
            "date_updated": "2025-05-14T01:55:35.664Z"
        }
    ]
}
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;">422</mark>: Unprocessable Entity</summary>

Active bank account is linked to this end user's account. To link a new bank account, [remove the current bank account](https://docs.sfox.com/connect/rest-api/payments/delete-bank-account) and try again.

{% code overflow="wrap" %}

```json
{
    "error": "could not process your sfox processor token: This account already has a bank account linked to it that is active"
}
```

{% endcode %}

sFOX p-token not included in a request with a Dwolla p-token.

{% code overflow="wrap" %}

```json
{
    "error": "At least one sfox processor token is required if a dwolla processor token is given"
}
```

{% endcode %}

</details>
