---
type: api
title: Bulk restart agents
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-post-fleet-agents-bulk-restart
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-post-fleet-agents-bulk-restart
products:
  - Kibana
---

# Bulk restart agents

Availability: Experimental

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

## Paths

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

## Description

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

Restart multiple Elastic Agents. Agents that are enrolled in a hosted policy or are on a version earlier than 9.6.0 are excluded from the action and receive individual error results.

## Required authorization

- Privileges: `fleet-agents-all`

## Authentication

- Api key: `Authorization: <value>`
  You must create an API key and use the encoded value in the request header. To learn about creating keys, go to [API keys](https://www.elastic.co/docs/current/serverless/api-keys).

## 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 · min: 1) — optional
- `includeInactive` (boolean · default: false) — 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/bulk_restart
{
  "agents": [
    "agent-1",
    "agent-2"
  ],
  "batchSize": 100,
  "includeInactive": false
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/agents/bulk_restart" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "agents": [
      "agent-1",
      "agent-2"
    ],
    "batchSize": 100,
    "includeInactive": false
  }'
```

## Response examples

#### Success

```json
{
  "actionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
```

#### Bad request

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

