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

# Return an ACH

> Returns an incoming ACH, dishonors a return you received, or contests a dishonor of your return. The `network_code` decides which.

> [!NOTE]
>
> See [Errors](https://docs.lead.bank/api-reference/using-the-api/errors-v2.md) for the common errors every v2 endpoint can return.


## OpenAPI

````yaml openapi.json POST /v2/ach/{id}/return
openapi: 3.0.1
info:
  title: Lead Bank
  description: Lead Bank's APIs
  version: v1.0
servers:
  - url: https://api.sandbox.lead.bank
  - url: https://api.lead.bank
security:
  - bearerAuth: []
tags:
  - name: ACH
  - name: ACHv2
  - name: Account Number
  - name: OAuth
  - name: Events
  - name: Instant Payments
  - name: Lending
  - name: Simulation
  - name: Sandbox
  - name: Internal Transfer
  - name: Disbursement
  - name: Entity
  - name: Wire
  - name: Originator
  - name: Funding
  - name: Receivable Sale
  - name: Balances
  - name: Compliance
  - name: Application
  - name: User Account
  - name: Blockchain Payment
  - name: Core Account
  - name: Core Balance
  - name: Core Transaction
  - name: Event Subscription
  - name: Receivable
  - name: User Credit Transaction
  - name: Files
paths:
  /v2/ach/{id}/return:
    post:
      tags:
        - ACHv2
      summary: Return an ACH V2
      description: >-
        Returns an incoming ACH, dishonors a return you received, or contests a
        dishonor of your return. The `network_code` decides which.
      operationId: return-an-ach-v2
      parameters:
        - name: Idempotency-Key
          in: header
          description: Idempotency key
          required: true
          schema:
            $ref: '#/components/schemas/IdempotencyKey'
        - name: id
          description: ID of the ACH object you want to return.
          example: ach_xyz001
          in: path
          required: true
          schema:
            type: string
            pattern: ^ach_\w+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - network_code
              properties:
                network_code:
                  $ref: '#/components/schemas/OutgoingReturnCode'
      responses:
        '200':
          description: The now-returned original ACH object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AchV2'
              examples:
                pending_return:
                  summary: Incoming debit with a return in progress
                  value:
                    id: ach_xyz003
                    core_transaction_id: core_transaction_xyz456~1
                    core_balance_id: core_balance_xyz123
                    created_at: '2022-06-28T08:00:00Z'
                    status: pending_return
                    amount: 2500
                    account_number_id: account_number_xyz123
                    direction: incoming
                    transaction_type: debit
                    sec_code: PPD
                    currency: USD
                    statement_descriptor: UTILITY
                    transaction_code: checking_debit
                    company_name: City Power Co.
                    company_identification: '9876543210'
                    effective_date: '2022-06-28'
                    settlement_date: '2022-06-28'
                    individual_identification_number: ACCT-778899
                    receiver_name: Lara Smikle
                    trace_number: '091000010000001'
                    counterparty:
                      name: City Power Co.
                      routing_number: '091000019'
                    returns:
                      - type: return
                        status: scheduled
                        network_code: R01
                        reason: non_sufficient_funds
                        details: >-
                          The balance behind account number
                          account_number_xyz123 couldn't cover this debit of
                          $25.00.
                    metadata: {}
        4XX:
          $ref: '#/components/responses/Error4XX'
        5XX:
          $ref: '#/components/responses/Error5XX'
components:
  schemas:
    IdempotencyKey:
      type: string
      description: >-
        A unique key for this request, up to 255 characters. Retrying with the
        same key and body returns the original response instead of performing
        the operation again.
      minLength: 1
      maxLength: 255
      example: 3f1c9a52-7d4e-4b8a-9c21-6e0f5d2a8b14
    OutgoingReturnCode:
      type: string
      description: |
        The NACHA Return code under which to initiate this return.
        R0x–R5x initiate a standard return against the original ACH origination.
        R61, R62, R67, R68, R69, R70 dishonor an existing return.
        R71–R77 contest an existing dishonored return.
        The return code must match the current state of the return chain.
      example: R02
      enum:
        - R01
        - R02
        - R03
        - R05
        - R07
        - R08
        - R09
        - R10
        - R11
        - R14
        - R15
        - R16
        - R17
        - R22
        - R23
        - R29
        - R61
        - R62
        - R67
        - R68
        - R69
        - R70
        - R71
        - R72
        - R73
        - R74
        - R75
        - R76
        - R77
    AchV2:
      type: object
      properties:
        id:
          type: string
          description: The ACH's unique ID. It starts with `ach_`.
          example: ach_xyz001
          pattern: ^ach_\w+$
        core_transaction_id:
          $ref: '#/components/schemas/CoreTransactionID'
          description: >-
            The ID of the core transaction created when the ACH posts. Absent
            until then. A return that posts has its own `core_transaction_id` in
            `returns`.
        core_balance_id:
          $ref: '#/components/schemas/CoreBalanceID'
          description: >-
            The ID of the core balance the ACH posts to. Lead sets it from the
            account number. If the account number is on a user deposit balance,
            it's the core balance behind it.
        created_at:
          type: string
          format: date-time
          description: The ISO-8601 timestamp at which the ACH object was created.
          example: '2022-06-27T11:22:33Z'
        status:
          $ref: '#/components/schemas/AchStatus'
        amount:
          allOf:
            - $ref: '#/components/schemas/Amount'
          description: The amount of the transaction in cents.
          minimum: 0
        account_number_id:
          $ref: '#/components/schemas/AccountNumberID'
        direction:
          $ref: '#/components/schemas/Direction'
        delivery_type:
          $ref: '#/components/schemas/DeliveryType'
        transaction_type:
          $ref: '#/components/schemas/TransactionType'
        sec_code:
          $ref: '#/components/schemas/SecCode'
        currency:
          $ref: '#/components/schemas/USDCurrency'
        statement_descriptor:
          $ref: '#/components/schemas/StatementDescriptor'
        transaction_code:
          $ref: '#/components/schemas/TransactionCode'
        company_name:
          type: string
          description: |-
            The company that initiated the ACH.

            - Outgoing: set from the originator the account number sends under.
            - Incoming: as received.
          example: Acme Inc.
          pattern: ^[\x20-\x7E]*$
        company_identification:
          type: string
          description: |-
            - Outgoing: set from the originator the account number sends under.
            - Incoming: as received.
          example: '1234567890'
        company_discretionary_data:
          type: string
          description: Additional information from the ACH sender on incoming ACH.
          example: Acme Inc.
        effective_date:
          type: string
          format: date
          description: >-
            The date the ACH transaction is expected to settle with the
            financial institution, as a Federal Reserve banking day (a weekday
            that isn't a Federal Reserve holiday).


            - Outgoing: set by Lead from `delivery_type`.

            - Incoming: as received.
          example: '2022-06-27'
        settlement_date:
          type: string
          format: date
          description: >-
            The Federal Reserve banking day (a weekday that isn't a Federal
            Reserve holiday) by which funds must be posted to the counterparty's
            account.
          example: '2022-06-27'
        individual_identification_number:
          $ref: '#/components/schemas/IndividualId'
        receiver_name:
          $ref: '#/components/schemas/ReceiverName'
        descriptive_date:
          $ref: '#/components/schemas/DescriptiveDate'
        additional_information:
          $ref: '#/components/schemas/AdditionalInformation'
        trace_number:
          type: string
          description: >-
            The unique number assigned to every ACH entry by an ODFI which
            identifies that entry within a specific ACH file.


            - For outgoing ACH, this is generated by Lead when we submit the
            ACH.

            - For incoming ACH, this value is what we receive from the sender.
          example: '123456789012345'
        counterparty:
          $ref: '#/components/schemas/AchV2Counterparty'
        returns:
          type: array
          description: Associated returns.
          items:
            $ref: '#/components/schemas/AchV2Return'
        reversal:
          type: object
          description: A reversal associated with this object.
          properties:
            reason:
              $ref: '#/components/schemas/ReversalReason'
            linked_ach_id:
              type: string
              description: The ID of the reversing ACH.
        rejection:
          $ref: '#/components/schemas/AchV2Rejection'
          description: >-
            The most recent rejection on this ACH; the transfer itself, or a
            return, dishonor or contest on it. Absent when there's none.
        correction:
          $ref: '#/components/schemas/AchCorrection'
          description: >-
            The corrected counterparty details from a notification of change
            (NOC). Present only when a NOC was received for this ACH.
        metadata:
          $ref: '#/components/schemas/AchV2Metadata'
        iat:
          $ref: '#/components/schemas/AchV2IatDetails'
      required:
        - id
        - created_at
        - status
        - amount
        - direction
        - transaction_type
        - sec_code
        - currency
        - statement_descriptor
        - counterparty
        - returns
        - metadata
    CoreTransactionID:
      type: string
      example: core_transaction_xyz123
      pattern: ^core_transaction_.+~\d+$
    CoreBalanceID:
      type: string
      example: core_balance_xyz123
      pattern: ^core_balance_\w+$
    AchStatus:
      description: The current status of the ACH object.
      type: string
      example: submitted
      enum:
        - scheduled
        - processing
        - submitted
        - posted
        - canceled
        - under_review
        - approved
        - rejected
        - pending_return
        - returned
        - pending_dishonored_return
        - return_dishonored
        - pending_contested_return
        - return_contested
    Amount:
      description: >-
        A monetary amount as an integer in the ISO 4217 minor units of its
        `currency` (cents for USD).
      type: integer
      format: int64
      example: 5000
    AccountNumberID:
      type: string
      description: The ID of the Lead Bank Account Number object.
      example: account_number_xyz123
      pattern: ^account_number_\w+$
    Direction:
      type: string
      description: |-
        Who is initiating the transaction.

        outgoing: You are sending a transaction to a counterparty.
        incoming: You are receiving a transaction from a counterparty.
      example: outgoing
      enum:
        - outgoing
        - incoming
    DeliveryType:
      type: string
      example: same_business_day
      description: "How fast you want the counterparty to receive the ACH.\n* `same_business_day`: if the ACH request is submitted before the cutoff window with the same business day option, funds will settle on the same day.\_\n* `next_business_day`: standard ACH processing, for funds to settle on the next business day."
      enum:
        - same_business_day
        - next_business_day
    TransactionType:
      type: string
      description: ACH transaction type.
      example: credit
      enum:
        - credit
        - debit
    SecCode:
      type: string
      description: >-
        Standard Entry Class (SEC) code for this ACH object. This list covers
        every code Lead can receive on incoming ACH. Outgoing ACH accept a
        narrower list, `OutgoingSecCode`, which is what Lead originates.
      example: WEB
      enum:
        - PPD
        - CCD
        - ARC
        - BOC
        - CIE
        - CTX
        - IAT
        - POP
        - POS
        - RCK
        - TEL
        - WEB
        - ADV
        - DNE
        - ENR
        - MTE
        - SHR
        - TRC
        - TRX
        - COR
    USDCurrency:
      type: string
      description: >-
        A three-letter currency code as defined in ISO 4217. `USD` is the only
        supported value.
      example: USD
      enum:
        - USD
    StatementDescriptor:
      type: string
      description: >-
        The description you would like to appear on your customers’ statement.
        Maximum number of characters is 10.
      example: P2P Credit
      minLength: 1
      maxLength: 10
      pattern: ^(?!0+$)(?! +$)[\x20-\x7E]*$
    TransactionCode:
      type: string
      example: checking_credit
      description: Identifies the type of debit or credit Entry and the account type
      enum:
        - checking_credit
        - checking_credit_prenote
        - checking_debit
        - checking_debit_prenote
        - savings_credit
        - savings_credit_prenote
        - savings_debit
        - savings_debit_prenote
    IndividualId:
      type: string
      description: >-
        The value in the Nacha Individual Identification Number field of the
        entry. Optional.


        - On an outgoing ACH with `sec_code` `CCD`, `PPD`, `TEL`, or `WEB`, Lead
        sends it exactly as you provide it.

        - On an outgoing ACH with `sec_code` `CIE`, Lead ignores the value you
        send and sets this field to the name of the individual who owns the
        originating account number.

        - On an incoming ACH, this is the value the originator sent.


        Nacha requires this for person-to-person WEB credits.
      maxLength: 15
      pattern: ^[\x20-\x7E]*$
    ReceiverName:
      type: string
      description: >-
        The name of the receiver of funds. _Note: This field is set by the
        counterparty and may or not be accurate._
      pattern: ^[\x20-\x7E]*$
    DescriptiveDate:
      type: string
      description: >-
        Free text the originator sets for the receiver's bank to show on the
        statement, up to 6 characters. Nacha calls this the Company Descriptive
        Date, but Lead doesn't check its format, so it isn't guaranteed to be a
        date (incoming values include `OCT 08`, `DUES` and `000000`). Don't
        parse it as a date.
      example: OCT 08
      maxLength: 6
      pattern: ^[\x20-\x7E]*$
    AdditionalInformation:
      type: string
      description: >-
        Additional information for the ACH recipient. _Not all banks will share
        this message with their end customer._
      maxLength: 80
      pattern: ^[\x20-\x7E]*$
    AchV2Counterparty:
      type: object
      description: >-
        The details of the counterparty you are sending money to or receiving
        money from.


        On incoming ACH, only `name` and `routing_number` are returned, because
        the Nacha record doesn't carry the sender's account number or account
        type.
      required:
        - name
        - routing_number
      properties:
        name:
          type: string
          description: The name of the counterparty you are transacting with.
          example: Lara Smikle
          maxLength: 22
          pattern: ^(?!\s*$)[\x20-\x7E]*$
        account_number:
          type: string
          description: The account number for the bank account. Absent on incoming ACH.
          example: '1032345678'
          maxLength: 17
          pattern: ^[a-zA-Z0-9 ]*[a-zA-Z0-9]+$
        routing_number:
          type: string
          description: >-
            The routing number for the bank account. This should be the ACH
            routing number, not the wire routing number.
          example: '021000021'
          minLength: 9
          maxLength: 9
          pattern: ^[0-9]+$
        account_type:
          $ref: '#/components/schemas/AccountType'
          description: >-
            The account type for the bank account, `checking` or `savings`.
            Absent on incoming ACH.
    AchV2Return:
      type: object
      required:
        - type
        - status
      properties:
        core_transaction_id:
          $ref: '#/components/schemas/CoreTransactionID'
          description: >-
            The core transaction this return posted. Absent until the return
            posts, and absent on a return that was declined.
        type:
          type: string
          description: >-
            Type of the return record, determined by the respective network
            code.
          example: return
          enum:
            - return
            - dishonored_return
            - contested_return
        status:
          $ref: '#/components/schemas/AchStatus'
          description: The status of this return.
        network_code:
          $ref: '#/components/schemas/ReturnCode'
        reason:
          $ref: '#/components/schemas/AchV2ReturnReason'
        trace_number:
          type: string
          description: >-
            The unique number assigned to this ACH return by the ODFI, which
            identifies the entry within a specific ACH file.
          example: '123456789012345'
        details:
          type: string
          description: >-
            A readable explanation of the return, with the IDs and values
            involved. When `reason` is `other`, it includes the returning bank's
            text. Don't parse it; the format can change.
    ReversalReason:
      type: string
      description: Reason you want to initiate a reversal.
      enum:
        - duplicate
        - receiver_incorrect
        - amount_incorrect
        - debit_too_early
        - credit_too_late
    AchV2Rejection:
      type: object
      required:
        - reason
        - details
      properties:
        reason:
          $ref: '#/components/schemas/AchV2RejectionReason'
        details:
          type: string
          description: Additional info about the rejection
          example: >-
            Account number account_number_123 is inactive. It must be active
            first.
    AchCorrection:
      type: object
      description: The corrected `counterparty` details.
      properties:
        account_number:
          type: string
          description: The updated account number for the `counterparty`.
          example: '1032345678'
          maxLength: 17
        routing_number:
          type: string
          description: The updated routing number for the `counterparty`.
          example: '021000021'
          minLength: 9
          maxLength: 9
        account_type:
          type: string
          description: The updated account type for the `counterparty`.
          enum:
            - checking
            - savings
    AchV2Metadata:
      type: object
      maxProperties: 50
      additionalProperties:
        type: string
        maxLength: 255
      description: >-
        A set of key-value pairs that can be used to store additional
        information related to this object.


        Limits: up to 50 keys, each key up to 40 characters, each value a string
        up to 255 characters.

        On create, the map is set. On PATCH, it's merged: keys you send are
        added or overwritten, and

        keys you don't send are kept. The limits apply to the merged result. A
        request over a limit fails with a 422.
    AchV2IatDetails:
      type: object
      description: >-
        IAT (International ACH Transaction) specific details. Present only when
        sec_code is IAT.
      required:
        - foreign_correspondent_banks
      properties:
        transaction_type_code:
          $ref: '#/components/schemas/IatTransactionTypeCode'
        destination:
          $ref: '#/components/schemas/AchV2IatDestination'
        foreign_trace_number:
          type: string
          description: >-
            Trace number assigned to the Entry in the originating national
            payments system. Only present for inbound IAT entries.
          example: FRN-2024-98765-INTL
          maxLength: 22
          pattern: ^[\x20-\x7E]*$
        additional_information:
          $ref: '#/components/schemas/AdditionalInformation'
        originator:
          $ref: '#/components/schemas/AchV2IatOriginator'
        originating_financial_institution:
          $ref: '#/components/schemas/AchV2IatFinancialInstitution'
        receiver:
          $ref: '#/components/schemas/IatReceiver'
        receiving_financial_institution:
          $ref: '#/components/schemas/AchV2IatFinancialInstitution'
        foreign_correspondent_banks:
          type: array
          description: >-
            Intermediary or correspondent banks in the payment chain. Up to 5
            banks may be listed. Empty when there are none.
          maxItems: 5
          items:
            $ref: '#/components/schemas/AchV2IatFinancialInstitution'
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            A human-readable description of the error family. Identical for
            every occurrence of a given `code`; carries no request-specific
            detail.
          example: One or more parameters are invalid. See errors for each one.
        errors:
          type: array
          description: >-
            Zero or more specific errors within this family. Always present for
            validation errors, one entry per failing field.
          items:
            $ref: '#/components/schemas/ErrorItem'
    AccountType:
      type: string
      example: checking
      description: >-
        The account type for the bank account. This should be one of checking or
        savings.
      enum:
        - checking
        - savings
    ReturnCode:
      type: string
      description: NACHA Return codes.
      example: R02
      enum:
        - R01
        - R02
        - R03
        - R04
        - R05
        - R06
        - R07
        - R08
        - R09
        - R10
        - R11
        - R12
        - R13
        - R14
        - R15
        - R16
        - R17
        - R18
        - R19
        - R20
        - R21
        - R22
        - R23
        - R24
        - R25
        - R26
        - R27
        - R28
        - R29
        - R30
        - R31
        - R32
        - R33
        - R34
        - R35
        - R36
        - R37
        - R38
        - R39
        - R40
        - R41
        - R42
        - R43
        - R44
        - R45
        - R46
        - R47
        - R50
        - R51
        - R52
        - R53
        - R61
        - R62
        - R67
        - R68
        - R69
        - R70
        - R71
        - R72
        - R73
        - R74
        - R75
        - R76
        - R77
        - R80
        - R81
        - R82
        - R83
        - R84
        - R85
    AchV2ReturnReason:
      type: string
      description: >-
        Why the ACH was returned. New values can be added, so treat any value
        you don't recognize as `other`.

        When Lead returns an incoming ACH because it failed a check, `reason`
        matches the ACH's `rejection.reason`. If Lead returns it after manual
        review, `reason` comes from the return code Lead chose. A return you
        send can only produce `user_account_status_not_permitted`,
        `non_sufficient_funds`, `account_number_name_mismatched`, a value under
        the receiver's customer, `payment_already_returned`, `value_malformed`,
        or a return-chain value.


        Your side:

        - `account_number_status_not_permitted`: Your account number isn't
        active. Retryable once it's active.

        - `account_number_not_found`: No account number in your program matches.
        Not retryable.

        - `account_number_control_restricted`: A control on your account number
        blocks the payment. Retryable once the control changes.

        - `core_balance_status_not_permitted`: The core balance or core account
        behind your account number isn't active. Retryable once it's active.

        - `user_account_status_not_permitted`: Your customer's user account is
        closed, frozen or inactive. Retryable once it's active.

        - `non_sufficient_funds`: Funds on your side couldn't cover the debit.
        Retryable.

        - `account_number_name_mismatched`: The name or individual ID on the
        payment is missing or doesn't match your account number. Not retryable.


        The counterparty:

        - `counterparty_account_invalid`: The counterparty's account is closed,
        blocked, can't be found, or can't take this payment. Not retryable.

        - `counterparty_information_invalid`: The counterparty's address, ID or
        other details are missing or invalid. Not retryable.

        - `counterparty_non_sufficient_funds`: The counterparty's account
        couldn't cover your debit. Retryable.


        Their bank and the network:

        - `bank_identifier_not_recognized`: A routing number on the payment
        isn't recognized. Not retryable.


        The receiver's customer:

        - `payment_refused`: The receiver or their customer refused the payment.
        Not retryable.

        - `customer_deceased`: The receiving account holder has died. Not
        retryable.

        - `debit_not_authorized`: The receiver's customer says the debit wasn't
        authorized. Not retryable.

        - `payment_stopped`: The receiver's customer placed a stop payment. Not
        retryable.


        The payment:

        - `return_request_accepted`: Sent back because the sender asked for it.
        Not retryable.

        - `payment_already_submitted`: The receiver treated this as a duplicate.
        Not retryable.

        - `payment_already_returned`: This payment was already returned. Not
        retryable.

        - `value_malformed`: A field didn't pass the network's or the receiving
        bank's checks. Not retryable.


        Return chain:

        - `original_payment_mismatched`: The return or dishonor doesn't match an
        original entry. Not retryable.

        - `return_window_expired`: The return or dishonor came after its Nacha
        window. Not retryable.

        - `return_dishonored`: The return wasn't allowed. Not retryable.

        - `return_contested`: The receiver contests your dishonor. Not
        retryable.


        Lead's decision and the catch-all:

        - `compliance_restricted`: A Lead compliance control blocked the
        payment. Not retryable.

        - `other`: No specific reason was given, or the code isn't mapped. Not
        retryable.
      example: counterparty_non_sufficient_funds
      enum:
        - account_number_status_not_permitted
        - account_number_not_found
        - account_number_control_restricted
        - core_balance_status_not_permitted
        - user_account_status_not_permitted
        - non_sufficient_funds
        - account_number_name_mismatched
        - counterparty_account_invalid
        - counterparty_information_invalid
        - counterparty_non_sufficient_funds
        - bank_identifier_not_recognized
        - payment_refused
        - customer_deceased
        - debit_not_authorized
        - payment_stopped
        - return_request_accepted
        - payment_already_submitted
        - payment_already_returned
        - value_malformed
        - original_payment_mismatched
        - return_window_expired
        - return_dishonored
        - return_contested
        - compliance_restricted
        - other
    AchV2RejectionReason:
      type: string
      description: >
        Why Lead rejected the ACH. New values can be added, so treat any value
        you don't recognize as `other`.

        See the ACH rejection reasons guide for what each value means and
        whether you can retry.
      example: account_number_status_not_permitted
      enum:
        - account_number_not_found
        - account_number_status_not_permitted
        - account_number_control_restricted
        - core_balance_status_not_permitted
        - non_sufficient_funds
        - aggregate_limit_exceeded
        - sec_code_not_permitted_for_balance
        - sec_code_not_permitted_for_originator
        - originator_status_not_permitted
        - bank_identifier_not_recognized
        - value_malformed
        - value_not_permitted
        - effective_date_too_late
        - original_payment_mismatched
        - payment_already_returned
        - return_window_expired
        - correction_not_applied
        - prenote_window_active
        - prenote_returned
        - compliance_restricted
        - internal_error
        - other
    IatTransactionTypeCode:
      type: string
      description: Identifies the purpose of the IAT transaction.
      example: business
      enum:
        - annuity
        - business
        - deposit
        - loan
        - miscellaneous
        - mortgage
        - pension
        - rental_lease
        - salary
        - tax
        - telephone
        - internet
        - accounts_receivable
        - back_office_conversion
        - point_of_purchase
        - represented_check
    AchV2IatDestination:
      type: object
      description: Where an IAT transaction is received.
      properties:
        country:
          $ref: '#/components/schemas/Country'
          description: >-
            ISO 3166-1 alpha-2 country code identifying the destination country
            of the transaction.
          example: CA
        currency:
          $ref: '#/components/schemas/Currency'
          description: >-
            ISO 4217 three-letter currency code in which the ACH will be
            received.
          example: CAD
    AchV2IatOriginator:
      type: object
      description: >-
        Name, address and currency of the originator of an IAT transaction, in
        Nacha format.
      properties:
        name:
          type: string
          description: Name of the party.
          example: Acme Inc.
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        street_address:
          type: string
          description: Physical street address of the party.
          example: 123 Main Street
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        city_state_province:
          type: string
          description: City and state or province of the party. Max 35 characters
          example: New York*NY\
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        country_postal_code:
          type: string
          description: >-
            Nacha's combined Country & Postal Code field for the party, up to 35
            characters: the ISO 3166-1 alpha-2 country code, an asterisk (`*`),
            the postal code, and a closing backslash (`\`). For example,
            `US*10001\`.
          example: US*10001\
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        currency:
          $ref: '#/components/schemas/Currency'
          description: ISO 4217 three-letter currency code in which the ACH was originated.
          example: USD
    AchV2IatFinancialInstitution:
      type: object
      description: Financial institution details for an IAT transaction.
      properties:
        name:
          type: string
          description: Name of the financial institution.
          example: First National Bank
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        identifier_type:
          type: string
          description: >-
            Type of bank identifier. Absent when the Nacha ID Number Qualifier
            isn't one of these.
          example: business_identifier_code
          enum:
            - national_clearing_system
            - business_identifier_code
            - iban
        identifier_code:
          type: string
          description: >-
            The identifier value for the financial institution, corresponding to
            the `identifier_type` (e.g., BIC, routing number, IBAN).
          example: FNBUS33XXX
          maxLength: 34
          pattern: ^[\x20-\x7E]*$
        country:
          $ref: '#/components/schemas/Country'
          description: >-
            ISO 3166-1 alpha-2 country code for the branch country of the
            financial institution.
          example: US
    IatReceiver:
      type: object
      description: >-
        Name, reference number, and address of the receiver of an IAT
        transaction.
      properties:
        name:
          type: string
          description: Name of the receiver or beneficiary of the transaction.
          example: Lara Smikle
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        reference_number:
          type: string
          description: >-
            Reference number assigned by the originator for tracking this
            receiver or payment.
          example: RCV-2024-001
          maxLength: 15
          pattern: ^[\x20-\x7E]*$
        street_address:
          type: string
          description: Physical street address of the receiver.
          example: 456 Maple Avenue
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        city_state_province:
          type: string
          description: City and state or province of the receiver. Max 35 characters.
          example: Toronto*ON\
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
        country_postal_code:
          type: string
          description: >-
            Nacha's combined Country & Postal Code field for the receiver, up to
            35 characters: the ISO 3166-1 alpha-2 country code, an asterisk
            (`*`), the postal code, and a closing backslash (`\`). For example,
            `CA*M5H 2N2\`.
          example: CA*M5H 2N2\
          maxLength: 35
          pattern: ^[\x20-\x7E]*$
    ErrorCode:
      type: string
      description: >-
        A snake_case code identifying the error family — the stable,
        machine-readable value partners branch on, together with the HTTP
        status.
      example: parameters_invalid
      enum:
        - request_malformed
        - content_too_large
        - headers_invalid
        - unsupported_media_type
        - authentication_missing
        - token_invalid
        - source_ip_not_permitted
        - client_credentials_invalid
        - url_invalid
        - object_not_found
        - method_not_allowed
        - idempotency_key_in_use
        - idempotency_request_mismatched
        - rate_limit_exceeded
        - internal_server_error
        - service_unavailable
        - endpoint_disabled
        - gateway_timeout
        - parameters_invalid
        - related_object_invalid
        - related_object_not_ready
        - related_object_incompatible
        - limit_exceeded
        - partner_control_restricted
        - lead_control_restricted
        - object_state_mismatched
        - object_modified_concurrently
        - operation_invalid
    ErrorItem:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: A snake_case code naming the specific error or sub-category.
          example: schema_violation
        message:
          type: string
          description: >-
            A human-readable description of this specific error, with
            interpolated values where relevant.
          example: account_number_id is required.
        parameters:
          type: array
          description: >-
            The request fields that caused this error, as `jq` paths without the
            leading dot. For example, a nested field is `address.city` and an
            array item is `beneficial_owners[1].ownership`. A key with
            characters other than letters, digits, and underscores is
            JSON-quoted, like `metadata["order.id"]`. Headers appear by name,
            like `Idempotency-Key`. Present for validation errors.
          items:
            type: string
          example:
            - account_number_id
    Country:
      type: string
      description: >-
        ISO 3166-1 alpha-2 country code. Only officially assigned codes are
        accepted.
      example: US
      enum:
        - AD
        - AE
        - AF
        - AG
        - AI
        - AL
        - AM
        - AO
        - AQ
        - AR
        - AS
        - AT
        - AU
        - AW
        - AX
        - AZ
        - BA
        - BB
        - BD
        - BE
        - BF
        - BG
        - BH
        - BI
        - BJ
        - BL
        - BM
        - BN
        - BO
        - BQ
        - BR
        - BS
        - BT
        - BV
        - BW
        - BY
        - BZ
        - CA
        - CC
        - CD
        - CF
        - CG
        - CH
        - CI
        - CK
        - CL
        - CM
        - CN
        - CO
        - CR
        - CU
        - CV
        - CW
        - CX
        - CY
        - CZ
        - DE
        - DJ
        - DK
        - DM
        - DO
        - DZ
        - EC
        - EE
        - EG
        - EH
        - ER
        - ES
        - ET
        - FI
        - FJ
        - FK
        - FM
        - FO
        - FR
        - GA
        - GB
        - GD
        - GE
        - GF
        - GG
        - GH
        - GI
        - GL
        - GM
        - GN
        - GP
        - GQ
        - GR
        - GS
        - GT
        - GU
        - GW
        - GY
        - HK
        - HM
        - HN
        - HR
        - HT
        - HU
        - ID
        - IE
        - IL
        - IM
        - IN
        - IO
        - IQ
        - IR
        - IS
        - IT
        - JE
        - JM
        - JO
        - JP
        - KE
        - KG
        - KH
        - KI
        - KM
        - KN
        - KP
        - KR
        - KW
        - KY
        - KZ
        - LA
        - LB
        - LC
        - LI
        - LK
        - LR
        - LS
        - LT
        - LU
        - LV
        - LY
        - MA
        - MC
        - MD
        - ME
        - MF
        - MG
        - MH
        - MK
        - ML
        - MM
        - MN
        - MO
        - MP
        - MQ
        - MR
        - MS
        - MT
        - MU
        - MV
        - MW
        - MX
        - MY
        - MZ
        - NA
        - NC
        - NE
        - NF
        - NG
        - NI
        - NL
        - 'NO'
        - NP
        - NR
        - NU
        - NZ
        - OM
        - PA
        - PE
        - PF
        - PG
        - PH
        - PK
        - PL
        - PM
        - PN
        - PR
        - PS
        - PT
        - PW
        - PY
        - QA
        - RE
        - RO
        - RS
        - RU
        - RW
        - SA
        - SB
        - SC
        - SD
        - SE
        - SG
        - SH
        - SI
        - SJ
        - SK
        - SL
        - SM
        - SN
        - SO
        - SR
        - SS
        - ST
        - SV
        - SX
        - SY
        - SZ
        - TC
        - TD
        - TF
        - TG
        - TH
        - TJ
        - TK
        - TL
        - TM
        - TN
        - TO
        - TR
        - TT
        - TV
        - TW
        - TZ
        - UA
        - UG
        - UM
        - US
        - UY
        - UZ
        - VA
        - VC
        - VE
        - VG
        - VI
        - VN
        - VU
        - WF
        - WS
        - XK
        - YE
        - YT
        - ZA
        - ZM
        - ZW
    Currency:
      type: string
      description: A three-letter currency code as defined in ISO 4217.
      example: USD
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BOV
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHE
        - CHF
        - CHW
        - CLF
        - CLP
        - CNH
        - CNY
        - COP
        - COU
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GGP
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HTG
        - HUF
        - IDR
        - ILS
        - IMP
        - INR
        - IQD
        - IRR
        - ISK
        - JEP
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KPW
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - MXV
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SDG
        - SEK
        - SGD
        - SHP
        - SLE
        - SOS
        - SRD
        - SSP
        - STD
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - USN
        - UYI
        - UYU
        - UYW
        - UZS
        - VED
        - VES
        - VND
        - VUV
        - WST
        - XAD
        - XAF
        - XAG
        - XAU
        - XBA
        - XBB
        - XBC
        - XBD
        - XCD
        - XCG
        - XDR
        - XMW
        - XOF
        - XPD
        - XPF
        - XPT
        - XSU
        - XTS
        - XUA
        - XXX
        - YER
        - ZAR
        - ZMW
        - ZWG
  responses:
    Error4XX:
      x-api-version: v2
      description: >-
        A client error. The HTTP status and `code` identify the problem; `code`
        is one of the top-level codes in the Lead Error Registry. Branch on
        `code` together with the status. The examples show each registry code
        that can return a 4xx status. Not every code applies to every endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            request_malformed:
              summary: 400 request_malformed
              value:
                code: request_malformed
                message: The request couldn't be parsed. Fix its format and resend it.
                errors:
                  - code: url_malformed
                    message: >-
                      The request URL contains characters that can't be parsed.
                      URL-encode path and query values.
            headers_invalid:
              summary: 400 headers_invalid
              value:
                code: headers_invalid
                message: One or more headers are invalid. See errors for each one.
                errors:
                  - code: idempotency_key_invalid
                    message: >-
                      This endpoint requires an Idempotency-Key header of up to
                      255 characters. Set the header and resend the request.
                    parameters:
                      - Idempotency-Key
            client_credentials_invalid:
              summary: 401 client_credentials_invalid
              value:
                code: client_credentials_invalid
                message: >-
                  Your client ID or client secret is wrong. Check them and
                  resend the request.
            authentication_missing:
              summary: 403 authentication_missing
              value:
                code: authentication_missing
                message: >-
                  The request has no authentication credentials. Send your API
                  token in the Authorization header.
            token_invalid:
              summary: 403 token_invalid
              value:
                code: token_invalid
                message: >-
                  Your bearer token is expired, invalid, or lacks required
                  scopes. Get a new token.
            source_ip_not_permitted:
              summary: 403 source_ip_not_permitted
              value:
                code: source_ip_not_permitted
                message: >-
                  This request came from an IP address that isn't on your
                  program's allowlist. Send from an allowlisted IP, or contact
                  Lead to update the list.
            url_invalid:
              summary: 404 url_invalid
              value:
                code: url_invalid
                message: >-
                  This path isn't a valid endpoint. Check the URL against the
                  API reference.
            object_not_found:
              summary: 404 object_not_found
              value:
                code: object_not_found
                message: >-
                  No object with this ID exists, or your program can't access
                  it. Check the ID.
            method_not_allowed:
              summary: 405 method_not_allowed
              value:
                code: method_not_allowed
                message: >-
                  This path doesn't support this HTTP method. Check the API
                  reference for the methods it accepts.
            idempotency_key_in_use:
              summary: 409 idempotency_key_in_use
              value:
                code: idempotency_key_in_use
                message: >-
                  Another request with this Idempotency-Key is still processing.
                  Wait for it to finish, then retry.
            object_modified_concurrently:
              summary: 409 object_modified_concurrently
              value:
                code: object_modified_concurrently
                message: >-
                  Another request changed this object while yours was
                  processing, so yours wasn't applied. Fetch the object's
                  current state and retry.
            content_too_large:
              summary: 413 content_too_large
              value:
                code: content_too_large
                message: >-
                  The request is over a size limit for this endpoint. Make it
                  smaller and resend it.
            unsupported_media_type:
              summary: 415 unsupported_media_type
              value:
                code: unsupported_media_type
                message: >-
                  The request is in a format this endpoint doesn't accept.
                  Change it to a supported format and resend it.
            idempotency_request_mismatched:
              summary: 422 idempotency_request_mismatched
              value:
                code: idempotency_request_mismatched
                message: >-
                  This Idempotency-Key was already used with a different request
                  body. Use a new key, or resend the original body.
            parameters_invalid:
              summary: 422 parameters_invalid
              value:
                code: parameters_invalid
                message: One or more parameters are invalid. See errors for each one.
                errors:
                  - code: parameter_bound_exceeded
                    message: limit is 500, which is over the maximum of 100.
                    parameters:
                      - limit
            related_object_invalid:
              summary: 422 related_object_invalid
              value:
                code: related_object_invalid
                message: >-
                  An object this request refers to doesn't exist or can't be
                  used. Fix the reference, or create the object first.
            related_object_not_ready:
              summary: 422 related_object_not_ready
              value:
                code: related_object_not_ready
                message: >-
                  An object this request depends on isn't ready for it. Update
                  that object, then retry the same request.
            related_object_incompatible:
              summary: 422 related_object_incompatible
              value:
                code: related_object_incompatible
                message: >-
                  This request conflicts with an object it refers to. Change the
                  request to match the object.
            limit_exceeded:
              summary: 422 limit_exceeded
              value:
                code: limit_exceeded
                message: >-
                  This request is over a limit. Lower the amount or count. Check
                  errors for when, or whether, the limit resets.
            partner_control_restricted:
              summary: 422 partner_control_restricted
              value:
                code: partner_control_restricted
                message: >-
                  A partner-configured control blocks this request. Update the
                  control, then retry the same request.
            lead_control_restricted:
              summary: 422 lead_control_restricted
              value:
                code: lead_control_restricted
                message: >-
                  A Lead-configured control blocks this request. Contact Lead
                  with the Lead-Request-ID.
            object_state_mismatched:
              summary: 422 object_state_mismatched
              value:
                code: object_state_mismatched
                message: >-
                  The object isn't in the state this request expected. Fetch its
                  current state before you retry.
            operation_invalid:
              summary: 422 operation_invalid
              value:
                code: operation_invalid
                message: This operation isn't available for this object.
            rate_limit_exceeded:
              summary: 429 rate_limit_exceeded
              value:
                code: rate_limit_exceeded
                message: >-
                  You've sent too many requests to this endpoint. Retry with
                  exponential backoff.
    Error5XX:
      x-api-version: v2
      description: >-
        A server error on Lead's side. `code` is one of the 5xx codes in the
        Lead Error Registry. Retry with exponential backoff, and reuse the same
        Idempotency-Key for a POST, PATCH or DELETE.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            internal_server_error:
              summary: 500 internal_server_error
              value:
                code: internal_server_error
                message: >-
                  Internal server error. Retry with exponential backoff. For a
                  POST, PATCH or DELETE, reuse the same Idempotency-Key so the
                  request isn't processed twice. If it keeps failing, contact
                  Lead with the Lead-Request-ID.
            service_unavailable:
              summary: 503 service_unavailable
              value:
                code: service_unavailable
                message: >-
                  A system this request depends on is temporarily unavailable.
                  Retry with exponential backoff.
            endpoint_disabled:
              summary: 503 endpoint_disabled
              value:
                code: endpoint_disabled
                message: >-
                  This endpoint is temporarily disabled. Retry after the time in
                  the Retry-After header.
            gateway_timeout:
              summary: 504 gateway_timeout
              value:
                code: gateway_timeout
                message: >-
                  A system this request depends on didn't respond in time. Retry
                  with exponential backoff. For a POST, PATCH or DELETE, reuse
                  the same Idempotency-Key so the request isn't processed twice.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````