---
type: api
title: Bulk remove OpAMP collectors
description: 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.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-post-fleet-agents-bulk-remove-collectors
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-post-fleet-agents-bulk-remove-collectors
products:
  - Kibana
---

# Bulk remove OpAMP collectors

Availability: Experimental since 9.5

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/fleet/agents/bulk_remove_collectors`

## Description

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.

## Required authorization

- Privileges: `fleet-agents-all`

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Request body

`application/json`

- `agents` (union string[] | string) — required
- `dryRun` (boolean) — optional
- `includeInactive` (boolean) — optional
  When passing collectors by KQL query, also removes inactive collectors

## Responses

#### `200`

Successful response

`application/json`

Any of:
- **{ actionId }**
  - `actionId` (string)
- **{ count }**
  - `count` (number)
#### `400`

Bad Request

`application/json`

- `attributes` (object)
- `error` (string)
- `errorType` (string)
- `message` (string)
- `statusCode` (number)
## Code examples

#### Console

```console
POST kbn:/api/fleet/agents/bulk_remove_collectors
{
  "agents": [
    "collector-id-1",
    "collector-id-2"
  ]
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/agents/bulk_remove_collectors" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "agents": [
      "collector-id-1",
      "collector-id-2"
    ]
  }'
```

## Response examples

#### Post bulk remove collectors

Bulk remove collectors action result

```json
{
  "actionId": "action-id-1"
}
```

#### Generic error response

Example of a generic error response

```json
{
  "error": "Bad Request",
  "message": "An error message describing what went wrong",
  "statusCode": 400
}
```

