> ## 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 customer exchange session

> Creates an exchange session for a customer. Use cases include:
- **Plaid / MX**: Instant bank account verification (open banking). For faster verification as compared to traditional micro-deposits.
- **Checkout.com**: Debit card capture for Push to Card. Create a session, then retrieve it to get `externalProviderSessionData` (payment session) for the Checkout.com Flow component.




## OpenAPI

````yaml post /customers/{id}/exchange-sessions
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:
  /customers/{id}/exchange-sessions:
    post:
      tags:
        - exchange sessions
      summary: Create customer exchange session
      description: >
        Creates an exchange session for a customer. Use cases include:

        - **Plaid / MX**: Instant bank account verification (open banking). For
        faster verification as compared to traditional micro-deposits.

        - **Checkout.com**: Debit card capture for Push to Card. Create a
        session, then retrieve it to get `externalProviderSessionData` (payment
        session) for the Checkout.com Flow component.
      operationId: createCustomerExchangeSession
      parameters:
        - name: id
          in: path
          description: Customer's unique identifier
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/Accept'
      requestBody:
        description: Parameters for creating an exchange session
        required: true
        content:
          application/vnd.dwolla.v1.hal+json:
            schema:
              oneOf:
                - $ref: >-
                    #/components/schemas/CreateCustomerExchangeSessionWithRedirect
                - $ref: '#/components/schemas/CreateCustomerExchangeSessionForWeb'
      responses:
        '201':
          description: created
          headers:
            Location:
              $ref: '#/components/headers/Location'
        '400':
          description: validation error
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                oneOf:
                  - type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: ValidationError
                      message:
                        type: string
                        example: /_links/exchange-partner/href is invalid
                  - type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: ValidationError
                      message:
                        type: string
                        example: /_links/redirect-url/href is invalid
                  - type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: ValidationError
                      message:
                        type: string
                        example: >-
                          The provided redirect URL must exactly match one of
                          the configured URLs for the account
        '401':
          description: unauthorized
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: InvalidScope
                  message:
                    type: string
                    example: Missing or invalid scopes for requested endpoint
        '403':
          description: forbidden
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                oneOf:
                  - type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: forbidden
                      message:
                        type: string
                        example: >-
                          The exchange partner specified does not support this
                          product
                  - type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: forbidden
                      message:
                        type: string
                        example: >-
                          Exchange sessions with this exchange partner are not
                          enabled for your account
        '404':
          description: Not Found
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
      x-codeSamples:
        - lang: bash
          source: >
            # Plaid Web Example

            POST
            https://api.dwolla.com/customers/74a207b2-b7b7-4efa-8bf8-582148e7b980/exchange-sessions

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

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

            Authorization: Bearer
            pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY


            {
              "_links": {
                "exchange-partner": {
                  "href": "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef"
                }
              }
            }


            # Plaid Android Example

            POST
            https://api.dwolla.com/customers/74a207b2-b7b7-4efa-8bf8-582148e7b980/exchange-sessions

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

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

            Authorization: Bearer
            pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY


            {
              "_links": {
                "exchange-partner": {
                  "href": "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef"
                },
                "redirect-url": {
                  "href": "com.example.app123"
                }
              }
            }


            # Plaid iOS Example

            POST
            https://api.dwolla.com/customers/74a207b2-b7b7-4efa-8bf8-582148e7b980/exchange-sessions

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

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

            Authorization: Bearer
            pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY


            {
              "_links": {
                "exchange-partner": {
                  "href": "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef"
                },
                "redirect-url": {
                  "href": "https://example.com/app123"
                }
              }
            }


            # MX Example

            POST
            https://api.dwolla.com/customers/74a207b2-b7b7-4efa-8bf8-582148e7b980/exchange-sessions

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

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

            Authorization: Bearer
            pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY


            {
              "_links": {
                "exchange-partner": {
                  "href": "https://api.dwolla.com/exchange-partners/2164407f-33c3-4555-a6a1-40d5e9e58744"
                }
              }
            }


            # Checkout.com (Push to Card / debit card) Example

            POST
            https://api-sandbox.dwolla.com/customers/bb0e1dc7-f2ea-4cca-b053-4049d49a1c0d/exchange-sessions

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

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

            Authorization: Bearer your_dwolla_access_token


            {
              "_links": {
                "exchange-partner": {
                  "href": "https://api-sandbox.dwolla.com/exchange-partners/d652517d-9c02-4ea4-87af-2977e6cf3850"
                }
              }
            }
        - lang: javascript
          source: |
            // Using dwolla-v2 - https://github.com/Dwolla/dwolla-v2-node
            // Plaid Web Example
            var customerUrl =
              "https://api.dwolla.com/customers/74a207b2-b7b7-4efa-8bf8-582148e7b980";
            var requestBodyPlaidWeb = {
              _links: {
                "exchange-partner": {
                  href: "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef",
                },
              },
            };
            dwolla
              .post(`${customerUrl}/exchange-sessions`, requestBodyPlaidWeb)
              .then((res) => res.headers.get("location"));
            // Plaid Android Example
            var requestBodyPlaidAndroid = {
              _links: {
                "exchange-partner": {
                  href: "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef",
                },
                "redirect-url": {
                  href: "com.example.app123",
                },
              },
            };
            dwolla
              .post(`${customerUrl}/exchange-sessions`, requestBodyPlaidAndroid)
              .then((res) => res.headers.get("location"));
            // Plaid iOS Example
            var requestBodyPlaidIOS = {
              _links: {
                "exchange-partner": {
                  href: "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef",
                },
                "redirect-url": {
                  href: "https://example.com/app123",
                },
              },
            };
            dwolla
              .post(`${customerUrl}/exchange-sessions`, requestBodyPlaidIOS)
              .then((res) => res.headers.get("location"));
            // MX Example
            var requestBodyMX = {
              _links: {
                "exchange-partner": {
                  href: "https://api.dwolla.com/exchange-partners/2164407f-33c3-4555-a6a1-40d5e9e58744",
                },
              },
            };
            dwolla
              .post(`${customerUrl}/exchange-sessions`, requestBodyMX)
              .then((res) => res.headers.get("location"));
        - lang: python
          source: >
            # Using dwollav2 - https://github.com/Dwolla/dwolla-v2-python

            # Plaid Web Example

            customer_url =
            'https://api.dwolla.com/customer/74a207b2-b7b7-4efa-8bf8-582148e7b980'

            request_body_plaid_web = {
              '_links': {
                'exchange-partner': {
                  'href': 'https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef'
                }
              }
            }

            exchange = app_token.post('%s/exchange-sessions' % customer_url,
            request_body_plaid_web)

            exchange.headers['location']

            # Plaid Android Example

            request_body_plaid_android = {
              '_links': {
                'exchange-partner': {
                  'href': 'https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef'
                },
                'redirect-url': {
                  'href': 'com.example.app123'
                }
              }
            }

            exchange = app_token.post('%s/exchange-sessions' % customer_url,
            request_body_plaid_android)

            exchange.headers['location']

            # Plaid iOS Example

            request_body_plaid_ios = {
              '_links': {
                'exchange-partner': {
                  'href': 'https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef'
                },
                'redirect-url': {
                  'href': 'https://example.com/app123'
                }
              }
            }

            exchange = app_token.post('%s/exchange-sessions' % customer_url,
            request_body_plaid_ios)

            exchange.headers['location']

            # MX Example

            request_body_mx = {
              '_links': {
                'exchange-partner': {
                  'href': 'https://api.dwolla.com/exchange-partners/2164407f-33c3-4555-a6a1-40d5e9e58744'
                }
              }
            }

            exchange = app_token.post('%s/exchange-sessions' % customer_url,
            request_body_mx)

            exchange.headers['location']
        - lang: php
          source: |
            /**
             * No example for this language yet.
             **/
        - lang: ruby
          source: >
            # Using dwolla_v2 - https://github.com/Dwolla/dwolla-v2-ruby

            # Plaid Web Example

            customer_url =
            'https://api.dwolla.com/customers/74a207b2-b7b7-4efa-8bf8-582148e7b980'

            request_body_plaid_web = {
              _links: {
                'exchange-partner': {
                  href: "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef"
                }
              }
            }

            exchange = app_token.post "#{customer_url}/exchange-sessions",
            request_body_plaid_web

            exchange.response_headers[:location]

            # Plaid Android Example

            request_body_plaid_android = {
              _links: {
                'exchange-partner': {
                  href: "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef"
                },
                'redirect-url': {
                  href: "com.example.app123"
                }
              }
            }

            exchange = app_token.post "#{customer_url}/exchange-sessions",
            request_body_plaid_android

            exchange.response_headers[:location]

            # Plaid iOS Example

            request_body_plaid_ios = {
              _links: {
                'exchange-partner': {
                  href: "https://api.dwolla.com/exchange-partners/f53ffb32-c84f-496a-9d9d-acd100d396ef"
                },
                'redirect-url': {
                  href: "https://example.com/app123"
                }
              }
            }

            exchange = app_token.post "#{customer_url}/exchange-sessions",
            request_body_plaid_ios

            exchange.response_headers[:location]

            # MX Example

            request_body_mx = {
              _links: {
                'exchange-partner': {
                  href: "https://api.dwolla.com/exchange-partners/2164407f-33c3-4555-a6a1-40d5e9e58744"
                }
              }
            }

            exchange = app_token.post "#{customer_url}/exchange-sessions",
            request_body_mx

            exchange.response_headers[:location]
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:
    CreateCustomerExchangeSessionWithRedirect:
      title: CreateCustomerExchangeSessionWithRedirect
      description: >-
        Create exchange session with redirect URL (required for mobile sessions
        with Plaid)
      type: object
      required:
        - _links
      properties:
        _links:
          type: object
          required:
            - exchange-partner
            - redirect-url
          properties:
            exchange-partner:
              type: object
              required:
                - href
              properties:
                href:
                  type: string
                  format: uri
                  example: >-
                    https://api.dwolla.com/exchange-partners/292317ec-e252-47d8-93c3-2d128e037aa4
            redirect-url:
              type: object
              required:
                - href
              properties:
                href:
                  type: string
                  format: uri
                  description: |
                    Required for Plaid mobile sessions.
                    For Android: use app URI scheme (e.g., com.example.app123)
                    For iOS: use HTTPS URL (e.g., https://example.com/app123)
                  example: https://example.com/app123
    CreateCustomerExchangeSessionForWeb:
      title: CreateCustomerExchangeSessionForWeb
      description: >-
        Create exchange session for web (MX and Plaid web sessions where
        redirect-url is not required)
      type: object
      required:
        - _links
      properties:
        _links:
          type: object
          required:
            - exchange-partner
          properties:
            exchange-partner:
              type: object
              required:
                - href
              properties:
                href:
                  type: string
                  format: uri
                  example: >-
                    https://api.dwolla.com/exchange-partners/292317ec-e252-47d8-93c3-2d128e037aa4
    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: {}

````