---
type: api
title: Restart an agent
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-agentid-restart
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/operation/operation-post-fleet-agents-agentid-restart
products:
  - Kibana
---

# Restart an agent

Availability: Planned

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

## Paths

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

#### Path parameters

- `agentId` (string · max length: 512) — required
  The agent ID to restart

## Description

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

Restart an Elastic Agent. The request fails when the agent is inactive, on a version earlier than 9.6.0, or enrolled in a hosted agent policy.

## 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

## 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/restart
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/fleet/agents/${AGENT_ID}/restart" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Success

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

#### Bad request

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

