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

# Reverse a payment your organization posted

> Reverses a payment posted through this API. Requires an `Idempotency-Key` header; replaying the same key and body returns the original response. Returns 201 when reversed and 202 when the outcome is still being confirmed (`reversal_pending`).



## OpenAPI

````yaml /api-reference/external_api.openapi.json post /v1/payments/{payment_id}/reversal
openapi: 3.1.0
info:
  title: Monterey Client API
  description: >-
    Org-scoped, token-authenticated account, borrower, and payment endpoints for
    Monterey Financial clients.
  version: 1.0.0
servers:
  - url: https://api.montereyfinancial.app
    description: Production
security:
  - BearerToken: []
tags:
  - name: Authentication
    description: Exchange API keys for access tokens.
  - name: Organizations
    description: Organizations visible to the API key.
  - name: Persons
    description: Borrowers visible through in-scope accounts.
  - name: Accounts
    description: Servicing accounts and identifier lookups.
  - name: Transactions
    description: Account money-movement history.
  - name: Payment Methods
    description: Stored payment instruments.
  - name: Autopay
    description: Recurring payment schedules.
paths:
  /v1/payments/{payment_id}/reversal:
    post:
      tags:
        - External Payments
      summary: Reverse a payment your organization posted
      description: >-
        Reverses a payment posted through this API. Requires an
        `Idempotency-Key` header; replaying the same key and body returns the
        original response. Returns 201 when reversed and 202 when the outcome is
        still being confirmed (`reversal_pending`).
      operationId: reverse_external_payment_v1_payments__payment_id__reversal_post
      parameters:
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
            title: Payment Id
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 255
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExternalPaymentReversalCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalPaymentOut'
        '202':
          description: Outcome not yet confirmed (`reversal_pending`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalPaymentOut'
        '401':
          description: Missing or invalid access token.
        '403':
          description: Authenticated token lacks the required scope (`insufficient_scope`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Account or payment not in scope or does not exist.
        '409':
          description: >-
            `payment_not_reversible` (only `posted` payments can be reversed),
            `idempotency_conflict` or `idempotency_in_progress`.
        '422':
          description: Invalid request or a rejected reversal (`omega_rejected`).
        '503':
          description: Payment reversal is temporarily unavailable.
      security:
        - BearerToken: []
components:
  schemas:
    ExternalPaymentReversalCreate:
      properties:
        reason:
          type: string
          maxLength: 200
          minLength: 1
          title: Reason
          description: Why the payment is reversed.
        is_nsf:
          type: boolean
          title: Is Nsf
          description: Reverse as NSF (returned funds).
          default: false
      additionalProperties: false
      type: object
      required:
        - reason
      title: ExternalPaymentReversalCreate
      description: Request body for reversing a payment your organization posted.
    ExternalPaymentOut:
      properties:
        payment_id:
          type: string
          title: Payment Id
          description: Monterey payment ID.
        account_id:
          type: string
          title: Account Id
          description: The account the payment was posted to.
        amount_cents:
          type: integer
          title: Amount Cents
          description: Payment amount, in integer cents.
        payment_method:
          type: string
          title: Payment Method
          description: How the payment was collected.
        check_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Check Number
          description: Check number, when applicable.
        status:
          type: string
          title: Status
          description: >-
            `pending`, `posted`, `pending_confirmation`, `reversal_pending`,
            `reversed` or `failed`.
        effective_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Effective Date
          description: Date the payment applies.
        external_reference:
          anyOf:
            - type: string
            - type: 'null'
          title: External Reference
          description: Your own reference.
        memo:
          anyOf:
            - type: string
            - type: 'null'
          title: Memo
          description: Free-text note.
        reference_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reference Number
          description: Reference number of the posted payment.
        posted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Posted At
          description: When it was posted.
        reversal:
          anyOf:
            - $ref: '#/components/schemas/ReversalOut'
            - type: 'null'
          description: Reversal details; null unless the payment was reversed.
      type: object
      required:
        - payment_id
        - account_id
        - amount_cents
        - payment_method
        - check_number
        - status
        - effective_date
        - external_reference
        - memo
        - reference_number
        - posted_at
        - reversal
      title: ExternalPaymentOut
      description: A payment an organization posted to one of its accounts.
    ErrorResponse:
      properties:
        detail:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Standard error envelope. Branch on `detail.error_code`.
    ReversalOut:
      properties:
        reversed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Reversed At
          description: When it was reversed.
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
          description: Reason given for the reversal.
        is_nsf:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Nsf
          description: Whether it was reversed as NSF.
        reference_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reference Number
          description: Reference number of the reversal.
        reversed_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Reversed By
          description: Who reversed the payment.
      type: object
      required:
        - reversed_at
        - reason
        - is_nsf
        - reference_number
        - reversed_by
      title: ReversalOut
      description: Reversal details of a payment that has been (or is being) reversed.
    ErrorBody:
      properties:
        error_code:
          type: string
          title: Error Code
      type: object
      required:
        - error_code
      title: ErrorBody
      description: Standard error body. Branch on `error_code`.
  securitySchemes:
    BearerToken:
      type: http
      description: Short-lived access token minted by POST /v1/oauth/token.
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.