This is v1 (latest version) of the ACH Pro API.

openapi: 3.0.0
info:
  version: 'v1'
  title: 'ACH Pro'
servers:
  - url: <https://api.ach-pro.com/v1>
    description: Production API
  - url: <https://sandbox-api.ach-pro.com/v1>
    description: Sandbox API (completely isolated from production)
tags:
  - name: Authentication
    description: |
      All API endpoints (except `/token` and `/token/refresh`) require an access token in a header: `Authorization: Bearer {token}`.

      To create an access token, you send an API key and secret to /token. Access tokens expire in 60 minutes. They are accompanied by a refresh token which expires in 12 hours and is used to
      retrieve a new access_token from `/token/refresh`. Once the refresh token expires,
      you must call /token again using your API key and secret. The goal of this architecture is to limit the number of requests that contain your long lived API credentials.

      You should create a mechanism for caching the access token and refreshing it periodically
      using the refresh token.
  - name: Profile
    description: |
      Your customer profile groups all of your organization's data and users together.
  - name: Users
    description: |
      Users are individuals in your profile that can log in to the ACH Pro application.
  - name: Recipients
    description: |
      Recipients are individuals, businesses and your originating companies that can receive credits or debits in an ACH file.
  - name: Recipient Authorization
    description: |
      The Recipient Authorization endpoint is used to manage authorizations for recipients.
  - name: Variance Terms
    description: |
      The Variance Terms endpoint allows management of variance terms that can be applied to recipient authorizations.
  - name: Revocation Terms
    description: |
      The Revocation Terms endpoint allows management of revocation terms that can be applied to recipient authorizations.
  - name: File Upload
    description: |
      The File Upload endpoint allows the management of file attachements for various elements of the app such as recipient authorizations.
  - name: Recipient User
    description: |
      The Recipient User endpoint is used to manage recipient users that can themselves manage recipient authorizations.
  - name: Accounts
    description: |
      The Accounts endpoints allow you to manage bank accounts configured for your recipients.
  - name: ODFIs
    description: |
      Originating depository financial institutions (ODFIs or Banks) originate ACH transfers on behalf of their customers. Each bank that you upload NACHA files to will need to be created in ACH Pro to ensure that the bank's file header requirements are used when you create new files.
  - name: Files
    description: |
      The Files endpoint is used to create, download and retrieve historical ACH files.

      ACH Pro stores unchanging, historical representations of ACH files that can be used
      to re-create the original NACHA file or create a template.
  - name: Templates
    description: |
      Templates provide a convenient way to save and reuse ACH transfer details. A template is
      a normalized representation of an ACH transfer complete with headers, batches and entries.
      As such, it will automatically update based on changes to child elements (for
      example, changing a recipient's name will automatically be reflected in any templates
      containing the recipient).

      This differs from historical ACH transfers which are unchanging. For example, let's say you have a template for payroll. Over time as employee details change, you can update their recipient without needing to change the template directly. The next time you're ready to create a payroll file using the template, it will automatically reflect the changes you've made.
  - name: Import
    description: |
      The Import endpoint allows you to create CSV file import templates and use them to create new ACH files.\\

security:
  - BearerToken: []

