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

# Close an Account

> Transitions an account to `closed` status (terminal state).
This action cannot be undone.

## Idempotency
The Idempotency-Key header is required.




## OpenAPI

````yaml POST /v0/accounts/{id}/close
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:
  /v0/accounts/{id}/close:
    post:
      tags:
        - Compliance
      summary: Close an account
      description: |
        Transitions an account to `closed` status (terminal state).
        This action cannot be undone.

        ## Idempotency
        The Idempotency-Key header is required.
      operationId: close-an-account
      parameters:
        - name: id
          in: path
          required: true
          description: Account ID
          schema:
            $ref: '#/components/schemas/AccountID'
        - name: Idempotency-Key
          in: header
          required: true
          description: Unique key to ensure idempotent requests
          schema:
            type: string
            maxLength: 255
          example: acct-close-12345-abc
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccountCloseRequest'
            examples:
              close_with_reason:
                summary: Close with reason
                value:
                  status_reason: client_closed
      responses:
        '200':
          description: Account closed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
        '400':
          description: Malformed request or missing required header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '401':
          description: Valid access token was not used to call the API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '403':
          description: Valid access token lacks the proper scopes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '404':
          description: Account ID passed in is not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '422':
          description: Invalid status transition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              example:
                code: invalid_status_transition
                title: Invalid status transition.
                detail: Account cannot be closed from current status.
                invalid_parameters: []
        '429':
          description: Rate limit exceeded.
          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:
    AccountID:
      type: string
      description: The ID of the Account object.
      example: account_xyz123
      pattern: ^account_\w+$
    AccountCloseRequest:
      type: object
      description: Request body for closing an account
      properties:
        status_reason:
          $ref: '#/components/schemas/AccountCloseStatusReason'
      required:
        - status_reason
    Account:
      type: object
      description: An account object
      readOnly: true
      properties:
        id:
          $ref: '#/components/schemas/AccountID'
        created_at:
          type: string
          format: date-time
          description: Creation timestamp
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
          readOnly: true
        application_id:
          $ref: '#/components/schemas/ApplicationID'
        status:
          $ref: '#/components/schemas/AccountStatus'
        status_reason:
          $ref: '#/components/schemas/AccountStatusReason'
        capabilities:
          type: array
          description: List of items that inform Lead how the Account will be used
          items:
            $ref: '#/components/schemas/AccountCapability'
        entities:
          $ref: '#/components/schemas/AccountEntities'
        details:
          $ref: '#/components/schemas/AccountDetails'
        metadata:
          $ref: '#/components/schemas/Metadata'
        documents:
          type: array
          description: Array of associated legal or informational documents
          items:
            $ref: '#/components/schemas/ComplianceDocument'
        client_account_id:
          type: string
          readOnly: true
          description: >
            Client-provided identifier for the account. Optional: present only
            for

            accounts created via file upload, and omitted for accounts created
            through

            the API, which are identified solely by their server-generated ID.
    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.
    AccountCloseStatusReason:
      type: string
      description: Valid reasons for closing an account
      enum:
        - entity_closed
        - client_closed
        - paid_off
        - charged_off
        - canceled
    ApplicationID:
      type: string
      description: Unique identifier for the application. Prefixed with `application_`.
      example: application_xyz123
      pattern: ^application_\w+$
    AccountStatus:
      type: string
      description: Current state of the account
      enum:
        - active
        - inactive
        - closed
    AccountStatusReason:
      type: string
      description: Machine-readable reason for the current status
      enum:
        - client_closed
        - entity_closed
        - frozen
        - dormant
        - active
        - paid_off
        - charged_off
        - canceled
        - other
    AccountCapability:
      type: string
      description: Capability that informs Lead how the Account will be used
      enum:
        - deposit
        - credit_with_underwriting
        - credit_without_underwriting
    AccountEntities:
      type: object
      readOnly: true
      description: Entity relationships associated with the account (response only)
      properties:
        account_holder_type:
          type: string
          description: Derived from the type of the entity referenced in account_holders
          enum:
            - consumer
            - commercial
    AccountDetails:
      type: object
      description: Core details of the account
      readOnly: true
      properties:
        product_name:
          type: string
          description: Partner's name for their product
        closed_at:
          type: string
          format: date-time
          description: Timestamp when the account was closed. Updated by /close endpoint.
          readOnly: true
        credit:
          $ref: '#/components/schemas/AccountCredit'
        adverse_action_notice:
          $ref: '#/components/schemas/AdverseActionNotice'
    Metadata:
      type: object
      additionalProperties:
        type: string
      description: >-
        A set of key-value pairs that can be used to store additional
        information related to this object.
    ComplianceDocument:
      type: object
      description: >-
        Document reference associated with an application (response schema - all
        fields optional)
      readOnly: true
      properties:
        document_id:
          type: string
          description: >-
            Unique identifier for the document being referenced. Please use the
            file name of the file delivered to Lead's `/documents` SFTP
            directory.
          example: document_2N5Hk8xYmQpL9rBvC3jD
        type:
          $ref: '#/components/schemas/ComplianceDocumentType'
        displayed_at:
          type: string
          format: date-time
          description: >-
            ISO 8601 timestamp when the document was displayed to the applicant.
            Present on disclosure documents.
        consented_at:
          type: string
          format: date-time
          description: >-
            ISO 8601 timestamp when the applicant consented to the document.
            Present on consent documents.
        version:
          type: string
          description: >-
            It is recommended to use this for static documents uploaded once and
            uploaded for many users. Uploads with a new version should have a
            different document_id as well.
          example: v1
    InvalidParameterDetail:
      type: object
      properties:
        parameter:
          type: string
          description: Which parameter is invalid.
          example: transaction_type
        reason:
          type: string
          description: Why the parameter is invalid.
    AccountCredit:
      type: object
      description: Details specific to credit-based accounts
      additionalProperties: false
      properties:
        is_secured:
          type: boolean
          description: Indicates if this is a secured credit/deposit product
        is_mla:
          type: boolean
          description: >-
            Indicates if this account is considered a Military Lending Act
            account
        underwriting_grade:
          type: string
          description: Grade given to the customer based on underwriting
        currency:
          type: string
          description: The currency for the account (3-letter ISO code)
          example: USD
        available_credit:
          type: integer
          description: Available credit for the customer to draw (in minor units)
        limit:
          type: integer
          description: Current credit limit (in minor units)
        max_limit:
          type: integer
          description: Maximum credit limit approved in underwriting (in minor units)
        scra:
          $ref: '#/components/schemas/Scra'
        report:
          $ref: '#/components/schemas/CreditReport'
    AdverseActionNotice:
      type: object
      description: Adverse action notice information
      properties:
        delivered_at:
          type: string
          format: date-time
          description: >-
            ISO 8601 timestamp when the adverse action notice was sent to the
            applicant.
        reason:
          type: string
          description: The reason stated in the adverse action notice.
        delivery_method:
          type: string
          description: >-
            How the notice was delivered to the applicant. Possible values:
            `email`, `text`, `other`.
          enum:
            - email
            - text
            - other
      required:
        - delivered_at
        - reason
        - delivery_method
    ComplianceDocumentType:
      type: string
      description: Type of document associated with an application
      enum:
        - aan
        - loan_agreement
        - loc_agreement
        - truth_in_lending_document
        - ach_authorization
        - notice_of_incompleteness
        - credit_score_notice
        - offer_summary
        - personal_guarantee
        - consumer_credit_auth
        - partner_privacy_policy
        - lead_privacy_policy
        - terms_of_use
        - esign_agreement
        - credit_pull_consent
        - fcra_notice
        - tcpa_consent
        - patriot_act_notice
        - mla_notice
        - pre_approval_terms
        - eft_authorization
        - prohibited_industry_certification
        - decision_maker_document
        - bo_certification
        - missed_payments_policy
        - consent_to_link_account
        - consent_to_link_hsa
        - negative_option_consent
        - lead_funds_transfer_agreement
    Scra:
      type: object
      description: SCRA (Servicemembers Civil Relief Act) details
      properties:
        start_date:
          type: string
          format: date
          description: Start date for SCRA protections
        end_date:
          type: string
          format: date
          description: End date for SCRA protections
      required:
        - start_date
    CreditReport:
      type: object
      description: >
        Credit report information. Exactly one of `score` or `non_score_value`
        must be provided; `pulled_at` and `source` are always required when a
        credit report is supplied.
      required:
        - pulled_at
        - source
      properties:
        score:
          type: integer
          description: >-
            Credit score returned by the bureau. Supported range is 300-850.
            Mutually exclusive with `non_score_value`.
          minimum: 300
          maximum: 850
        non_score_value:
          type: string
          description: >-
            Indicates the state of a credit file when a numeric score is not
            available. Mutually exclusive with `score`.
          enum:
            - unestablished
            - frozen
        pulled_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp when the credit report was pulled.
        source:
          type: string
          description: >-
            Credit bureau that issued the report. Possible values: `equifax`,
            `experian`, `transunion`.
          enum:
            - equifax
            - transunion
            - experian
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````