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

# Cancel an Instant Payment

> Attempt to cancel an outgoing instant payment that is currently in "created" or "under_review"
status.



## OpenAPI

````yaml POST /v1/instant_payments/{instant_payment_id}/cancel
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: Account Number
  - name: OAuth
  - name: Events
  - name: Instant Payments
  - name: Lending
  - name: Simulation
  - name: Internal Transfer
  - name: Disbursement
  - name: Entity
  - name: Wire
  - name: Originator
  - name: Funding
  - name: Balances
  - name: Compliance
  - name: UserAccount
  - name: Blockchain Payment
paths:
  /v1/instant_payments/{instant_payment_id}/cancel:
    post:
      tags:
        - Instant Payments
      summary: Cancel an instant payment
      description: >-
        Attempt to cancel an outgoing instant payment that is currently in
        "created" or "under_review"

        status.
      operationId: cancel-an-instant-payment
      parameters:
        - name: instant_payment_id
          description: ID of the instant payment object you want to cancel.
          example: instant_payment_xyz001
          in: path
          required: true
          schema:
            type: string
            pattern: ^instant_payment_\w+$
      responses:
        '200':
          description: Updated canceled instant payment object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstantPayment'
        '400':
          description: Operation cannot be done on this object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '404':
          description: Instant payment not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '422':
          description: >-
            The instant payment has already been submitted and cannot be
            canceled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '500':
          description: Server error. Please try your request again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