paths:
  /token:
    description: Authentication
    post:
      summary: Access Token
      description: |
        Exchange an API key and secret for a short-lived access_token and refresh_token.

        access_expires and refresh_expires are future timestamps that indicate when their respective tokens expire.
      tags:
        - Authentication
      security:
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetTokenPayload'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTokenResponse'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/key'
                    message: must have required property 'key'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /token/refresh:
    description: Authentication
    post:
      summary: Refresh Token
      description: |
        Exchange a refresh token for a new short-lived access token.

        Note: refresh_token and refresh_expires in the response will be the same until
        `/token` is called again and a new access token generated.
      tags:
        - Authentication
      security:
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefreshTokenPayload'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTokenResponse'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/refresh_token'
                    message: must have required property 'refresh_token'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /profile:
    get:
      summary: Current Profile
      description: Retrieves the profile associated with the current access token
      tags:
        - Profile
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /profile/users:
    get:
      summary: Users For Current Profile
      description: Retrieves users for the profile associated with the current access token
      tags:
        - Users
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create User For Current Profile
      description: Creates a new user for the profile associated with the current access token
      tags:
        - Users
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
            example:
              firstName: Bruce
              lastName: Wayne
              email: [email protected]
              canManageUsers: false
              canManageApiKeys: false
              mfaEnabled: true
              mfaPhoneNumber: '11235559999'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/firstName'
                    message: must have required property 'firstName'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    put:
      summary: Update User For Current Profile
      description: Updates an existing user for the profile associated with the current access token
      tags:
        - Users
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
            example:
              userId: 0C6A4485BB84412CAB3A2D2C693FE930
              profileId: 3C7228A19C564FFD9F8876D85D6323BF
              firstName: Bruce
              lastName: Wayne
              email: [email protected]
              canManageUsers: false
              canManageApiKeys: false
              mfaEnabled: true
              mfaPhoneNumber: '11235559999'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/firstName'
                    message: must have required property 'firstName'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /profile/users/{userId}:
    get:
      summary: User By Id
      description: Retrieves a single user
      parameters:
        - in: path
          name: userId
          required: true
          schema:
            type: string
      tags:
        - Users
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    delete:
      summary: Delete User For Current Profile
      description: Deletes a user for the profile associated with the current access token
      tags:
        - Users
      parameters:
        - in: path
          name: userId
          required: true
          description: ID of user
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: string
              example: User deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /recipients:
    get:
      summary: List Recipients
      description: Retrieves a list of recipients
      tags:
        - Recipients
      parameters:
        - in: query
          name: type
          required: false
          description: |
            Comma separated list of recipient types used to filter results.
            Options:
            * CONSUMER
            * BUSINESS
            * COMPANY (your originating companies)
          example:
            BUSINESS
          schema:
            $ref: '#/components/schemas/RecipientType'
        - in: query
          name: withAccounts
          required: false
          description: |
            Indicates if accounts should be queried for recipient
          example:
            true
          schema:
            type: boolean
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Recipient'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create Recipient
      description: Creates a new recipient
      tags:
        - Recipients
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Recipient'
            example:
              recipientType: BUSINESS
              name: ABC Company
              uniqueIdentifier: 0001ABC
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recipient'
              example:
                recipientId: 8126624016A544408EB74FFE81ADDB49
                profileId: 59DE4FF642E543E0908AF7B18A78209E
                recipientType: BUSINESS
                name: XYZ Company
                uniqueIdentifier: 0001ABC
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/name'
                    message: must have required property 'name'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    put:
      summary: Update Recipient
      description: Update an existing recipient
      tags:
        - Recipients
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Recipient'
            example:
              recipientId: 36C0B8458E4F4E88933FC5D0CE0C2FDB
              profileId: 3C7228A19C564FFD9F8876D85D6323BF
              recipientType: BUSINESS
              name: XYZ Company
              uniqueIdentifier: 0001XYZ
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recipient'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/name'
                    message: must have required property 'name'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /recipients/{recipientId}:
    get:
      summary: Recipient By Id
      description: Retrieves a single recipient
      tags:
        - Recipients
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
        - in: query
          name: withAccounts
          required: false
          description: |
            Indicates if accounts should be queried for recipient
          example:
            true
          schema:
            type: boolean
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recipient'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    delete:
      summary: Delete Recipient
      description: Deletes a recipient
      tags:
        - Recipients
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: string
              example: Recipient deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /recipients/{recipientId}/accounts:
    get:
      summary: Recipient Accounts
      description: Retrieve all accounts for a recipient
      tags:
        - Accounts
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Account'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create Account
      description: Creates a new account
      tags:
        - Accounts
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Account'
            example:
              accountNumber: "505050505"
              routingNumber: "026009593"
              accountType: "CHECKING"
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/accountNumber'
                    message: must have required property 'accountNumber'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    put:
      summary: Update Account
      description: Updates an existing account
      tags:
        - Accounts
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Account'
            example:
              accountId: 483344D70E41404AA0BC9924EEBD5F01
              profileId: 3C7228A19C564FFD9F8876D85D6323BF
              recipientId: 01B7DDAF2B46498385C0B3F1E924B7FE
              accountNumber: "505050505"
              routingNumber: "026009593"
              accountType: CHECKING
              nickname: null
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/accountNumber'
                    message: must have required property 'accountNumber'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /recipients/{recipientId}/accounts/{accountId}:
    get:
      summary: Get Account By Id
      description: Retrieves a single account
      tags:
        - Accounts
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
        - in: path
          name: accountId
          required: true
          description: ID of account
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
        404:
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Account not found with ID 59DE4FF642E543E0908AF7B18A78209E
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    delete:
      summary: Delete Account
      description: Delete account
      tags:
        - Accounts
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
        - in: path
          name: accountId
          required: true
          description: ID of account
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: string
              example: Account deleted
        404:
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Account not found with ID 59DE4FF642E543E0908AF7B18A78209E
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /recipients/{recipientId}/authorizationSettings:
    get:
      summary: Get Authorization Settings for a Company
      description: Retrieves authorization settings for a company
      tags:
        - Recipients
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyAuthorizationSettings'
        404:
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Recipient not found

    put:
      summary: Update Authorization Settings for a Company
      description: Updates authorization settings for a company
      tags:
        - Recipients
      parameters:
        - in: path
          name: recipientId
          required: true
          description: ID of recipient
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompanyAuthorizationSettings'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyAuthorizationSettings'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
        403:
          description: Forbidden recipient type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Only COMPANY type recipient can have authorization settings

  /recipientUsers/{recipientUserId}:
    get:
      summary: Get Recipient User by ID
      tags:
        - Recipient User
      parameters:
        - in: path
          name: recipientUserId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecipientUser'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /recipientAuthorizations:
    get:
      summary: Get Recipient Authorization List
      tags:
        - Recipient Authorization
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RecipientAuthorization'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create Recipient Authorization
      tags:
        - Recipient Authorization
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecipientAuthorization'
      responses:
        201:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecipientAuthorization'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    put:
      summary: Update Recipient Authorization
      tags:
        - Recipient Authorization
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecipientAuthorization'
      responses:
        201:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecipientAuthorization'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /recipientAuthorizations/{recipientAuthorizationId}:
    get:
      summary: Get Recipient Authorization by ID
      tags:
        - Recipient Authorization
      parameters:
        - in: path
          name: recipientAuthorizationId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecipientAuthorization'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    delete:
      summary: Delete Recipient Authorization by ID
      tags:
        - Recipient Authorization
      parameters:
        - in: path
          name: recipientAuthorizationId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                example: Recipient Authorization deleted.
        404:
          description: Recipient Authorization Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Recipient Authorization with id {recipientAuthorizationId} not found.

  /fileUploads/{fileUploadId}:
    delete:
      summary: Delete an existing File Upload
      tags:
        - File Upload
      parameters:
        - in: path
          name: fileUploadId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                example: File Upload deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /fileUploads/{fileUploadId}/downloadUrl:
    post:
      summary: Download an existing File Upload
      tags:
        - File Upload
      parameters:
        - in: path
          name: fileUploadId
          required: true
          schema:
            type: string
      responses:
        201:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadUrlResponse'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /varianceTerms:
    get:
      summary: List Variance Terms
      tags:
        - Recipient Authorization
        - Variance Terms
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/VarianceTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create Variance Terms
      tags:
        - Recipient Authorization
        - Variance Terms
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VarianceTerms'
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VarianceTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    put:
      summary: Update Variance Terms
      tags:
        - Recipient Authorization
        - Variance Terms
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VarianceTerms'
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VarianceTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /varianceTerms/{varianceTermsId}:
    get:
      summary: Variance Terms by ID
      tags:
        - Recipient Authorization
        - Variance Terms
      parameters:
        - in: path
          name: varianceTermsId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/VarianceTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    delete:
      summary: Delete Variance Terms
      tags:
        - Recipient Authorization
        - Variance Terms
      parameters:
        - in: path
          name: varianceTermsId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                example: Variance Terms deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /revocationTerms:
    get:
      summary: List Revocation Terms
      tags:
        - Recipient Authorization
        - Revocation Terms
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RevocationTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create Revocation Terms
      tags:
        - Recipient Authorization
        - Revocation Terms
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RevocationTerms'
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevocationTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    put:
      summary: Update Revocation Terms
      tags:
        - Recipient Authorization
        - Revocation Terms
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RevocationTerms'
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevocationTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /revocationTerms/{revocationTermsId}:
    get:
      summary: Revocation Terms by ID
      tags:
        - Recipient Authorization
        - Revocation Terms
      parameters:
        - in: path
          name: revocationTermsId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RevocationTerms'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    delete:
      summary: Delete Revocation Terms
      tags:
        - Recipient Authorization
        - Revocation Terms
      parameters:
        - in: path
          name: revocationTermsId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                example: Revocation Terms deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /files:
    post:
      summary: Create File
      description: Creates a new ACH file representation.
      tags:
        - Files
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/ExistingAchTemplate'
                - $ref: '#/components/schemas/AchTemplate'
      responses:
        201:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AchTemplate'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/name'
                    message: must have required property 'name'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /files/{historicalFileId}:
    get:
      summary: Get File By Id
      description: Retrieves a single file
      tags:
        - Files
      parameters:
        - in: path
          name: historicalFileId
          required: true
          description: ID of file
          schema:
            type: string
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalFile'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /files/{historicalFileId}/download:
    post:
      summary: Download NACHA File
      description: Downloads a NACHA file for an existing ACH file
      tags:
        - Files
      parameters:
        - in: path
          name: historicalFileId
          required: true
          description: ID of file
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NachaDownloadRequestBody'
      responses:
        201:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NachaDownload'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /files/{historicalFileId}/downloadReport:
    post:
      summary: Download CSV Report for File
      description: Downloads a CSV report for an existing ACH file
      tags:
        - Files
      parameters:
        - in: path
          name: historicalFileId
          required: true
          description: ID of file
          schema:
            type: string
        - in: query
          name: type
          schema:
            type: string
            enum:
              - CSV
              - PDF
      responses:
        201:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CsvReportDownload'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /files/history:
    get:
      summary: Get File History
      description: Retrieves summary info for all files
      tags:
        - Files
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HistoricalFileSummary'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /files/parse:
    post:
      summary: Parse NACHA File
      description: |
        Converts a NACHA formatted input into a HistoricalFile JSON object.
        
        This endpoint accepts two payload content-types:
          1. application/json body containing NACHA-formatted text
          2. multipart/form-data NACHA file upload
      tags:
        - Files
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NachaTextUpload'
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        201:
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoricalFile'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Failed to parse NACHA file
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /files/recent:
    get:
      summary: Get Recent File History
      description: Retrieves summary info for files created in the last 7 days
      tags:
        - Files
      responses:
        200:
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HistoricalFileSummary'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /templates:
    get:
      summary: Templates
      description: Retrieves all templates
      tags:
        - Templates
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AchTemplate'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create Template
      description: Create a new template
      tags:
        - Templates
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AchTemplate'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AchTemplate'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/name'
                    message: must have required property 'name'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    put:
      summary: Update Template
      description: Updates an existing template
      tags:
        - Templates
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AchTemplate'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AchTemplate'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /templates/{achTemplateId}:
    get:
      summary: Template By Id
      description: Retrieves a single template
      tags:
        - Templates
      parameters:
        - in: path
          name: achTemplateId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AchTemplate'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    delete:
      summary: Delete Template
      description: Delete a template
      tags:
        - Templates
      parameters:
        - in: path
          name: achTemplateId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: string
              example: Template deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /odfis:
    get:
      summary: List ODFIs
      description: Retrieves a list of ODFIs
      tags:
        - ODFIs
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Odfi'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials
    post:
      summary: Create ODFI
      description: Create a new ODFI
      tags:
        - ODFIs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Odfi'
            example:
              name: Bank Of America
              routingNumber: "026009593"
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Odfi'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/name'
                    message: must have required property 'name'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    put:
      summary: Update ODFI
      description: Updates an existing ODFI
      tags:
        - ODFIs
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Odfi'
            example:
              odfiId: 1392FD1C847D449383F7F33A8F7847D9
              profileId: 3C7228A19C564FFD9F8876D85D6323BF
              name: Bank Of America
              routingNumber: "026009593"
              immediateOrigin: null
              immediateOriginName: null
              immediateDestination: null
              immediateDestinationName: null
              fileLineEndings: UNIX
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Odfi'
        400:
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Bad Request
                errors:
                  - field: '/body/name'
                    message: must have required property 'name'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /odfis/{odfiId}:
    get:
      summary: ODFI By Id
      description: Retrieves a single ODFI
      tags:
        - ODFIs
      parameters:
        - in: path
          name: odfiId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Odfi'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    delete:
      summary: Delete ODFI
      description: Deletes an ODFI
      tags:
        - ODFIs
      parameters:
        - in: path
          name: odfiId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: string
              example: ODFI deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /import/shrink:
    post:
      summary: Shrink Imported File
      description: |
        Shrinks an uploaded file to the specified number of lines to reduce
        the overhead needed to parse the file. Currently only text files
        containing CSV data are supported.
      tags:
        - Import
      parameters:
        - in: query
          name: lineCount
          description: |
            The number of lines from the start of the file that should
            be returned.
          required: true
          schema:
            type: integer
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        201:
          description: Successful response
          content:
            text/plain:
              schema:
                type: string
                description: CSV lines
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /import/templates:
    get:
      summary: Import Templates
      description: Retrieves all import templates
      tags:
        - Import
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ImportTemplate'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    post:
      summary: Create Import Template
      description: Creates a new import template
      tags:
        - Import
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportTemplate'
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportTemplate'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /import/templates/{importTemplateId}:
    get:
      summary: Import Template By Id
      description: Retrieves a single import template
      tags:
        - Import
      parameters:
        - in: path
          name: importTemplateId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportTemplate'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

    delete:
      summary: Delete Import Template
      description: Deletes an import template
      tags:
        - Import
      parameters:
        - in: path
          name: importTemplateId
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                type: string
              example: Import template deleted
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

  /import/templates/{importTemplateId}/parse:
    post:
      summary: Parse Imported File
      description: |
        Parses an import file using a specified template and returns 
        an ACH file object.
      tags:
        - Import
      parameters:
        - in: path
          name: importTemplateId
          required: true
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        201:
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AchTemplate'
        401:
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid credentials

