> ## 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 an exchange for an account

> Create an exchange for an account. The request body will vary based on the exchange partner.
For Finicity, the request body will include finicity-specific fields.
For MX Secure Exchange, the request body will include a token.
For Flinks Secure Exchange, the request body will include a token.
For Plaid Secure Exchange, the request body will include a token.




## OpenAPI

````yaml post /exchanges
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:
  /exchanges:
    post:
      tags:
        - exchanges
      summary: Create an exchange for an account
      description: >
        Create an exchange for an account. The request body will vary based on
        the exchange partner.

        For Finicity, the request body will include finicity-specific fields.

        For MX Secure Exchange, the request body will include a token.

        For Flinks Secure Exchange, the request body will include a token.

        For Plaid Secure Exchange, the request body will include a token.
      operationId: createAccountExchange
      requestBody:
        required: true
        description: Parameters for creating an exchange
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/CreateFinicitySecureExchange'
                - $ref: '#/components/schemas/CreateTokenBasedExchange'
      responses:
        '201':
          description: Created
          headers:
            Location:
              $ref: '#/components/headers/Location'
              example: >-
                https://api.dwolla.com/exchanges/fcd15e5f-8d13-4570-a9b7-7fb49e55941d
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                type: object
        '400':
          description: Bad Request
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/InvalidExchangeToken'
                  - $ref: '#/components/schemas/InvalidExchange'
        '401':
          description: Invalid Scope
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: InvalidExchange
                  message:
                    type: string
                    example: The exchange is no longer active.
        '403':
          description: Forbidden
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Not Found
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
components:
  schemas:
    CreateFinicitySecureExchange:
      title: CreateFinicitySecureExchange
      type: object
      required:
        - _links
        - finicity
      properties:
        _links:
          type: object
          properties:
            exchange-partner:
              type: object
              properties:
                href:
                  type: string
                  example: >-
                    https://api.dwolla.com/exchange-partners/292317ec-e252-47d8-93c3-2d128e037aa4
        finicity:
          type: object
          properties:
            profile:
              type: integer
              format: int32
              example: 3
            version:
              type: string
              example: '1'
            receiptId:
              type: string
              example: cr_4N47ou7SlppuIxq0ZUtACh10vYcloY
            receiptVersion:
              type: string
              example: '1'
            customerId:
              type: string
              example: '5454874858510164117'
            partnerId:
              type: integer
              format: int64
              example: 2445583946651
            products:
              type: array
              items:
                type: object
                properties:
                  product:
                    type: string
                    example: moneyTransferDetails
                  accountId:
                    type: string
                    example: '1015199035827334916'
                  accessPeriod:
                    type: object
                    properties:
                      type:
                        type: string
                        example: timeframe
                      startTime:
                        type: string
                        format: date
                        example: '2022-07-06'
                      endTime:
                        type: string
                        format: date-time
                        example: '2022-08-16T06:06:20Z'
            timestamp:
              type: string
              format: date-time
              example: '2022-07-11T06:06:23Z'
    CreateTokenBasedExchange:
      title: CreateTokenBasedExchange
      description: >-
        Create an exchange using a token. Supports MX, Plaid, and Flinks secure
        exchange flows, and Checkout.com for Push to Card (debit card).
      type: object
      required:
        - _links
        - token
      properties:
        _links:
          type: object
          required:
            - exchange-partner
          properties:
            exchange-partner:
              type: object
              properties:
                href:
                  type: string
                  example: >-
                    https://api.dwolla.com/exchange-partners/292317ec-e252-47d8-93c3-2d128e037aa4
        token:
          type: string
          description: >-
            Connection or processor token from the exchange partner (e.g.,
            Plaid, MX, Flinks), or payment ID (pay_xxx) from Checkout.com Flow
            for Push to Card
          example: sandbox-token-abc123
    InvalidExchangeToken:
      title: InvalidExchangeToken
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: InvalidExchangeToken
        message:
          type: string
          example: Exchange token is expired.
    InvalidExchange:
      title: InvalidExchange
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: InvalidExchange
        message:
          type: string
          example: The exchange is no longer active.
    ForbiddenError:
      title: ForbiddenError
      description: Error response schema for 403 Forbidden
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: Forbidden
        message:
          type: string
          example: The supplied credentials are not authorized for this resource.
    NotFoundError:
      title: NotFoundError
      description: Error response schema for 404 NotFound
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: NotFound
        message:
          type: string
          example: The requested resource was not found.
  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: {}

````