---
title: "Bulk remove OpAMP collectors"
method: POST
path: "/api/fleet/agents/bulk_remove_collectors"
tags: ["Elastic Agent actions"]
---

# Bulk remove OpAMP collectors

`POST /api/fleet/agents/bulk_remove_collectors`

**Spaces method and path for this operation:**

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/agents/bulk_remove_collectors</span></div>

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Remove multiple OpAMP collectors from the Fleet agents list. Marks the collectors as unenrolled. This action does not invalidate API keys, so collectors can reconnect on their own.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.

## Headers

- `kbn-xsrf` string, required

## Request body

- object
  - `agents` union, required
    - string[]
    - string — KQL query string. Leave empty to target all collectors
  - `dryRun` boolean
  - `includeInactive` boolean — When passing collectors by KQL query, also removes inactive collectors

## Response `200`

Successful response

- union
  - object
    - `actionId` string, required
  - object
    - `count` number, required

## Other responses

- `400` — Bad Request

---

[API](https://skmtc.net/elastic/apis/kibana-apis.md) · [All operations](https://skmtc.net/elastic/apis/kibana-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/kibana-apis/versions/531c9e2a7d23/schema)
