---
type: api
title: Delete an agent
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-delete-agent-builder-agents-id
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-delete-agent-builder-agents-id
products:
  - Kibana
---

# Delete an agent

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

## Paths

- `DELETE` `/api/agent_builder/agents/{id}`
- `DELETE` `/s/{space_id}/api/agent_builder/agents/{id}`

#### Path parameters

- `id` (string) — required
  The unique identifier of the agent to delete.

## Description

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

Delete an agent by ID. This action cannot be undone. To learn more about agents, refer to the [agents documentation](https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/agent-builder-agents).

## Required authorization

- Privileges: `agentBuilder:manageAgents`

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

## Response

Indicates a successful response

`application/json`

## Code examples

#### Console

```console
DELETE kbn://api/agent_builder/agents/{id}
```

#### curl

```curl
curl \
  -X DELETE "${KIBANA_URL}/api/agent_builder/agents/{id}" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true"
```

## Response examples

#### Delete agent response

Example response showing that deletion of the agent has been successful

```json
{
  "success": true
}
```

