---
type: api
title: Bulk change agent privilege level
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-agents-bulk-privilege-level-change
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-agents-bulk-privilege-level-change
products:
  - Kibana
---

# Bulk change agent privilege level

Availability: 9.3+

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

## Paths

- `POST` `/api/fleet/agents/bulk_privilege_level_change`
- `POST` `/s/{space_id}/api/fleet/agents/bulk_privilege_level_change`

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

## Description

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

Change multiple agents' privilege level to unprivileged.<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
- `user_info` (object) — optional
  - `groupname` (string) — optional
  - `password` (string) — optional
  - `username` (string) — optional

## Responses

#### `200`

OK: A successful request.

`application/json`

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

A bad request.

`application/json`

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

#### Console

```console
POST /api/fleet/agents/bulk_privilege_level_change
{
  "agents": "agent",
  "user_info": {
    "groupname": "groupname",
    "password": "password",
    "username": "username"
  }
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/agents/bulk_privilege_level_change" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "agents": "agent",
  "user_info": {
    "groupname": "groupname",
    "password": "password",
    "username": "username"
  }
}'
```

## Response Examples

#### Success

```json
{
  "actionId": "actionId"
}
```

#### Bad request

```json
{
  "message": "Bad Request"
}
```

