---
title: "Restart an agent"
method: POST
path: "/api/fleet/agents/{agentId}/restart"
tags: ["Elastic Agent actions"]
---

# Restart an agent

`POST /api/fleet/agents/{agentId}/restart`

## Request

- Base URL: `https://localhost:5601`
- URL: `https://localhost:5601/api/fleet/agents/{agentId}/restart`
- Auth: one of:
  - API key in header `Authorization`
  - HTTP basic

**Spaces method and path for this operation:**

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/agents/{agentId}/restart</span></div>

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.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.

## Path parameters

- `agentId` string, required

## Headers

- `kbn-xsrf` string, required

## Response `200`

OK: A successful request.

- union
  - KibanaHTTPAPIsActionIdResponse
    - `actionId` string, required
  - KibanaHTTPAPIsActionMessageResponse
    - `message` string, required

## Other responses

- `400`: A bad request.

---

[API](https://skmtc.dev/elastic/apis/kibana-apis.md) - [All operations](https://skmtc.dev/elastic/apis/kibana-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/elastic/apis/kibana-apis/revisions/b87131d80c52?raw)
