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

# Delete a Counterparty

> Delete a Counterparty (soft delete). Returns 409 when the counterparty
still owns active or pending External Accounts.



## OpenAPI

````yaml /api-reference/openapi.yaml delete /counterparties/{counterpartyId}
openapi: 3.0.3
info:
  title: Polygon OMS Public API
  version: v26.05.28-0001
  description: >-
    Unified API for moving money between crypto and fiat. Three ways to move
    money: Transactions (instant, wallet or card funded, including Cash-In for
    in-person cash deposits), Deposit Addresses (reusable crypto deposit
    configurations), and Virtual Accounts (dedicated bank accounts that
    auto-convert fiat to crypto). Standard transactions follow a two-step flow:
    create a Quote (pricing), then create a Transaction (execution). Cash-in
    codes generate a one-time deposit code for in-person cash deposits at retail
    locations.
  contact:
    name: Polygon OMS
    url: https://oms.polygon.technology
servers:
  - url: https://sandbox-api.polygon.technology/v0.12
    description: Sandbox
  - url: https://api.polygon.technology/v0.12
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Auth
    description: Authentication via FrontEgg
  - name: Customers
    description: Customer management and KYC
  - name: Customer
  - name: Wallet
  - name: Quote
  - name: Transaction
  - name: CashIns
  - name: CashLocation
  - name: Sandbox
  - name: VirtualAccount
  - name: Counterparty
  - name: ExternalAccount
  - name: Reference
  - name: DepositAddress
paths:
  /counterparties/{counterpartyId}:
    delete:
      tags:
        - Counterparty
      summary: Delete a Counterparty
      description: |-
        Delete a Counterparty (soft delete). Returns 409 when the counterparty
        still owns active or pending External Accounts.
      operationId: deleteCounterparty
      parameters:
        - name: counterpartyId
          in: path
          required: true
          description: Counterparty ID (`ctp_` prefix).
          schema:
            type: string
      responses:
        '204':
          description: >-
            There is no content to send for this request, but the headers may be
            useful. 
        '409':
          description: The request conflicts with the current state of the server.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/CounterpartyHasActiveExternalAccountsErrorBody
components:
  schemas:
    CounterpartyHasActiveExternalAccountsErrorBody:
      type: object
      required:
        - error
        - code
      properties:
        error:
          type: string
          enum:
            - counterparty still owns active or pending external accounts
          description: Human-readable error identifier.
        code:
          type: string
          enum:
            - counterpartyHasActiveExternalAccounts
          description: Machine-readable code.
        details:
          type: object
          properties:
            counterpartyId:
              allOf:
                - $ref: '#/components/schemas/typeId'
              description: >-
                The counterparty (ctp_…) that still owns active/pending External
                Accounts.
            activeExternalAccountIds:
              type: array
              items:
                $ref: '#/components/schemas/typeId'
              description: Public ids (ext_…) of the External Accounts blocking the delete.
          required:
            - counterpartyId
            - activeExternalAccountIds
          description: >-
            Structured detail identifying the blocking External Accounts and
            their counterparty.
      description: >-
        409 body returned by DELETE /counterparties/{id} when the counterparty
        still

        owns active or pending External Accounts.
        `details.activeExternalAccountIds`

        lists the blocking accounts (which must be deleted before the
        counterparty can

        be removed) and `details.counterpartyId` echoes the affected
        counterparty.
      example:
        error: counterparty still owns active or pending external accounts
        code: counterpartyHasActiveExternalAccounts
        details:
          counterpartyId: ctp_yp5z8m7n22svc0vh6edqgcfdat
          activeExternalAccountIds:
            - ext_fky491gakzj0dd46qb6whsr2vq
            - ext_95863ktcdhw27ze8hxgybb24n9
    typeId:
      type: string
      pattern: >-
        ^[a-z]+_([0-9a-hjkmnp-tv-z]{26}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$
      description: >-
        Public TypeID, e.g. `txn_01h455vb4pex5vsknk084sn02q`; legacy UUID
        suffixes are accepted until non-v7 rows are retired.
      x-go-type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Token from POST /auth/token

````