> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memanto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Agent

> Delete an agent's local metadata; optionally remove its Moorcheh namespace.

## Overview

Removes the agent record from Memanto's local store. By default, memories remain in Moorcheh under that agent's namespace. Pass `delete-backup-too=true` to also delete the namespace and its contents in Moorcheh.

<Warning>
  Without `delete-backup-too=true`, only **local** agent metadata is removed; the cloud namespace is left intact.
</Warning>

## Authentication

<ParamField header="Authorization" type="string">
  `Bearer <key>` — required unless the request originates from a loopback client. See [Management Endpoint Authentication](/api-reference/authentication#management-endpoint-authentication-agent-lifecycle).
</ParamField>

<ParamField header="X-Api-Key" type="string">
  Alternative to `Authorization: Bearer` — same credential.
</ParamField>

## Path Parameters

<ParamField path="agent_id" type="string" required>
  The unique identifier of the agent to delete.
</ParamField>

## Query Parameters

<ParamField query="delete-backup-too" type="boolean">
  When `true`, also deletes the agent's Moorcheh namespace (`memanto_agent_{agent_id}`) and its memories. When `false` or omitted, the namespace is not deleted. Accepts `true` or `false`.
</ParamField>

<RequestExample>
  ```bash Local metadata only theme={null}
  curl -X DELETE "http://localhost:8000/api/v2/agents/old-agent"
  ```

  ```bash Delete Moorcheh namespace too theme={null}
  curl -X DELETE "http://localhost:8000/api/v2/agents/old-agent?delete-backup-too=true"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - OK (namespace retained) theme={null}
  {
    "message": "Agent 'old-agent' successfully deleted (backup retained in Moorcheh)"
  }
  ```

  ```json 200 - OK (namespace deleted) theme={null}
  {
    "message": "Agent 'old-agent' successfully deleted with all namespace memories"
  }
  ```

  ```json 401 - Unauthorized (Management Auth Required) theme={null}
  {
    "detail": "Unauthorized. Agent management endpoints require either a loopback client or a valid management credential (Authorization: Bearer <key> or X-Api-Key)."
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "detail": {
      "error": "AgentNotFound",
      "message": "Agent 'old-agent' not found",
      "details": {}
    }
  }
  ```

  ```json 500 - Server Error theme={null}
  {
    "detail": {
      "error": "InternalServerError",
      "message": "An unexpected error occurred",
      "details": {
        "original_error": "..."
      }
    }
  }
  ```
</ResponseExample>

## Next Steps

After deleting an agent, you can:

* [Create a new Agent](/api-reference/agents/create-agent)
* [List remaining Agents](/api-reference/agents/list-agents) to verify deletion
