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

# Change agent privilege level

Availability: Experimental since 9.3

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

## Paths

- `POST` `/api/fleet/agents/{agentId}/privilege_level_change`
- `POST` `/s/{space_id}/api/fleet/agents/{agentId}/privilege_level_change`

#### Path parameters

- `agentId` (string) — required
  The agent ID to change privilege level for

## Description

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

Change the privilege level of a single agent 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`

- `user_info` (object) — optional
  - `groupname` (string) — optional
  - `password` (string) — optional
  - `username` (string) — optional

## Responses

#### `200`

OK: A successful request.

`application/json`

Any of:
- **action_id_response**
  - `actionId` (string)
- **action_message_response**
  - `message` (string)
#### `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/AGENT_ID/privilege_level_change
{
  "user_info": {
    "groupname": "groupname",
    "password": "password",
    "username": "username"
  }
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/agents/${AGENT_ID}/privilege_level_change" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "user_info": {
      "groupname": "groupname",
      "password": "password",
      "username": "username"
    }
  }'
```

## Response examples

#### Success

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

#### Bad request

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

