# Create Bank Account

<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/user/bank</td></tr></tbody></table>

Link an end user's bank account to their sFOX account.

***

## 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.
* sFOX accounts only support one linked bank account at a time. If you would like to add a different bank, you must [disconnect the currently linked bank](https://docs.sfox.com/connect/rest-api/payments/delete-bank-account).
  {% endhint %}

### Body Parameters

<table><thead><tr><th width="201.27734375">Name</th><th width="94.7421875">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>type</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td><p>Whether the bank account is for an individual or corporation. Possible values:</p><p><code>individual</code> or <code>corporate</code></p></td></tr><tr><td><strong><code>bankAccountType</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>Whether the bank account is a checking or savings account. Possible values: <code>checking</code> or <code>savings</code></td></tr><tr><td><strong><code>isInternational</code></strong> <mark style="color:red;">required</mark></td><td>boolean</td><td>If the bank account is from an international bank. (US = <code>False</code>, International = <code>True</code>)</td></tr><tr><td><strong><code>accountnumber</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>Account number of the bank account.</td></tr><tr><td><strong><code>routingnumber</code></strong></td><td>string</td><td>Routing number of the bank. <strong>Required if <code>isInternational</code> = <code>False</code></strong></td></tr><tr><td><strong><code>swiftnumber</code></strong></td><td>string</td><td>SWIFT number of the bank. <strong>Required if <code>isInternational</code> = <code>True</code></strong></td></tr><tr><td><strong><code>enableWires</code></strong> <mark style="color:red;">required</mark></td><td>boolean</td><td>Whether the bank account is enabled to process wire transfers.</td></tr><tr><td><strong><code>firstname</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>First name on bank account.<br><em>If <code>type</code> = <code>corporate</code>, specify the first name of the person who is the primary owner of the account.</em></td></tr><tr><td><strong><code>lastname</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>Last name on bank account.<br><em>If <code>type</code> = <code>corporate</code>, specify the last name of the person who is the primary owner of the account.</em></td></tr><tr><td><strong><code>name</code></strong></td><td>string</td><td>Name of the business on the bank account. <strong>Required if <code>type</code> = <code>corporate</code></strong></td></tr><tr><td><strong><code>bankCurrency</code></strong> </td><td>string</td><td>Currency code that the bank account transacts in. e.g. <code>usd</code></td></tr><tr><td><strong><code>bankname</code></strong></td><td>string</td><td>Name of the bank. <strong>Required if <code>isInternational</code> = <code>True</code></strong></td></tr><tr><td><strong><code>wireInstructions</code></strong></td><td>string</td><td>Memo/correspondent bank/for further credit. <strong>Only applicable if <code>isInternational</code> = <code>True</code></strong></td></tr><tr><td><strong><code>wireRoutingnumber</code></strong></td><td>string</td><td>Routing number for wire transactions. <strong>Required if <code>isInternational</code> = <code>False</code></strong></td></tr></tbody></table>

### Example Requests

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

```shell
curl -X POST \
  -H 'Content-type: application/json' \
  -H "Authorization: Bearer ${USER_AUTH_TOKEN}" \
  --data '{ "accountnumber": "123456789",
          "bankAccountType": "checking",
          "bankCurrency": "usd",
          "enableWires": true,
          "firstname": "Sean",
          "isInternational": false,
          "lastname": "Fox",
          "name": "Sean Fox",
          "routingnumber": "987654321",
          "type": "individual",
          "wireRoutingnumber": "987654321" }'  \
  'https://api.sfox.com/v1/user/bank'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

const data = JSON.stringify({
    accountnumber: '123456789',
    bankAccountType: 'checking',
    bankCurrency: 'usd',
    enableWires: true,
    firstname: 'Sean',
    isInternational: false,
    lastname: 'Fox',
    name: 'Sean Fox',
    routingnumber: '987654321',
    type: 'individual',
    wireRoutingnumber: '987654321'
  }
)

const config = {
  method: 'post',
  url: 'https://api.sfox.com/v1/user/bank',
  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)
    });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

data = requests.post(
  "https://api.sfox.com/v1/user/bank",
  headers={
    "Authorization": f"Bearer {os.environ['USER_AUTH_TOKEN']}"
  },
  json={
    "accountnumber": "123456789",
    "bankAccountType": "checking",
    "bankCurrency": "usd",
    "enableWires": true,
    "firstname": "Sean",
    "isInternational": false,
    "lastname": "Fox",
    "name": "Sean Fox",
    "routingnumber": "987654321",
    "type": "individual",
    "wireRoutingnumber": "987654321"
  }
)
print(data.status_code)
print(data.json())
```

{% endtab %}
{% endtabs %}

### Request Body Examples

{% tabs %}
{% tab title="Individual US Bank" %}

<pre class="language-json"><code class="lang-json"><strong>{
</strong><strong>    "accountnumber": "123456789",
</strong><strong>    "bankAccountType": "checking",
</strong>    "bankCurrency": "usd",
    "enableWires": true,
    "firstname": "Sean",
    "isInternational": false,
    "lastname": "Fox",
<strong>    "name": "Sean Fox",
</strong>    "routingnumber": "987654321",
    "type": "individual",
    "wireRoutingnumber": "987654321"
}
</code></pre>

{% endtab %}

{% tab title="Individual International Bank" %}

```json
{
    "accountnumber": "123456789",
    "bankAccountType": "checking",
    "bankCurrency": "usd",
    "bankname": "BCB Group",
    "enableWires": true,
    "firstname": "Sean",
    "isInternational": true,
    "lastname": "Fox",
    "name": "Sean Fox",
    "swiftnumber": "987654321",
    "type": "individual",
    "wireInstructions": ""
}
```

{% endtab %}

{% tab title="Corporate US Bank" %}

```json
{
    "accountnumber": "123456789",
    "bankAccountType": "checking",
    "bankCurrency": "usd",
    "enableWires": true,
    "firstname": "Sean",
    "isInternational": false,
    "lastname": "Fox",
    "name": "Example Fund LP",
    "routingnumber": "987654321",
    "type": "corporate",
    "wireRoutingnumber": "987654321"
}
```

{% endtab %}

{% tab title="Corporate International Bank" %}

```json
{
    "accountnumber": "123456789",
    "bankAccountType": "checking",
    "bankCurrency": "usd",
    "bankname": "BCB Group",
    "enableWires": true,
    "firstname": "Sean",
    "isInternational": true,
    "lastname": "Fox",
    "name": "Sean Fox Hedge Fund",
    "swiftnumber": "987654321",
    "type": "corporate",
    "wireInstructions": ""
}
```

{% endtab %}
{% endtabs %}

## Responses

<details>

<summary><mark style="color:green;">200</mark>: OK</summary>

```json
{
    "usd": [
        {
            "id": "68983724-00da-11ef-862d-026c8f2aefd1",
            "status": "active",
            "requires_verification": 0,
            "requires_support": 0,
            "routing_number": "*****5821",
            "account_number": "*****14",
            "name1": "Sean Fox",
            "currency": "usd",
            "type": "checking",
            "bank_name": "US BANK NA",
            "ach_enabled": false,
            "international_bank": false,
            "ref_id": "aY1nN",
            "wire_withdrawal_fee": 30
        }
    ]
}
```

</details>