components:
  schemas:
    InstantPayment:
      type: object
      required:
        - id
        - account_id
        - account_number_id
        - created_at
        - updated_at
        - direction
        - status
        - amount
        - currency_code
        - related_objects
        - return_requests
        - creditor
        - creditor_agent
        - debtor
        - debtor_agent
        - payment_identifiers
      properties:
        id:
          type: string
          description: The unique identifier of the instant payment object.
          example: instant_payment_xyz123
          pattern: ^instant_payment_\w+$
        account_id:
          $ref: '#/components/schemas/AccountID'
        account_number_id:
          $ref: '#/components/schemas/AccountNumberID'
        direction:
          $ref: '#/components/schemas/Direction'
        status:
          $ref: '#/components/schemas/InstantPaymentStatus'
        counterparty_status:
          $ref: '#/components/schemas/InstantPaymentCounterpartyStatus'
        amount:
          $ref: '#/components/schemas/InstantPaymentAmount'
        currency_code:
          $ref: '#/components/schemas/CurrencyCode'
        description:
          type: string
          description: Free-form information on the reason for the payment.
          example: Payment for invoice 12345
        debtor:
          $ref: '#/components/schemas/InstantPaymentParty'
          description: The details of the debtor (payer) sending the funds.
        debtor_agent:
          $ref: '#/components/schemas/InstantPaymentAgent'
          description: >-
            The details of the financial institution where the debtor (payer)
            holds their account.
        creditor_agent:
          $ref: '#/components/schemas/InstantPaymentAgent'
          description: >-
            The details of the financial institution where the creditor (payee)
            holds their account.
        creditor:
          $ref: '#/components/schemas/InstantPaymentParty'
          description: The details of the creditor (payee) receiving the funds.
        payment_identifiers:
          $ref: '#/components/schemas/InstantPaymentIdentifiers'
        return:
          $ref: '#/components/schemas/InstantPaymentReturnDetails'
        rejection:
          $ref: '#/components/schemas/InstantPaymentRejection'
        related_objects:
          $ref: '#/components/schemas/InstantPaymentRelatedObjects'
        return_requests:
          type: array
          description: The return requests that reference this instant payment.
          items:
            $ref: '#/components/schemas/InstantPaymentReturnRequest'
        created_at:
          type: string
          format: date-time
          description: >-
            The ISO 8601 format timestamp that represents when the instant
            payment object was created.
          example: '2022-06-27T11:22:33Z'
        updated_at:
          type: string
          format: date-time
          description: >-
            The ISO 8601 format timestamp that represents when the instant
            payment object was last updated.
          example: '2022-06-27T11:22:40Z'
    APIError:
      type: object
      properties:
        code:
          type: string
          description: The error code.
        title:
          type: string
          description: The error title.
        detail:
          type: string
          description: A detailed error description.
        status:
          type: string
          description: The HTTP status code.
        invalid_parameters:
          type: array
          description: Invalid request parameters with reasons, if applicable.
          items:
            $ref: '#/components/schemas/InvalidParameterDetail'
        instance:
          type: string
          description: >-
            The object causing this specific occurrence of the error, if
            applicable.
    AccountID:
      type: string
      description: The ID of the Account object.
      example: account_xyz123
      pattern: ^account_\w+$
    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
    InstantPaymentStatus:
      description: |-
        The current status of the instant payment object.
        If outgoing: created, under_review, canceled, rejected, posted.
        If incoming: under_review, rejected, posted.
      type: string
      example: posted
      enum:
        - created
        - under_review
        - canceled
        - rejected
        - posted
    InstantPaymentCounterpartyStatus:
      description: >-
        The current status of the instant payment from the counterparty's
        perspective.

        If outgoing: posted, under_review, or rejected.

        If incoming: posted or null.
      type: string
      example: posted
      nullable: true
      enum:
        - posted
        - under_review
        - rejected
    InstantPaymentAmount:
      description: The amount of the instant payment in cents.
      type: integer
      format: int64
      example: 5000
      minimum: 0
    CurrencyCode:
      description: A three-letter currency code as defined in ISO 4217.
      type: string
      example: USD
      enum:
        - USD
    InstantPaymentParty:
      type: object
      description: Details of a party in an instant payment.
      required:
        - name
        - account_number
      properties:
        name:
          type: string
          description: The party's name.
          minLength: 3
          maxLength: 35
          example: Alex Smith
        account_number:
          type: string
          description: The party's account number.
          minLength: 1
          maxLength: 17
          example: '1234567890'
    InstantPaymentAgent:
      type: object
      description: Details of a financial institution in an instant payment.
      required:
        - routing_number
      properties:
        routing_number:
          type: string
          description: The party's routing number.
          minLength: 9
          maxLength: 9
          pattern: ^[0-9]+$
          example: '111000111'
    InstantPaymentIdentifiers:
      type: object
      description: The instant payment's identifiers.
      properties:
        end_to_end_id:
          type: string
          description: >-
            The identifier assigned by the party initiating the instant payment
            to be delivered to the customer unchanged.
          maxLength: 35
          example: 033me5upSkktRorr3J6TKZ
        uetr:
          type: string
          description: >-
            Unique End-to-End Transaction Reference (UETR). Must be an IETF RFC
            4122 UUID.
          format: uuid
          example: 8dc981d2-e8c2-4a7b-8df0-0781b46328d9
        transaction_id:
          type: string
          description: >-
            The identifier assigned by the initiating party or debtor to
            uniquely identify the transaction.
          maxLength: 35
          example: 3G0CQxK8gKLpzaaxc7A9spDiifK
    InstantPaymentReturnDetails:
      type: object
      description: >-
        If this instant payment is a return, this object contains details on the
        return.
      required:
        - reason
      properties:
        reason:
          $ref: '#/components/schemas/IncomingInstantPaymentReturnReason'
        details:
          type: string
          description: >-
            Details of the reason for the return including the 4-character ISO
            code when possible.
    InstantPaymentRejection:
      type: object
      description: >-
        If this instant payment was rejected, this object contains details on
        the rejection.
      required:
        - rejected_by
        - reason
      properties:
        rejected_by:
          type: string
          description: The party that rejected the instant payment.
          enum:
            - lead
            - network
            - counterparty
          example: lead
        reason:
          $ref: '#/components/schemas/InstantPaymentRejectionReason'
        details:
          type: string
          description: >-
            Details of the reason for the rejection including the 4-character
            ISO code when possible.
    InstantPaymentRelatedObjects:
      type: object
      description: This instant payment's related instant payments or other objects.
      properties:
        original_payment_id:
          type: string
          description: >-
            If this instant payment is a return, the ID of the original payment
            this return is in reference to.
          pattern: ^instant_payment_\w+$
          example: instant_payment_xyz123
        return_payment_ids:
          type: array
          description: >-
            If this instant payment was subsequently returned, the IDs of the
            payment returns.
          items:
            type: string
            pattern: ^instant_payment_\w+$
            example: instant_payment_xyz456
    InstantPaymentReturnRequest:
      type: object
      description: A return request associated with an instant payment.
      required:
        - created_at
        - status
        - reason
      properties:
        status:
          $ref: '#/components/schemas/InstantPaymentReturnRequestStatus'
        reason:
          $ref: '#/components/schemas/IncomingInstantPaymentReturnRequestReason'
        details:
          type: string
          description: >-
            Details of the reason for the return request including the
            4-character ISO code when possible.
        deadline:
          type: string
          format: date-time
          description: >-
            The deadline by which a final response to the return request is
            expected.

            For incoming return requests, you must respond by 11:30PM ET on the
            10th business day. If you do not respond, we will respond on your
            behalf with a rejection at midnight.

            For outgoing return requests, the network deadline for the
            counterparty is 12:00AM ET on the 10th business day.
          example: '2022-07-11T23:30:00-04:00'
        resolution:
          $ref: '#/components/schemas/InstantPaymentReturnRequestResolution'
        created_at:
          type: string
          format: date-time
          description: >-
            The ISO 8601 format timestamp that represents when the return
            request object was created.
          example: '2022-06-27T11:22:33Z'
    InvalidParameterDetail:
      type: object
      properties:
        parameter:
          type: string
          description: Which parameter is invalid.
          example: transaction_type
        reason:
          type: string
          description: Why the parameter is invalid.
    IncomingInstantPaymentReturnReason:
      type: string
      description: |-
        The reason for a return.
        * `honor_return_request` - Honoring a return request
        * `wrong_amount` - Wrong amount
        * `duplication` - Duplicate payment
        * `initiating_party_unrecognized` - Unknown sender
        * `fraud_suspected` - Fraud suspected
        * `undue_payment` - Unduly paid
        * `narrative` - Narrative reason, additional_information required
        * `customer_requested` - Requested by customer
        * `regulatory_reason` - Regulatory reason
        * `amount_too_low` - Amount too low
        * `other` - Other
      example: duplication
      enum:
        - honor_return_request
        - wrong_amount
        - duplication
        - initiating_party_unrecognized
        - fraud_suspected
        - undue_payment
        - narrative
        - customer_requested
        - regulatory_reason
        - amount_too_low
        - other
    InstantPaymentRejectionReason:
      type: string
      description: >-
        The reason for the rejection.

        * `account_closed` - Closed creditor account

        * `creditor_account_number_invalid` - Invalid creditor account number

        * `account_blocked` - Blocked account

        * `wrong_amount` - Wrong amount

        * `creditor_name_mismatch` - Inconsistent end customer

        * `creditor_address_incorrect` - Missing or incorrect creditor address

        * `creditor_identification_invalid` - Invalid creditor identification

        * `duplication` - Duplicate

        * `regulatory_reason` - Regulatory

        * `narrative` - Narrative

        * `account_number_incorrect` - Account number incorrect or not active

        * `non_sufficient_funds` - Non-sufficient funds

        * `aggregate_limit_exceeded` - Aggregate limit exceeded

        * `participant_not_on_network` - Participant is not on an instant
        payment network

        * `routing_number_format_incorrect` - Routing number format is incorrect

        * `participant_signed_off` - Participant signed off

        * `restricted_by_account_number_controls` - Restricted by account number
        controls

        * `other` - Other
      example: non_sufficient_funds
      enum:
        - account_closed
        - creditor_account_number_invalid
        - account_blocked
        - wrong_amount
        - creditor_name_mismatch
        - creditor_address_incorrect
        - creditor_identification_invalid
        - duplication
        - regulatory_reason
        - narrative
        - account_number_incorrect
        - non_sufficient_funds
        - aggregate_limit_exceeded
        - participant_not_on_network
        - routing_number_format_incorrect
        - participant_signed_off
        - restricted_by_account_number_controls
        - other
    InstantPaymentReturnRequestStatus:
      type: string
      description: |-
        The current status of the return request object.
        For incoming return requests: response_needed, accepted, rejected.
        For outgoing return requests: pending, accepted, rejected.
      example: pending
      enum:
        - pending
        - response_needed
        - accepted
        - rejected
    IncomingInstantPaymentReturnRequestReason:
      type: string
      description: |-
        The reason for the return request.
        * `creditor_account_number_invalid` - Invalid creditor account number
        * `wrong_amount` - Wrong amount
        * `customer_requested` - Requested by customer
        * `duplication` - Duplicate payment
        * `fraud_suspected` - Fraud suspected
        * `narrative` - Narrative reason, additional_information required
        * `service_not_rendered` - Service not rendered
        * `technical_problem` - Technical problem
        * `undue_payment` - Unduly paid
        * `per_agent_request` - Requested by agent
        * `other` - Other
      example: duplicate
      enum:
        - creditor_account_number_invalid
        - wrong_amount
        - customer_requested
        - duplication
        - fraud_suspected
        - narrative
        - service_not_rendered
        - technical_problem
        - undue_payment
        - per_agent_request
        - other
    InstantPaymentReturnRequestResolution:
      type: object
      description: The resolution details of the return request.
      required:
        - resolved_at
        - resolved_by
      properties:
        resolved_at:
          type: string
          format: date-time
          description: >-
            The ISO 8601 format timestamp that represents when the resolution
            occurred.
          example: '2022-06-27T11:22:33Z'
        resolved_by:
          type: string
          description: The party that resolved the return request.
          enum:
            - client
            - lead
            - network
            - counterparty
          example: counterparty
        rejection_reason:
          $ref: >-
            #/components/schemas/IncomingInstantPaymentReturnRequestRejectionReason
          description: If the return request was rejected, the reason for the rejection.
        rejection_details:
          type: string
          description: >-
            If the return request was rejected, details of the rejection reason
            including the 4-character ISO code when possible.
    IncomingInstantPaymentReturnRequestRejectionReason:
      type: string
      description: |-
        The reason for a rejected return request.
        * `account_closed` - Account closed
        * `non_sufficient_funds` - Insufficient funds
        * `customer_requested` - Customer decision
        * `legal_decision` - Legal decision
        * `customer_no_response` - No answer from customer
        * `returned_previously` - Already returned
        * `narrative` - Narrative reason, additional_information required
        * `per_agent_request` - Agent decision
        * `other` - Other
      example: customer_no_response
      enum:
        - account_closed
        - non_sufficient_funds
        - customer_requested
        - legal_decision
        - customer_no_response
        - returned_previously
        - narrative
        - per_agent_request
        - other
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````