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

# Bulk operations on client contacts

> Perform bulk operations on contacts across multiple clients: Remove, Replace, InvitePortal, InviteCollaborate, Associate



## OpenAPI

````yaml /api-reference/cx/swagger.json post /clients/_bulk-contacts
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /clients/_bulk-contacts:
    post:
      tags:
        - clients
      summary: Bulk operations on client contacts
      description: >-
        Perform bulk operations on contacts across multiple clients: Remove,
        Replace, InvitePortal, InviteCollaborate, Associate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pkg_routes_clients.BulkContactRequest'
        description: Bulk contact operation request
        required: true
      responses:
        '200':
          description: Bulk operation results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_clients.BulkContactsResponse'
        '400':
          description: >-
            Bad request - invalid request body, missing IDs, or invalid
            operation type
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_clients.BulkContactRequest:
      type: object
      properties:
        association:
          description: For association operations
          allOf:
            - $ref: '#/components/schemas/pkg_routes_clients.AssociationRequest'
        clientIds:
          description: Frontend sends string IDs
          type: array
          items:
            type: string
        contactId:
          description: 'Frontend sends string ID - DEPRECATED: Use contactIds instead'
          type: string
        contactIds:
          description: 'Frontend sends string IDs - NEW: Support multiple contacts'
          type: array
          items:
            type: string
        permissions:
          description: For collaboration invitations
          allOf:
            - $ref: '#/components/schemas/pkg_routes_clients.CollaboratePermissions'
        scopes:
          description: For portal invitations
          type: array
          items:
            type: string
        toContactId:
          description: For replace operations
          type: string
        type:
          description: >-
            "Remove", "Replace", "InvitePortal", "InviteCollaborate",
            "Associate"
          type: string
    pkg_routes_clients.BulkContactsResponse:
      type: object
      properties:
        ok:
          type: boolean
        results:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_clients.BulkContactResult'
    pkg_routes_clients.AssociationRequest:
      type: object
      properties:
        contactType:
          description: '"Contact" or "External"'
          type: string
        itemId:
          description: ID of the company, plan, or deal
          type: string
        planId:
          description: Optional plan ID for company associations
          type: string
        role:
          description: Role for the contact
          type: string
        type:
          description: '"Company", "Plan", "Deal"'
          type: string
    pkg_routes_clients.CollaboratePermissions:
      type: object
      properties:
        clientPortalAccess:
          type: boolean
        participantDataAccess:
          type: boolean
        readOnly:
          type: boolean
    pkg_routes_clients.BulkContactResult:
      type: object
      properties:
        clientId:
          type: string
        contactId:
          description: 'NEW: Include contact ID in results'
          type: string
        error:
          type: string
        invite:
          $ref: '#/components/schemas/types.Invitation'
        success:
          type: boolean
    types.Invitation:
      type: object
      properties:
        _id:
          type: string
        accepted_on:
          type: string
        client:
          description: >-
            If the invitation is to join a team, the client ID is not set. If
            it's to join a client, the client ID is set
          type: string
        contact:
          description: >-
            Contact the client portal invitation was sent to, so it can follow
            that contact's email changes
          type: string
        deleted_at:
          type: string
        email:
          type: string
        from:
          description: User ID
          type: string
        last_follow_up:
          type: string
        name:
          description: Invitation user details
          type: string
        scopes:
          type: array
          items:
            type: string
        sent_on:
          type: string
        team:
          type: string
        title:
          type: string
        user:
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

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