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

# Create a funding source for an external party

> Endpoint for creating funding sources for external parties.

# Create a Funding Source for an External Party

This section details how to add a bank account to external parties. To add a bank account to an external party, you can use one of two methods:

* Option 1: Provide the account number, routing number, type, and a nickname.
* Option 2: Create an exchange for the external party, which will create a secure connection between Dwolla and a third-party provider for account creation and verification.

Funding Sources are relational to an External Party and have the ability to send and receive funds.

## HTTP request

`POST https://api.dwolla.com/external-parties/{id}/funding-sources`

## Request parameters

| Parameter       | Required | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------------- | -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| routingNumber   | yes      | string | A bank routing number that identifies a bank or credit union in the U.S. Note: Validation of the routing number includes: a checksum, the first two digits of the routing number must fall within the range "01" through "12", or "21" through "32", and the string value must consist of nine digits.                                                                                                                                                                                                                                                                                        |
| accountNumber   | yes      | string | The bank account number. Note: The account number is validated to check if it is a numeric string of 4-17 digits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| bankAccountType | yes      | string | Type of bank account: `checking`, `savings`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| name            | yes      | string | Arbitrary nickname for the funding source. Must be 50 characters or less.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| correlationId   | no       | string | A unique string value attached to a funding source which can be used for traceability between Dwolla and your application. **Note:** A correlationId is not a replacement for an [idempotency-key](https://developers.dwolla.com/api-reference#idempotency-key). <br /> Must be less than or equal to 255 characters and contain no spaces. <br /> Acceptable characters are: `a-Z`, `0-9`, `-`, `.`, and `_`. <br /> **Note:** Sensitive Personal Identifying Information (PII) should not be used in this field and it is recommended to use a random value for correlationId, like a UUID. |

## HTTP status and error codes

| HTTP Status | Code       | Message                                                                 | Description                                                                                                                                                                                                                       |
| ----------- | ---------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 201         | Created    | Success                                                                 | Funding source created.                                                                                                                                                                                                           |
| 400         | BadRequest | Validation error(s) present. See embedded errors list for more details. | An error exists with the request. Check the embedded list of errors for more detailed error messages. Also check [Validation Errors](https://developers.dwolla.com/api-reference#validation-errors) section in the API reference. |
| 404         | NotFound   | The requested resource was not found.                                   | External Party not found. Check External Party Id.                                                                                                                                                                                |

## Request and response

```bash theme={"dark"}
POST https://api.dwolla.com/external-parties/{id}/funding-sources
Authorization: Bearer connect.eyJraWQiOiJPNVVOUVR0VHdDSXBcL0lsYnNlWldtdUFVZHJaVjFuU3lIYlVubkpwYW54WT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIzZ2I3dTQyMjFkb2RwYWYwdGNyM3VrZm04MSIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYnliLWFwaVwvZXh0ZXJuYWwtcGFydGllczpleGNoYW5nZXMuY3JlYXRlIGJ5Yi1hcGlcL2FjY291bnRzLnJlYWQgYnliLWFwaVwvZXhjaGFuZ2VzLmNyZWF0ZSBieWItYXBpXC9leHRlcm5hbC1wYXJ0aWVzLmNyZWF0ZSBieWItYXBpXC90cmFuc2ZlcnMuY3JlYXRlIGJ5Yi1hcGlcL2V4dGVybmFsLXBhcnRpZXM6ZXhjaGFuZ2VzLnJlYWQgYnliLWFwaVwvdHJlYXN1cnktYWNjb3VudHMucmVhZCBieWItYXBpXC90cmFuc2ZlcnMucmVhZCBieWItYXBpXC9leGNoYW5nZXMucmVhZCBieWItYXBpXC93ZWJob29rLXN1YnNjcmlwdGlvbnMuZGVsZXRlIGJ5Yi1hcGlcL3RyZWFzdXJ5LWFjY291bnRzLmNyZWF0ZSBieWItYXBpXC9leHRlcm5hbC1wYXJ0aWVzOmZ1bmRpbmctc291cmNlcy5yZWFkIG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ufB3pNz25jdV6667W1ZGVt5j6P_vMY1DYnTTZZ6KI3pAT9Mvbqp892pdcNbzZhfIvyl5gheiKnpxUdGK-mwBPpKolDWnFw4G7_gyJB4lVqPg9bXdDGwyFuvgZj2K1xQyEWHfXymveaQ6j1SPy7hLcpHwnyGzp5DXFtp7j8iOkFoqZVp9HzeDqGje2g

{
  "routingNumber": "222222226",
  "accountNumber": "123456789",
  "bankAccountType": "checking",
  "name": "Jane Doe's Checking"
}

HTTP/1.1 201 Created
Location: https://api.dwolla.com/funding-sources/fc451a7a-ae30-4404-aB95-e3553fcd7
```

```php theme={"dark"}
/**
 * No example for this language yet.
 **/
```

```ruby theme={"dark"}
# Using dwolla_v2 - https://github.com/Dwolla/dwolla-v2-ruby
external_party_url = 'https://api.dwolla.com/external-parties/AB443D36-3757-44C1-A1B4-29727FB3111C'
request_body = {
  routingNumber: '222222226',
  accountNumber: '123456789',
  bankAccountType: 'checking',
  name: 'Jane Doe’s Checking'
}

funding_source = app_token.post "#{external_party_url}/funding-sources", request_body
funding_source.response_headers[:location] # => "https://api.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31"
```

```python theme={"dark"}
# Using dwollav2 - https://github.com/Dwolla/dwolla-v2-python
external_party_url = 'https://api.dwolla.com/external-parties/AB443D36-3757-44C1-A1B4-29727FB3111C'
request_body = {
  'routingNumber': '222222226',
  'accountNumber': '123456789',
  'bankAccountType': 'checking',
  'name': 'Jane Doe’s Checking'
}

fundingSource = app_token.post('%s/funding-sources' % external_party_url, request_body)
fundingSource.headers['location'] # => 'https://api.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31'
```

```javascript theme={"dark"}
// Using dwolla-v2 - https://github.com/Dwolla/dwolla-v2-node
var externalPartyUrl =
  "https://api.dwolla.com/external-parties/AB443D36-3757-44C1-A1B4-29727FB3111C";

var requestBody = {
  routingNumber: "222222226",
  accountNumber: "123456789",
  bankAccountType: "checking",
  name: "Jane Doe’s Checking",
};

dwolla
  .post(`${externalPartyUrl}/funding-sources`, requestBody)
  .then((res) => res.headers.get("location")); // => 'https://api.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31'
```

### Request and response - using an exchange

```bash theme={"dark"}
POST https://api.dwolla.com/external-parties/99bfb139-eadd-4cdf-b346-7504f0c16c60/funding-sources
Content-Type: application/vnd.dwolla.v1.hal+json
Accept: application/vnd.dwolla.v1.hal+json
Authorization: Bearer pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY
{
  "_links": {
    "exchange": {
      "href": "https://api.dwolla.com/exchanges/6bc9109a-04fd-49b6-ace6-ca06fd282d65"
    }
  },
  "bankAccountType": "checking",
  "name": "Jane Doe - Checking"
}

HTTP/1.1 201 Created
Location: https://api.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31
```

```php theme={"dark"}
/**
 * No example for this language yet.
 **/
```

```ruby theme={"dark"}
# Using dwolla_v2 - https://github.com/Dwolla/dwolla-v2-ruby
external_parties_url = 'https://api.dwolla.com/external-parties/AB443D36-3757-44C1-A1B4-29727FB3111C'
request_body = {
  _links: {
    'exchange': {
      href: "https://api.dwolla.com/exchanges/6bc9109a-04fd-49b6-ace6-ca06fd282d65"
    }
  },
  bankAccountType: 'checking',
  name: 'Jane Doe’s Checking'
}

funding_source = app_token.post "#{external_parties_url}/funding-sources", request_body
funding_source.response_headers[:location] # => "https://api.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31"
```

```python theme={"dark"}
# Using dwollav2 - https://github.com/Dwolla/dwolla-v2-python
external_party_url = 'https://api.dwolla.com/external-parties/AB443D36-3757-44C1-A1B4-29727FB3111C'
request_body = {
  '_links': {
    'exchange': {
      'href': 'https://api.dwolla.com/exchanges/6bc9109a-04fd-49b6-ace6-ca06fd282d65'
    }
  },
  'bankAccountType': 'checking',
  'name': 'Jane Doe’s Checking'
}

funding_source = app_token.post('%s/funding-sources' % external_party_url, request_body)
funding_source.headers['location'] # => 'https://api.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31'
```

```javascript theme={"dark"}
// Using dwolla-v2 - https://github.com/Dwolla/dwolla-v2-node
var exernalPartyUrl =
  "https://api.dwolla.com/external-parties/AB443D36-3757-44C1-A1B4-29727FB3111C";
var requestBody = {
  _links: {
    exchange: {
      href: "https://api.dwolla.com/exchanges/30e7c028-0bdf-e511-80de-0aa34a9b2388",
    },
  },
  bankAccountType: "checking",
  name: "Jane Doe’s Checking",
};

dwolla
  .post(`${externalPartyUrl}/funding-sources`, requestBody)
  .then((res) => res.headers.get("location")); // => 'https://api.dwolla.com/funding-sources/375c6781-2a17-476c-84f7-db7d2f6ffb31'
```