components:
  schemas:
    Account:
      type: object
      required:
        - accountNumber
        - routingNumber
        - accountType
      properties:
        accountId:
          type: string
        profileId:
          type: string
        recipientId:
          type: string
        accountNumber:
          type: string
        accountType:
          $ref: '#/components/schemas/AccountType'
        routingNumber:
          type: string
        nickname:
          type: string
          nullable: true
      example:
        accountId: 9651613016A544408EB74FAGBE658212
        profileId: 59DE4FF642E543E0908AF7B18A78209E
        recipientId: 8126624016A544408EB74FFE81ADDB49
        accountNumber: "505050505"
        routingNumber: "092905249"
        accountType: CHECKING

    ExistingAccount:
      type: object
      description: Used in ACH templates and files
      required:
        - accountId
      properties:
        accountId:
          type: string
          description: Not Updatable

    AccountType:
      type: string
      enum:
        - CHECKING
        - SAVINGS
        - LOAN

    AchEntryType:
      type: string
      enum:
        - CREDIT
        - DEBIT
        - PRENOTE

    ExistingAchTemplate:
      type: object
      description: Used when creating files
      required:
        - achTemplateId
      properties:
        achTemplateId:
          type: string
          description: |
            Not Updatable

    AchTemplate:
      type: object
      properties:
        achTemplateId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        name:
          type: string
        odfi:
          description: Always required when creating a file, optional when creating a template.
          anyOf:
            - $ref: '#/components/schemas/ExistingOdfi'
            - $ref: '#/components/schemas/Odfi'
            - $ref: '#/components/schemas/null_type'
        batches:
          type: array
          items:
            $ref: '#/components/schemas/AchTemplateBatch'
        immediateDestination:
          type: string
          nullable: true
        immediateOrigin:
          type: string
          nullable: true
        immediateDestinationName:
          type: string
          nullable: true
        immediateOriginName:
          type: string
          nullable: true
        referenceCode:
          type: string
          nullable: true
          description: File Header reference code
        totalCredits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalDebits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalEntries:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        dateCreated:
          type: string
          description: |
            Not Updatable
      example:
        achTemplateId: 365564F17CB4410587767E1CA6D5BEFE
        profileId: 59DE4FF642E543E0908AF7B18A78209E
        name: AP Template
        immediateDestination: null
        immediateOrigin: null
        immediateDestinationName: null
        immediateOriginName: null
        referenceCode: null
        odfi:
          odfiId: 00359E89EC1D4A33AB8DE34A2616DF70
          profileId: 59DE4FF642E543E0908AF7B18A78209E
          name: Bank Of America
          routingNumber: "026009593"
          immediateDestination: null
          immediateDestinationName: null
          immediateOrigin: null
          immediateOriginName: null
          fileLineEndings: UNIX
        batches:
          - achBatchId: 1B993F05CEE6454F984F7CA8816D0379
            profileId: 59DE4FF642E543E0908AF7B18A78209E
            achTransferId: 365564F17CB4410587767E1CA6D5BEFE
            isBalanced: false
            effectiveDate: 2021-11-26
            secCode: PPD
            companyEntryDescription: PAYROLL
            companyDiscretionaryData: null,
            companyDescriptiveDate: null,
            odfiIdentification: "026009593"
            companyRecipient:
              recipientId: AF2A2F6F24474D5A8806681369AF2FC4
              profileId: 59DE4FF642E543E0908AF7B18A78209E
              recipientType: COMPANY
              name: ABC Company
              uniqueIdentifier: null
              companyIdentification: "123456789"
            entries:
              - achEntryDetailId: 892CDD8BCE85425B94163A5AC20F524E
                profileId: 59DE4FF642E543E0908AF7B18A78209E
                achBatchId: 1B993F05CEE6454F984F7CA8816D0379
                amount: 5000
                entryType: CREDIT
                addendum: 'Payroll for end 11/2021'
                recipient:
                  recipientId: 8126624016A544408EB74FFE81ADDB49
                  profileId: 59DE4FF642E543E0908AF7B18A78209E
                  recipientType: BUSINESS
                  name: XYZ Company
                  uniqueIdentifier: 0001ABC
                account:
                  accountId: 0198D801A12E4282A45FD55F8669FF2F
                  recipientId: 8126624016A544408EB74FFE81ADDB49
                  profileId: 59DE4FF642E543E0908AF7B18A78209E
                  accountNumber: '123456789'
                  accountType: CHECKING
                  routingNumber: '092905249'
                  nickname: null
        dateCreated: '2021-12-05 21:53:50'

    AchTemplateBatch:
      type: object
      properties:
        achBatchId:
          type: string
          description: |
            Not Updatable
        achTemplateId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        isBalanced:
          type: boolean
        effectiveDate:
          type: string
          format: date
        secCode:
          $ref: '#/components/schemas/SecCode'
        companyEntryDescription:
          type: string
        companyDiscretionaryData:
          type: string
          nullable: true
        companyDescriptiveDate:
          type: string
          nullable: true
        odfiIdentification:
          type: string
          nullable: true
        companyRecipient:
          anyOf:
            - $ref: '#/components/schemas/ExistingRecipient'
            - $ref: '#/components/schemas/Recipient'
        entries:
          type: array
          items:
            $ref: '#/components/schemas/AchTemplateEntryDetail'
        totalCredits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalDebits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalEntries:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable

    AchTemplateEntryDetail:
      type: object
      properties:
        achEntryDetailId:
          type: string
          description: |
            Not Updatable
        achBatchId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        amount:
          oneOf:
            - type: number
            - type: string
          description: Amount of entry in cents
        entryType:
          $ref: '#/components/schemas/AchEntryType'
        addendum:
          type: string
          nullable: true
          maxLength: 80
        recipient:
          anyOf:
            - $ref: '#/components/schemas/ExistingRecipient'
            - $ref: '#/components/schemas/Recipient'
        account:
          anyOf:
            - $ref: '#/components/schemas/ExistingAccount'
            - $ref: '#/components/schemas/Account'

    HistoricalFile:
      type: object
      properties:
        historicalFileId:
          type: string
        profileId:
          type: string
          description: |
            Not Updatable
        name:
          type: string
        odfi:
          $ref: '#/components/schemas/Odfi'
        batches:
          type: array
          items:
            $ref: '#/components/schemas/HistoricalAchBatch'
        immediateDestination:
          type: string
          nullable: true
        immediateOrigin:
          type: string
          nullable: true
        immediateDestinationName:
          type: string
          nullable: true
        immediateOriginName:
          type: string
          nullable: true
        referenceCode:
          type: string
          nullable: true
          description: File Header reference code
        totalCredits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalDebits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalEntries:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        dateCreated:
          type: string
          format: date-time
          description: |
            Not Updatable
      example:
        achTemplateId: 365564F17CB4410587767E1CA6D5BEFE
        profileId: 59DE4FF642E543E0908AF7B18A78209E
        name: AP Template
        immediateDestination: null
        immediateOrigin: null
        immediateDestinationName: null
        immediateOriginName: null
        referenceCode: null
        odfi:
          odfiId: 00359E89EC1D4A33AB8DE34A2616DF70
          profileId: 59DE4FF642E543E0908AF7B18A78209E
          name: Bank Of America
          routingNumber: "026009593"
          immediateDestination: null
          immediateDestinationName: null
          immediateOrigin: null
          immediateOriginName: null
          fileLineEndings: UNIX
        batches:
          - achBatchId: 1B993F05CEE6454F984F7CA8816D0379
            profileId: 59DE4FF642E543E0908AF7B18A78209E
            achTransferId: 365564F17CB4410587767E1CA6D5BEFE
            isBalanced: false
            effectiveDate: 2021-11-26
            secCode: PPD
            companyEntryDescription: PAYROLL
            companyDiscretionaryData: null,
            companyDescriptiveDate: null,
            odfiIdentification: "026009593"
            companyRecipient:
              recipientId: AF2A2F6F24474D5A8806681369AF2FC4
              profileId: 59DE4FF642E543E0908AF7B18A78209E
              recipientType: COMPANY
              name: ABC Company
              uniqueIdentifier: null
              companyIdentification: "123456789"
            entries:
              - achEntryDetailId: 892CDD8BCE85425B94163A5AC20F524E
                profileId: 59DE4FF642E543E0908AF7B18A78209E
                achBatchId: 1B993F05CEE6454F984F7CA8816D0379
                amount: 5000
                entryType: CREDIT
                addendum: 'Payroll for end 11/2021'
                recipient:
                  recipientId: 8126624016A544408EB74FFE81ADDB49
                  profileId: 59DE4FF642E543E0908AF7B18A78209E
                  recipientType: BUSINESS
                  name: XYZ Company
                  uniqueIdentifier: 0001ABC
                account:
                  accountId: 0198D801A12E4282A45FD55F8669FF2F
                  recipientId: 8126624016A544408EB74FFE81ADDB49
                  profileId: 59DE4FF642E543E0908AF7B18A78209E
                  accountNumber: '123456789'
                  accountType: CHECKING
                  routingNumber: '092905249'
                  nickname: null
        dateCreated: '2021-12-05 21:53:50'

    HistoricalAchBatch:
      type: object
      required:
        - effectiveDate
        - secCode
        - companyEntryDescription
        - companyRecipient
        - entries
      properties:
        achBatchId:
          type: string
          description: |
            Not Updatable
        achTemplateId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        isBalanced:
          type: boolean
        effectiveDate:
          type: string
          format: date
        secCode:
          $ref: '#/components/schemas/SecCode'
        companyEntryDescription:
          type: string
        companyDiscretionaryData:
          type: string
          nullable: true
        companyDescriptiveDate:
          type: string
          nullable: true
        odfiIdentification:
          type: string
          nullable: true
        totalCredits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalDebits:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        totalEntries:
          anyOf:
            - type: number
              nullable: true
            - type: string
              nullable: true
          description: |
            Not Updatable
        companyRecipient:
          $ref: '#/components/schemas/Recipient'
        entries:
          type: array
          items:
            $ref: '#/components/schemas/HistoricalAchEntryDetail'

    HistoricalAchEntryDetail:
      type: object
      required:
        - amount
        - recipient
        - account
        - entryType
      properties:
        achEntryDetailId:
          type: string
          description: |
            Not Updatable
        achBatchId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        amount:
          oneOf:
            - type: number
            - type: string
          description: Amount of entry in cents
        entryType:
          $ref: '#/components/schemas/AchEntryType'
        addendum:
          type: string
          nullable: true
          maxLength: 80
        recipient:
          $ref: '#/components/schemas/Recipient'
        account:
          $ref: '#/components/schemas/Account'

    HistoricalFileSummary:
      type: object
      properties:
        historicalFileId:
          type: string
          readOnly: true
        profileId:
          type: string
          readOnly: true
        name:
          type: string
          readOnly: true
        totalCredits:
          type: number
          readOnly: true
        totalDebits:
          type: number
          readOnly: true
        totalEntries:
          type: number
          readOnly: true
        dateCreated:
          type: string
          format: date-time
          readOnly: true

    PaymentImportDataElementName:
      type: string
      enum:
        - recipientName
        - amount
        - accountNumber
        - routingNumber
        - accountType
        - uniqueIdentifier
        - entryType
        - addendum

    OdfiImportDataElementName:
      type: string
      enum:
        - name
        - routingNumber
        - immediateOrigin
        - immediateOriginName
        - immediateDestination
        - immediateDestinationName

    RecipientImportDataElementName:
      type: string
      enum:
        - name
        - recipientType
        - uniqueIdentifier
        - accountNumber1
        - routingNumber1
        - accountType1
        - accountNickname1
        - accountNumber2
        - routingNumber2
        - accountType2
        - accountNickname2
        - accountNumber3
        - routingNumber3
        - accountType3
        - accountNickname3
        - accountNumber4
        - routingNumber4
        - accountType4
        - accountNickname4
        - accountNumber5
        - routingNumber5
        - accountType5
        - accountNickname5

    CompanyImportDataElementName:
      type: string
      enum:
        - name
        - companyId
        - accountNumber1
        - routingNumber1
        - accountType1
        - accountNickname1
        - accountNumber2
        - routingNumber2
        - accountType2
        - accountNickname2
        - accountNumber3
        - routingNumber3
        - accountType3
        - accountNickname3
        - accountNumber4
        - routingNumber4
        - accountType4
        - accountNickname4
        - accountNumber5
        - routingNumber5
        - accountType5
        - accountNickname5

    ImportColumnDefinitions:
      type: array
      items:
        type: object
        required:
          - columnIndex
          - dataElementName
        properties:
          columnDefinitionId:
            description: Unique ID of this column definition.
            type: string
          importTemplateId:
            description: ID of the parent import template.
            type: string
          profileId:
            type: string
          columnIndex:
            type: integer
            description: |
              1-based array (The first column would be index 1)
          dataElementName:
            anyOf:
              - $ref: '#/components/schemas/PaymentImportDataElementName'
              - $ref: '#/components/schemas/OdfiImportDataElementName'
              - $ref: '#/components/schemas/RecipientImportDataElementName'
              - $ref: '#/components/schemas/CompanyImportDataElementName'

    ImportFileType:
      type: string
      enum:
        - CSV

    ImportItemType:
      type: string
      enum:
        - PAYMENT
        - ODFI
        - RECIPIENT
        - COMPANY

    ImportTemplate:
      type: object
      properties:
        importTemplateId:
          type: string
          readOnly: true
        profileId:
          type: string
          readOnly: true
        name:
          type: string
        fileType:
          $ref: '#/components/schemas/ImportFileType'
        itemType:
          description: Indicates the type of object being import (recipients, ODFIs or payment transactions).
          $ref: '#/components/schemas/ImportItemType'
        headerRowCount:
          description: Indicates the number of header rows that should be skipped in the imported file. Defaults to 0 (no header).
          type: number
        columnDefinitions:
          description: These definitions should match the selected itemType.
          $ref: '#/components/schemas/ImportColumnDefinitions'

    NachaDownloadRequestBody:
      type: object
      properties:
        asPrenote:
          type: boolean
          description: |
            When true, all amounts in the resulting NACHA file will be 0. Trancodes
            will be prenote specific. Prenote files are often used to test new accounts
            and are required by some financial institutions.

    NachaDownload:
      type: object
      required:
        - fileName
        - data
      properties:
        fileName:
          type: string
          description: Defaults to the name of the ACH file
        data:
          $ref: '#/components/schemas/NachaText'

    NachaTextUpload:
      type: object
      required:
        - fileName
        - data
      properties:
        fileName:
          type: string
        data:
          $ref: '#/components/schemas/NachaText'

    NachaText:
      description: Text value of NACHA-formatted file
      type: string

    CsvReportDownload:
      type: object
      required:
        - fileName
        - data
      properties:
        fileName:
          type: string
          description: Defaults to the name of the ACH file
        data:
          type: string
          description: CSV file contents

    ExistingOdfi:
      type: object
      description: Used is ACH templates and files
      required:
        - odfiId
      properties:
        odfiId:
          type: string
          description: |
            Not Updatable

    Odfi:
      type: object
      required:
        - name
        - routingNumber
      properties:
        odfiId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        name:
          type: string
        routingNumber:
          type: string
        immediateOrigin:
          type: string
          nullable: true
        immediateOriginName:
          type: string
          nullable: true
        immediateDestination:
          type: string
          nullable: true
        immediateDestinationName:
          type: string
          nullable: true
        fileLineEndings:
          type: string
          description: Sets the line endings in files created for this ODFI
          enum:
            - UNIX
            - WINDOWS
      example:
        odfiId: 00359E89EC1D4A33AB8DE34A2616DF70
        profileId: 59DE4FF642E543E0908AF7B18A78209E
        name: Stockman Bank of Montana
        routingNumber: 092905249
        immediateOrigin: null
        immediateOriginName: null
        immediateDestination: null
        immediateDestinationName: null
        fileLineEndings: UNIX

    ProfileSettings:
      type: object
      readOnly: true
      properties:
        manageUsers:
          type: boolean
        manageApiKeys:
          type: boolean

    Profile:
      type: object
      properties:
        profileId:
          type: string
          readOnly: true
        name:
          type: string
        users:
          type: array
          items:
            $ref: '#/components/schemas/User'
        primaryUserId:
          type: string
        mfaEnabled:
          type: boolean
        signUpStep:
          $ref: '#/components/schemas/SignUpStepEnum'
        dateSignUpCompleted:
          type: string
          format: date-time
        subscriptionStatus:
          type: string
        addlUserBundles:
          type: number
        addlFileBundles:
          type: number
        addlApiKeyBundles:
          type: number
        settings:
          $ref: '#/components/schemas/ProfileSettings'
      example:
        profileId: 59DE4FF642E543E0908AF7B18A78209E
        name: Test Profile
        users:
          - userId: 03547CAADB604040ABCCBA59D1B95937
            profileId: 59DE4FF642E543E0908AF7B18A78209E
            firstName: Bruce
            lastName: Wayne
            email: [email protected]
        primaryUserId: 03547CAADB604040ABCCBA59D1B95937
        mfaEnabled: false
        signUpStep: COMPLETE
        dateSignUpCompleted: '2022-11-15 12:15:13'
        subscriptionStatus: active
        addlUserBundles: 0
        addlFileBundles: 2
        addlApiKeyBundles: 0

    Recipient:
      type: object
      required:
        - recipientType
        - name
      properties:
        recipientId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        recipientType:
          $ref: '#/components/schemas/RecipientType'
        name:
          type: string
        companyIdentification:
          type: string
          nullable: true
          description: |
            Typically the EIN of the company. Required when recipientType is COMPANY.
        uniqueIdentifier:
          type: string
          nullable: true
          description: |
            Optional field that identifies the recipient in your external systems.
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/Account'
          nullable: true
        notificationEmails:
          description: |
            A list of emails that have access to this recipients authorizations in the authorization portal.
            Not available for COMPANY recipients.
          type: array
          items:
            type: object
            required:
              - email
            properties:
              emailId:
                type: string
              email:
                type: string
                format: email
              name:
                type: string
                nullable: true
        isValidAuthorizationCompany:
          type: boolean
          description: |
            Not Updatable. Describes if a COMPANY recipient can be used
            to create recipient authorizations.
      example:
        recipientId: 8126624016A544408EB74FFE81ADDB49
        profileId: 59DE4FF642E543E0908AF7B18A78209E
        recipientType: BUSINESS
        name: XYZ Company
        uniqueIdentifier: 0001XYZ

    ExistingRecipient:
      type: object
      description: Used in ACH templates and files
      required:
        - recipientId
      properties:
        recipientId:
          type: string
          description: |
            Not Updatable

    RecipientNotificationEmail:
      type: object
      required:
        - email
      properties:
        email:
          type: string
        name:
          type: string
          description: Optional name of the recipient

    RecipientAuthorizationType:
      type: string
      enum:
        - DIGITAL
        - PHYSICAL

    RecipientAuthorizationEntryType:
      type: string
      enum:
        - DEBIT
        - CREDIT

    RecipientAuthorizationRecurrence:
      type: string
      enum:
        - ONETIME
        - DAILY
        - WEEKLY
        - MONTHLY
        - ANNUALLY
        - AS_NEEDED

    RecipientAuthorizationStatus:
      type: string
      description: |
        PENDING_SIGNATURE: A digital authorization that is completed and pending signature.
        EXPIRED: An authorization for which the expiration date has passed.
        REVOKED: An authorization that has been revoked.
        INVALID: An authorization that is missing a required field. These will not be displayed in the user portal.
        EXPIRING_SOON: An authorization that will expire in the next 30 days.
        VALID: An authorization that is valid and signed, indicating that transfers can be made.
      enum:
        - PENDING_SIGNATURE
        - EXPIRED
        - REVOKED
        - INVALID
        - EXPIRING_SOON
        - VALID

    RecipientAuthorization:
      type: object
      required:
        - companyId
        - recipientId
        - authorizationType
        - entryType
        - isVariable
        - expirationDate
      properties:
        recipientAuthorizationId:
          type: string
        profileId:
          type: string
        companyId:
          type: string
        companyName:
          type: string
          nullable: true
          description: Not Updatable
        recipientId:
          type: string
        recipientName:
          type: string
          nullable: true
          description: Not Updatable
        accountId:
          type: string
          nullable: true
        authorizationType:
          $ref: '#/components/schemas/RecipientAuthorizationType'
        entryType:
          $ref: '#/components/schemas/RecipientAuthorizationEntryType'
        signerLegalName:
          type: string
          nullable: true
          description: Signer's full name
        revokerLegalName:
          type: string
          nullable: true
          description: Revoker's full name
        isUserRevoked:
          type: boolean
          description: |
            Not Updatable. Indicates if the authorization was revoked directly by
            a user. If this is true, an originator can no longer modify the revoked
            state of a DIGITAL authorization.
        accountNumber:
          type: string
          nullable: true
        routingNumber:
          type: string
          nullable: true
        accountType:
          anyOf:
            - $ref: '#/components/schemas/AccountType'
            - $ref: '#/components/schemas/null_type'
        fileUpload:
          anyOf:
            - $ref: '#/components/schemas/FileUpload'
            - $ref: '#/components/schemas/ExistingFileUpload'
            - $ref: '#/components/schemas/null_type'
        fileUploadUrl:
          description: |
            Not Updatable. After updates to fileUpload, this object
            will contain a url for uploading the file.
          $ref: '#/components/schemas/FileUploadUrlResponse'
        recurrence:
          $ref: '#/components/schemas/RecipientAuthorizationRecurrence'
        isVariable:
          type: boolean
          description: Indicates if the amounts of recurring transfers can have different amounts.
        varianceTerms:
          description: Required when authorizationType = DIGITAL and isVariable = true
          anyOf:
            - $ref: '#/components/schemas/VarianceTerms'
            - $ref: '#/components/schemas/ExistingVarianceTerms'
            - $ref: '#/components/schemas/null_type'
        revocationTerms:
          description: Required when authorizationType = DIGITAL
          anyOf:
            - $ref: '#/components/schemas/RevocationTerms'
            - $ref: '#/components/schemas/ExistingRevocationTerms'
            - $ref: '#/components/schemas/null_type'
        amount:
          type: number
          nullable: true
          description: Required when authorizationType = DIGITAL and isVariable = false
        notificationEmails:
          type: array
          description: A list of email address that should be notified about the creation of this authorization.
          items:
            type: string
          nullable: true
        agreementText:
          type: string
          readOnly: true
        expirationDate:
          type: string
        status:
          description: Not Updatable
          $ref: '#/components/schemas/RecipientAuthorizationStatus'
        isAvailableInPortal:
          type: boolean
          description: Indicates if this authorization is available in the recipient portal.
        dateSigned:
          type: string
          nullable: true
        dateRevoked:
          type: string
          nullable: true
        dateUpdated:
          type: string
          readOnly: true
        dateCreated:
          type: string
          readOnly: true

    RecipientAuthorizationPublishPayload:
      type: object
      properties:
        notifyEmails:
          description: A list of emails that should be notified of the pubished recipient authorization link.
          type: array
          items:
            type: string
            format: email

    RecipientAuthorizationPublishResponse:
      type: object
      properties:
        url:
          description: The URL for the recipient authorization.
          type: string

    RecipientAuthorizationSignPayload:
      type: object
      required:
        - signerName
        - accountNumber
        - accountType
        - routingNumber
      properties:
        signerName:
          description: The signer's legal name.
          type: string
        accountNumber:
          description: The account number entered by the signer.
          type: string
          maxLength: 17
        accountType:
          description: The account type entered by the signer.
          $ref: '#/components/schemas/AccountType'
        routingNumber:
          description: The routing number entered by the signer.
          type: string

    RecipientAuthorizationRevokePayload:
      type: object
      required:
        - revokerName
      properties:
        revokerName:
          description: The revoker's legal name.
          type: string

    ExistingFileUpload:
      type: object
      description: Used in Recipient Authorization
      properties:
        fileUploadId:
          type: string

    FileUpload:
      type: object
      properties:
        fileUploadId:
          type: string
          readOnly: true
        profileId:
          type: string
          readOnly: true
        fileName:
          type: string
          maxLength: 50
        fileType:
          type: string
          enum:
            - AUTHORIZATION
            - COMPANY_LOGO
        fileSize:
          type: number
          readOnly: true
        dateUpdated:
          type: string
          readOnly: true
        dateCreated:
          type: string
          readOnly: true

    FileUploadUrlResponse:
      type: object
      properties:
        url:
          type: string
          description: File can be downloaded from this URL.

    FileUploadUrlTypeEnum:
      type: string
      enum:
        - UPLOAD
        - DOWNLOAD

    FileUploadUrl:
      type: object
      properties:
        fileUploadId:
          type: string
        urlType:
          $ref: '#/components/schemas/FileUploadUrlTypeEnum'
        url:
          type: string

    CompanyAuthorizationSettings:
      type: object
      required:
        - friendlyName
        - logo
      properties:
        companyId:
          type: string
          description: Unique ID of the COMPANY recipient that these settings belong to.
        friendlyName:
          type: string
          description: Name displayed on authorizations
        logo:
          description: Logo displayed on authorizations
          anyOf:
            - $ref: '#/components/schemas/ExistingFileUpload'
            - $ref: '#/components/schemas/FileUpload'
        logoUploadUrl:
          description: Contains a presigned URL that can be used to upload or download the company's logo
          $ref: '#/components/schemas/FileUploadUrl'

    VarianceTerms:
      type: object
      required:
        - nickname
        - termsText
      properties:
        varianceTermsId:
          type: string
          description: Not Updatable
        profileId:
          type: string
          description: Not Updatable
        nickname:
          type: string
        termsText:
          type: string
        dateUpdated:
          type: string
          readOnly: true
        dateCreated:
          type: string
          readOnly: true

    ExistingVarianceTerms:
      type: object
      description: Used in Recipient Authorization
      properties:
        varianceTermsId:
          type: string

    RevocationTerms:
      type: object
      required:
        - nickname
        - termsText
      properties:
        revocationTermsId:
          type: string
          description: Not Updatable
        profileId:
          type: string
          description: Not Updatable
        nickname:
          type: string
        termsText:
          type: string
        dateUpdated:
          type: string
          readOnly: true
        dateCreated:
          type: string
          readOnly: true

    ExistingRevocationTerms:
      type: object
      description: Used in Recipient Authorizations
      required:
        - revocationTermsId
      properties:
        revocationTermsId:
          type: string

    RecipientType:
      type: string
      enum:
        - COMPANY
        - CONSUMER
        - BUSINESS
    SecCode:
      type: string
      enum:
        - PPD
        - CCD
    SignUpStepEnum:
      type: string
      enum:
        - ABOUT_YOU
        - ABOUT_YOUR_COMPANY
        - PRICING
        - COMPLETE
    GetTokenPayload:
      type: object
      required:
        - key
        - secret
      properties:
        key:
          type: string
        secret:
          type: string
      example:
        key: 0449f0f8de3f4c4b2e39b8ecb6a0ae
        secret: o44fee80ribmb83mc2famcxtkfvys3kx

    RefreshTokenPayload:
      type: object
      required:
        - refresh_token
      properties:
        refresh_token:
          type: string
      example:
        refresh_token: refresh_fo2inf092hnf0i2n3ofi2n3fo2in

    GetTokenResponse:
      type: object
      required:
        - access_token
        - refresh_token
        - access_expires
        - refresh_expires
      properties:
        access_token:
          type: string
          description: |
            Sent in Authorization header to API endpoints. Expires 60 minutes after retrieval.
        refresh_token:
          type: string
          description: |
            Used to retrieve a new access_token without using credentials. Expires 12 hours after
            retrieval.
        access_expires:
          type: number
          description: UTC millisecond timestamp when access_token expires
        refresh_expires:
          type: number
          description: UTC millisecond timestamp when refresh_token expires
      example:
        access_token: api_fn208fh2983fhoqfln2okjfn2b984fhb29iubfno2b09f8h
        refresh_token: refresh_g20g32nrgvfs0v8i23jbfowdjfbvw98ufb2kjfbofuvo203
        access_expires: 1670776627005
        refresh_expires: 1670809080000

    User:
      type: object
      required:
        - firstName
        - lastName
        - email
      properties:
        userId:
          type: string
          description: |
            Not Updatable
        profileId:
          type: string
          description: |
            Not Updatable
        firstName:
          type: string
        lastName:
          type: string
        email:
          type: string
          format: email
        canManageUsers:
          type: boolean
          default: false
        canManageApiKeys:
          type: boolean
          default: false
        canManageRecipientAuthorizations:
          type: boolean
          default: false
        mfaEnabled:
          type: boolean
          default: false
        mfaPhoneNumber:
          type: string
          nullable: true
        isPrimary:
          type: boolean
          description: There is only one primary user per profile. Not Updatable
      example:
        userId: 03547CAADB604040ABCCBA59D1B95937
        profileId: 59DE4FF642E543E0908AF7B18A78209E
        firstName: Bruce
        lastName: Wayne
        email: [email protected]
        canManageUsers: true
        canManageApiKeys: true
        mfaEnabled: true
        mfaPhoneNumber: '1235558888'
        isPrimary: true

    RecipientUser:
      type: object
      properties:
        recipientUserId:
          type: string
          readOnly: true
        firstName:
          type: string
        lastName:
          type: string
        email:
          type: string
        dateUpdated:
          type: string
          readOnly: true
        dateCreated:
          type: string
          readOnly: true

    Error:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
        message:
          type: string
        errors:
          type: array
          description: |
            A list of validation errors that describe request body issues.
          items:
            properties:
              field:
                type: string
              message:
                type: string

    null_type:
      title: "OpenAPI 3.0 null-type ref"
      description: "for adding nullability to a ref"
      enum: [null]

  securitySchemes:
    BearerToken:
      type: http
      scheme: bearer