> ## 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 account

> Create a funding source by adding a bank account to a Main Dwolla Account. This endpoint allows you to connect a checking or savings account using either manual bank account details or an exchange resource.

For more information about funding sources, see the [Funding Sources API Reference](https://developers.dwolla.com/docs/api-reference/funding-sources).




## OpenAPI

````yaml post /funding-sources
openapi: 3.1.0
info:
  title: Dwolla API
  description: Dwolla API Documentation
  contact:
    name: Dwolla Developer Relations Team
    url: https://developers.dwolla.com
    email: api@dwolla.com
  version: '2.0'
  termsOfService: https://www.dwolla.com/legal/tos/
  license:
    name: MIT
    url: https://github.com/Dwolla/dwolla-openapi/blob/master/LICENSE
servers:
  - url: https://api.dwolla.com
    description: Production server
  - url: https://api-sandbox.dwolla.com
    description: Sandbox server
security:
  - clientCredentials: []
tags:
  - name: tokens
    description: Operations related to Application Access Tokens
  - name: root
    description: Root API operations
  - name: accounts
    description: Operations related to Accounts
  - name: customers
    description: Operations related to Customers
  - name: kba
    description: Operations related to Knowledge-Based Authentication
  - name: beneficial owners
    description: Operations related to Beneficial Owners
  - name: documents
    description: Operations related to Documents
  - name: exchanges
    description: Operations related to Exchanges
  - name: exchange sessions
    description: Operations related to Exchange Sessions
  - name: funding sources
    description: Operations related to Funding Sources
  - name: transfers
    description: Operations related to Transfers
  - name: labels
    description: Operations related to Labels
  - name: mass payments
    description: Operations related to Mass Payments
  - name: events
    description: Operations related to Events
  - name: webhook subscriptions
    description: Operations related to Webhook Subscriptions
  - name: webhooks
    description: Operations related to Webhooks
  - name: client tokens
    description: Operations related to Client Tokens
  - name: sandbox simulations
    description: Sandbox-only operations for simulating processing of bank transfers
paths:
  /funding-sources:
    post:
      tags:
        - accounts
      summary: Create a funding source for an account
      description: >
        Create a funding source by adding a bank account to a Main Dwolla
        Account. This endpoint allows you to connect a checking or savings
        account using either manual bank account details or an exchange
        resource.


        For more information about funding sources, see the [Funding Sources API
        Reference](https://developers.dwolla.com/docs/api-reference/funding-sources).
      operationId: createFundingSource
      parameters:
        - $ref: '#/components/parameters/Accept'
      requestBody:
        required: true
        description: Parameters for the funding source to be created
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountFundingSource'
      responses:
        '201':
          description: successful operation
          headers:
            Location:
              $ref: '#/components/headers/Location'
        '400':
          description: Bad request or duplicate resource
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/BadRequestSchema'
                  - $ref: '#/components/schemas/DuplicateResourceSchema'
        '403':
          description: forbidden
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: forbidden
                  message:
                    type: string
                    example: Not authorized to create funding source.
      x-codeSamples:
        - lang: bash
          source: >
            POST https://api-sandbox.dwolla.com/funding-sources

            Content-Type: application/vnd.dwolla.v1.hal+json

            Accept: application/vnd.dwolla.v1.hal+json

            Authorization: Bearer
            pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY

            {
                "routingNumber": "222222226",
                "accountNumber": "123456789",
                "bankAccountType": "checking",
                "name": "My Bank"
            }
        - lang: javascript
          source: |
            // Using dwolla-v2 - https://github.com/Dwolla/dwolla-v2-node
            var requestBody = {
              routingNumber: "222222226",
              accountNumber: "123456789",
              bankAccountType: "checking",
              name: "My Bank",
            };

            dwolla
              .post("funding-sources", requestBody)
              .then((res) => res.headers.get("location")); // => 'https://api-sandbox.dwolla.com/funding-sources/04173e17-6398-4d36-a167-9d98c4b1f1c3'
        - lang: python
          source: >
            # Using dwollav2 - https://github.com/Dwolla/dwolla-v2-python

            request_body = {
              'routingNumber': '222222226',
              'accountNumber': '123456789',
              'bankAccountType': 'checking',
              'name': 'My Bank'
            }


            funding_source = app_token.post('funding-sources', request_body)

            funding_source.headers['location'] # =>
            'https://api-sandbox.dwolla.com/funding-sources/04173e17-6398-4d36-a167-9d98c4b1f1c3'
        - lang: php
          source: >
            <?php

            // Using dwollaswagger -
            https://github.com/Dwolla/dwolla-swagger-php

            $fundingApi = new DwollaSwagger\FundingsourcesApi($apiClient);


            $fundingSource = $fundingApi->createFundingSource([
              "routingNumber" => "222222226",
              "accountNumber" => "123456789",
              "bankAccountType" => "checking",
              "name" => "My Bank"
            ]);

            $fundingSource; # =>
            "https://api-sandbox.dwolla.com/funding-sources/04173e17-6398-4d36-a167-9d98c4b1f1c3"

            ?>
        - lang: ruby
          source: >
            # Using dwolla_v2 - https://github.com/Dwolla/dwolla-v2-ruby

            request_body = {
              routingNumber: '222222226',
              accountNumber: '123456789',
              bankAccountType: 'checking',
              name: 'My Bank'
            }


            funding_source = app_token.post "funding-sources", request_body

            funding_source.response_headers[:location] # =>
            "https://api-sandbox.dwolla.com/funding-sources/04173e17-6398-4d36-a167-9d98c4b1f1c3"
components:
  parameters:
    Accept:
      name: Accept
      in: header
      required: true
      description: >-
        The media type of the response. Must be
        application/vnd.dwolla.v1.hal+json
      schema:
        type: string
        enum:
          - application/vnd.dwolla.v1.hal+json
        default: application/vnd.dwolla.v1.hal+json
  schemas:
    CreateAccountFundingSource:
      title: CreateAccountFundingSource
      type: object
      properties:
        _links:
          type: object
          properties:
            exchange:
              type: object
              properties:
                href:
                  type: string
        name:
          type: string
        bankAccountType:
          type: string
          enum:
            - checking
            - savings
        accountNumber:
          type: string
        routingNumber:
          type: string
        channels:
          type: array
          items:
            type: string
      required:
        - name
        - bankAccountType
        - accountNumber
        - routingNumber
    BadRequestSchema:
      title: BadRequestSchema
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: ValidationError
        message:
          type: string
          example: >-
            Validation error(s) present. See embedded errors list for more
            details.
        _embedded:
          type: object
          properties:
            code:
              type: string
              example: ValidationError
            message:
              type: string
              example: >-
                Validation error(s) present. See embedded errors list for more
                details.
    DuplicateResourceSchema:
      title: DuplicateResourceSchema
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: DuplicateResource
        message:
          type: string
          example: 'Bank already exists: id=df8392e5-4c06-42ed-b247-c098ed6f5a11'
        _links:
          type: object
          properties:
            about:
              type: object
              properties:
                href:
                  type: string
                  example: >-
                    https://api.dwolla.com/funding-sources/df8392e5-4c06-42ed-b247-c098ed6f5a11
                type:
                  type: string
                  example: application/vnd.dwolla.v1.hal+json
                resource-type:
                  type: string
                  example: funding-source
  headers:
    Location:
      description: The location of the created resource
      schema:
        type: string
  securitySchemes:
    clientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /token
          x-speakeasy-token-endpoint-authentication: client_secret_basic
          scopes: {}

````