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

# Delete Agent

> Permanently delete an agent and all associated data.

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE https://api.thinnest.ai/v2/agents/{public_id} \
    -H "Authorization: Bearer $THINNESTAI_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.thinnest.ai/v2/agents/{public_id}"
  headers = {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
  }

  response = requests.delete(url, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.thinnest.ai/v2/agents/{public_id}", {
    method: "DELETE",
    headers: {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
    },
  });

  const data = await response.json();
  console.log(data);
  ```

  ```go Go theme={null}
  package main

  import (
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      req, _ := http.NewRequest("DELETE", "https://api.thinnest.ai/v2/agents/{public_id}", nil)
      req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")

      resp, err := http.DefaultClient.Do(req)
      if err != nil { panic(err) }
      defer resp.Body.Close()
      body, _ := io.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</RequestExample>

***

## Path Parameters

<ParamField path="agent_id" type="string" required>
  The agent's public ID (ag\_\*)
</ParamField>

***

## Response `204`

No content. The agent has been permanently deleted.

> **Warning:** This action is irreversible. All agent data including configuration, knowledge sources, API keys, and conversation history will be permanently removed.

***

## What Gets Deleted

| Resource                   | Deleted                    |
| -------------------------- | -------------------------- |
| Agent configuration        | Yes                        |
| Attached knowledge sources | Yes                        |
| Agent API keys             | Yes                        |
| Conversation history       | Yes                        |
| Call recordings            | Yes                        |
| Billing records            | No (retained for auditing) |

***

## Errors

| Code  | Description                         |
| ----- | ----------------------------------- |
| `401` | Missing or invalid authentication   |
| `403` | Not authorized to delete this agent |
| `404` | Agent not found                     |
