---
type: api
title: Bulk reassign agents
description: Reassign multiple agents to a different agent policy.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-post-fleet-agents-bulk-reassign
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-post-fleet-agents-bulk-reassign
products:
  - Kibana
---

# Bulk reassign agents

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

## Paths

- `POST` `/api/fleet/agents/bulk_reassign`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v0/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v0/authentication#basicauth)

## Description

Reassign multiple agents to a different agent policy.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.

## Request Body

`application/json`

- `agents` (union [] string | string) — required
- `batchSize` (number) — optional
- `dryRun` (boolean) — optional
- `includeInactive` (boolean · default: false) — optional
- `policy_id` (string) — required

## 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 /api/fleet/agents/bulk_reassign
{
  "agents": [
    "agent-id-1",
    "agent-id-2"
  ],
  "policy_id": "agent-policy-id-2"
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/agents/bulk_reassign" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "agents": [
    "agent-id-1",
    "agent-id-2"
  ],
  "policy_id": "agent-policy-id-2"
}'
```

## Response Examples

#### Post bulk reassign agents

Bulk reassign 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
}
```

