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

# Bulk-delete all matching contacts (async)

> Starts a background job that cascade-deletes every contact matching the supplied filter — for each contact it also deletes the org's conversations and messages for that contact, fires assignee notifications, emits `contact_removed` socket events, and writes manual-event audit entries (`CONTACT_DELETE`). The handler responds 202 immediately with a `jobId`; the caller should poll `GET /api/contacts/bulk-job/{jobId}` for progress. The job is registered synchronously before the response is sent so the first poll never gets a 404.



## OpenAPI

````yaml /api-reference/openapi.yaml delete /api/contacts/query-bulk-delete
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/contacts/query-bulk-delete:
    delete:
      tags:
        - Contacts
      summary: Bulk-delete all matching contacts (async)
      description: >-
        Starts a background job that cascade-deletes every contact matching the
        supplied filter — for each contact it also deletes the org's
        conversations and messages for that contact, fires assignee
        notifications, emits `contact_removed` socket events, and writes
        manual-event audit entries (`CONTACT_DELETE`). The handler responds 202
        immediately with a `jobId`; the caller should poll `GET
        /api/contacts/bulk-job/{jobId}` for progress. The job is registered
        synchronously before the response is sent so the first poll never gets a
        404.
      operationId: delete_contact_query_bulk_delete
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactBulkQueryFilter'
      responses:
        '202':
          description: Bulk delete job started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactBulkQueryDeleteResponse'
        '400':
          description: Missing `stageIds[]` when `orgWide` is not true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ContactBulkQueryFilter:
      type: object
      description: >-
        Shared filter shape used by `query-count`, `query-bulk-move`,
        `query-bulk-delete`, and `query-bulk-export`. Either supply `stageIds[]`
        OR set `orgWide: true`. `pipelineType` selects whether the operation
        runs against the Contact or Application collection.
      properties:
        stageIds:
          type: array
          items:
            type: string
          description: One or more pipeline-stage IDs. Required unless `orgWide` is `true`.
        pipelineType:
          type: string
          enum:
            - Contact
            - Application
          description: Which collection to target. Defaults to `Contact`.
        orgWide:
          type: boolean
          description: >-
            When `true`, ignore `stageIds` and run across the whole
            organization.
        ownerFilter:
          type: string
          description: >-
            Owner-based scope (e.g. `owned`, `unowned`) — same semantics as the
            Contacts list view.
        advancedParams:
          type: object
          additionalProperties: true
          description: >-
            Optional advanced filter object (same shape as the Contacts list
            view).
      additionalProperties: true
      example:
        stageIds:
          - 64b2c3d4e5f60012345678aa
        pipelineType: Contact
        ownerFilter: unowned
        advancedParams:
          createdAfter: '2026-01-01T00:00:00.000Z'
    ContactBulkQueryDeleteResponse:
      type: object
      description: >-
        202 Accepted response — the delete runs in the background. Poll `GET
        /api/contacts/bulk-job/{jobId}` for progress.
      properties:
        jobId:
          type: string
          description: UUID to use with `GET /api/contacts/bulk-job/{jobId}`.
        message:
          type: string
      required:
        - jobId
        - message
      additionalProperties: true
      example:
        jobId: b09c2c61-2f8f-4f02-9c1b-2f23a3a2f9c1
        message: Bulk delete started
    LegacyErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        data: {}
      additionalProperties: true
      example:
        error: Attachment not found
        message: Attachment not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````