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

# Add and remove clients in a client group

> This endpoint is available to Group API Keys only.

Adds clinic clients to and removes them from a client group in one request. Each list accepts at most 500 IDs.

Membership changes may also affect a client's promotions and pricing.

A **client group** is a named grouping of clinic clients (pet parents) within an organization. Clinics use client groups to decide who is eligible for promotions and pricing, to mark tax-exempt clients, and to filter and report on clients. A clinic client can belong to any number of client groups, and a client group can contain clients from any clinic in the organization.



## OpenAPI

````yaml patch /ext/v2/client-groups/{client_group_id}/clients/
openapi: 3.1.0
info:
  description: ''
  title: NinjaAPI
  version: 2.0.0
servers:
  - url: https://connect.vetcove.com/
security: []
paths:
  /ext/v2/client-groups/{client_group_id}/clients/:
    patch:
      tags:
        - Clients And Patients
      summary: Add and remove clients in a client group
      description: >-
        This endpoint is available to Group API Keys only.


        Adds clinic clients to and removes them from a client group in one
        request. Each list accepts at most 500 IDs.


        Membership changes may also affect a client's promotions and pricing.


        A **client group** is a named grouping of clinic clients (pet parents)
        within an organization. Clinics use client groups to decide who is
        eligible for promotions and pricing, to mark tax-exempt clients, and to
        filter and report on clients. A clinic client can belong to any number
        of client groups, and a client group can contain clients from any clinic
        in the organization.
      operationId: client_group_clients_patch
      parameters:
        - description: The ID of the client group.
          in: path
          name: client_group_id
          required: true
          schema:
            description: The ID of the client group.
            title: Client Group Id
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientGroupMembershipPatchSchema'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ExternalClientGroupMembershipPatchResponseSchema
          description: OK
      security:
        - ExternalAPIAuth: []
components:
  schemas:
    ClientGroupMembershipPatchSchema:
      properties:
        clients_to_add:
          description: IDs of clinic clients to add to the client group. At most 500 IDs.
          items:
            type: integer
          maxItems: 500
          title: Clients To Add
          type: array
        clients_to_remove:
          description: >-
            IDs of clinic clients to remove from the client group. At most 500
            IDs.
          items:
            type: integer
          maxItems: 500
          title: Clients To Remove
          type: array
      title: ClientGroupMembershipPatchSchema
      type: object
    ExternalClientGroupMembershipPatchResponseSchema:
      description: The per-ID outcome of a client group membership update.
      properties:
        clients_to_add:
          $ref: '#/components/schemas/ExternalClientGroupMembershipListResultSchema'
          description: The outcome for each ID in `clients_to_add`.
        clients_to_remove:
          $ref: '#/components/schemas/ExternalClientGroupMembershipListResultSchema'
          description: The outcome for each ID in `clients_to_remove`.
      required:
        - clients_to_add
        - clients_to_remove
      title: ClientGroupMembershipPatchResponse
      type: object
    ExternalClientGroupMembershipListResultSchema:
      properties:
        failed:
          description: IDs that were rejected and left unchanged.
          items:
            $ref: '#/components/schemas/ExternalClientGroupMembershipFailureSchema'
          title: Failed
          type: array
        succeeded:
          description: >-
            IDs that are in the requested state, including IDs that already
            were.
          items:
            type: integer
          title: Succeeded
          type: array
      required:
        - succeeded
        - failed
      title: ClientGroupMembershipListResult
      type: object
    ExternalClientGroupMembershipFailureSchema:
      properties:
        code:
          $ref: '#/components/schemas/ClientGroupMembershipUpdateFailureCode'
          description: Why the change was rejected.
        id:
          description: The requested clinic client ID.
          title: Id
          type: integer
        message:
          description: A human-readable explanation of the failure.
          title: Message
          type: string
      required:
        - id
        - code
        - message
      title: ClientGroupMembershipFailure
      type: object
    ClientGroupMembershipUpdateFailureCode:
      enum:
        - NOT_FOUND
        - INACCESSIBLE
        - DELETED
        - IN_BOTH_LISTS
      title: ClientGroupMembershipUpdateFailureCode
      type: string
  securitySchemes:
    ExternalAPIAuth:
      scheme: bearer
      type: http

````