---
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/4493/api/doc/kibana/operation/operation-post-fleet-agents-bulk-privilege-level-change
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/operation/operation-post-fleet-agents-bulk-privilege-level-change
products:
  - Kibana
---

# Bulk change agent privilege level

Availability: Experimental since 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`

## Description

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

Change multiple agents' privilege level to unprivileged.

## 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
- `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 kbn:/api/fleet/agents/bulk_privilege_level_change
{
  "agents": "agent",
  "user_info": {
    "groupname": "groupname",
    "password": "password",
    "username": "username"
  }
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/agents/bulk_privilege_level_change" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -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"
}
```

