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

# Delete Clients

> Soft-deletes clients by your firm's client identifiers. Submit 1 to 10,000 identifiers per request. Each identifier receives one result in deleted, already_absent, or errors. Inspect errors even when the response is HTTP 200. Missing and already-deleted clients appear in already_absent. A client that still has a matter that is not deleted fails with client_has_matters. Delete its matters with DELETE /api/v2/matters first. This endpoint does not change matters.



## OpenAPI

````yaml /client_matters_api.json delete /api/v2/clients
openapi: 3.0.1
info:
  title: Harvey Client Matter API
  description: >-
    Create and update clients and matters by your firm identifiers, and delete
    them by the same identifiers. List client matters through the v1 endpoint.
  version: 1.0.0
  contact:
    email: support@harvey.ai
servers:
  - url: https://api.harvey.ai
    description: Harvey API server
security: []
paths:
  /api/v2/clients:
    delete:
      tags:
        - Delete
      summary: Delete Clients
      description: >-
        Soft-deletes clients by your firm's client identifiers. Submit 1 to
        10,000 identifiers per request. Each identifier receives one result in
        deleted, already_absent, or errors. Inspect errors even when the
        response is HTTP 200. Missing and already-deleted clients appear in
        already_absent. A client that still has a matter that is not deleted
        fails with client_has_matters. Delete its matters with DELETE
        /api/v2/matters first. This endpoint does not change matters.
      operationId: deleteClients
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteClientsRequest'
            example:
              client_ids:
                - '10022421'
                - '10022422'
      responses:
        '200':
          description: Per-identifier results for the submitted clients.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteClientsResponse'
              examples:
                deleted:
                  summary: Deleted client
                  value:
                    deleted:
                      - client_id: '10022421'
                    already_absent: []
                    errors: []
                alreadyAbsent:
                  summary: >-
                    Missing or already-deleted client, including a repeated
                    request
                  value:
                    deleted: []
                    already_absent:
                      - client_id: '10022421'
                    errors: []
                partialSuccess:
                  summary: Valid identifier succeeds while other identifiers fail
                  value:
                    deleted:
                      - client_id: '10022421'
                    already_absent: []
                    errors:
                      - client_id: '10022422'
                        error: client_has_matters
                        detail: >-
                          Delete the client’s active matters before deleting the
                          client
                      - client_id: ' 10022421 '
                        error: duplicate_client_id
                        detail: This client identifier appears earlier in the batch
                      - client_id: ' '
                        error: invalid_client_id
                        detail: Client identifier must not be empty
        '400':
          description: >-
            The request was rejected as a whole and no clients were deleted:
            invalid_request, or too_many_items for more than 10,000 client
            identifiers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientMatterBatchError'
              examples:
                invalidRequest:
                  summary: Unknown field in the request body
                  value:
                    error: invalid_request
                    detail: Invalid request body
                    validation_errors:
                      - loc:
                          - cascade
                        type: extra_forbidden
                tooManyItems:
                  summary: More than 10,000 client identifiers
                  value:
                    error: too_many_items
                    detail: Too many items in one request
        '401':
          description: >-
            Missing, invalid, or expired API token, or missing
            write:client_matters permission.
        '403':
          description: Forbidden.
        '429':
          description: >-
            Rate limit exceeded. These endpoints share the client matter rate
            limit, which defaults to 150 requests per minute per workspace.
        '500':
          description: Internal server error.
      security:
        - bearerAuth: []
components:
  schemas:
    DeleteClientsRequest:
      type: object
      description: >-
        Submit the client_id values to delete. Unknown fields return HTTP 400
        with invalid_request.
      required:
        - client_ids
      properties:
        client_ids:
          type: array
          minItems: 1
          maxItems: 10000
          items:
            type: string
          description: >-
            The firm's client identifiers, the client_id values used in v2
            upserts. Not client labels or Harvey client UUIDs. Surrounding
            whitespace is trimmed.
      additionalProperties: false
    DeleteClientsResponse:
      type: object
      description: >-
        Every identifier in the request has one result. Within each array,
        results keep the order of the request.
      required:
        - deleted
        - already_absent
        - errors
      properties:
        deleted:
          type: array
          description: Clients deleted by this request.
          items:
            $ref: '#/components/schemas/DeletedClient'
        already_absent:
          type: array
          description: >-
            Missing or already-deleted clients. These are successful results. A
            repeated request returns a deleted client here.
          items:
            $ref: '#/components/schemas/DeletedClient'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/DeleteClientError'
    ClientMatterBatchError:
      type: object
      description: Body of a 400 response from `/api/v2/clients` and `/api/v2/matters`.
      required:
        - error
        - detail
      properties:
        error:
          $ref: '#/components/schemas/ClientMatterBatchErrorCode'
        detail:
          type: string
          description: Human-readable explanation.
        validation_errors:
          type: array
          description: Present for `invalid_request`. Field values are never echoed.
          items:
            $ref: '#/components/schemas/ClientMatterFieldError'
    DeletedClient:
      type: object
      required:
        - client_id
      properties:
        client_id:
          type: string
          description: client_id after trimming surrounding whitespace.
    DeleteClientError:
      type: object
      required:
        - client_id
        - error
        - detail
      properties:
        client_id:
          type: string
          description: Echoes the raw request value.
        error:
          $ref: '#/components/schemas/DeleteClientErrorCode'
        detail:
          type: string
          description: Human-readable explanation.
    ClientMatterBatchErrorCode:
      type: string
      description: >-
        Stable code for a rejected request. too_many_items: more than 10,000
        rows. invalid_request: invalid request shape, empty batch, missing
        required field, wrong type, allowed set to null, or a token user that
        cannot be found. delimiter_required: POST /api/v2/matters requires an
        explicit delimiter for the active workspace, but none is configured.
        Other workspaces use `.` when no delimiter is configured. POST
        /api/v2/clients, DELETE /api/v2/clients, and DELETE /api/v2/matters do
        not emit delimiter_required. Duplicate identifiers and length limits on
        text fields produce per-row errors instead.
      enum:
        - too_many_items
        - invalid_request
        - delimiter_required
    ClientMatterFieldError:
      type: object
      required:
        - loc
        - type
      properties:
        loc:
          type: array
          description: >-
            Path to the offending field. Each entry is a string naming a field
            or an integer indexing an array.
          items: {}
        type:
          type: string
          description: The validation failure kind, for example `missing` or `string_type`.
    DeleteClientErrorCode:
      type: string
      description: >-
        Stable code for a client that was not deleted. invalid_client_id means
        the identifier is empty after trimming. duplicate_client_id means the
        identifier repeats an earlier identifier in the batch after trimming.
        client_has_matters means the client has at least one matter that is not
        deleted. Delete those matters with DELETE /api/v2/matters first. Each
        failed identifier reports one error.
      enum:
        - invalid_client_id
        - duplicate_client_id
        - client_has_matters
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Token

````

## Related topics

- [Client Matters](https://developers.harvey.ai/guides/client_matters.md)
- [Delete Client Matters](https://developers.harvey.ai/api-reference/delete/delete-client-matters.md)
- [Audit Logs](https://developers.harvey.ai/guides/audit_logs.md)


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