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

# DELETE /v1/tools/{id}

> Delete a webhook tool permanently. Fails while an agent still holds it.

Deletes the tool. This is a hard delete and it cannot be undone.

It is refused while an agent still holds the tool, and the error names which ones — so the normal sequence is: take the tool out of those agents with [`PATCH /v1/agents/{id}`](/dev/endpoints/agents-update), then delete.

<Warning>
  If you only want the agent to stop calling it, [`PUT` it with `is_active: false`](/dev/endpoints/tools-update) instead. That is reversible and keeps the URL, headers and parameters intact.
</Warning>

## Endpoint

```
DELETE https://api.keebai.com/v1/tools/{id}
```

## Required scope

`agents:write`

## Headers

| Header          | Required | Value                    |
| --------------- | -------- | ------------------------ |
| `Authorization` | Yes      | `Bearer kbai_pk_<token>` |

## Path parameters

| Parameter | Type     | Description             |
| --------- | -------- | ----------------------- |
| `id`      | `string` | `ObjectId` of the tool. |

## Example request

<CodeGroup>
  ```bash curl theme={"system"}
  curl -X DELETE https://api.keebai.com/v1/tools/6650cccc3333dddd4444eeee \
    -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ```

  ```js JavaScript theme={"system"}
  const resp = await fetch(
    "https://api.keebai.com/v1/tools/6650cccc3333dddd4444eeee",
    {
      method: "DELETE",
      headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` },
    },
  );

  if (resp.status === 409) {
    const { error } = await resp.json();
    console.error("Still used by:", error.details.agents);
  }
  ```

  ```python Python theme={"system"}
  import os, requests

  resp = requests.delete(
      "https://api.keebai.com/v1/tools/6650cccc3333dddd4444eeee",
      headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
      timeout=10,
  )
  if resp.status_code == 409:
      print("still used by:", resp.json()["error"]["details"]["agents"])
  elif resp.status_code != 404:
      resp.raise_for_status()
  ```
</CodeGroup>

## Response

### 204 No Content

Deleted. No body.

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `agents:write` scope.

### 404 Not Found

No webhook tool with that id in the token's company. A repeated delete lands here, so treat `404` as "already gone".

### 409 Conflict

`error.code` is `AGENT_TOOL_IN_USE`. At least one agent still holds the tool; the error details list them.

### 502 Bad Gateway

The agent service is unreachable.

## Operational notes

* **The `409` is the useful part of this endpoint.** It is what stops you silently breaking an agent mid-conversation, and it tells you exactly which agents to fix.
* **Taking a tool off an agent is an [agent update](/dev/endpoints/agents-update)**, not a tool operation: send `tools` without that id.
* **Deleting is company-wide.** A tool held by an agent in another project of the same company counts as in use and blocks the delete.
* **A retry is safe**: the second call is a `404`, never a partial delete.
* **`is_active: false` is the reversible alternative** and is usually what you want when retiring an integration gradually.


## OpenAPI

````yaml DELETE /v1/tools/{id}
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/tools/{id}:
    delete:
      tags:
        - tools
      summary: Eliminar una funcion de webhook
      description: >-
        Falla con 409 AGENT_TOOL_IN_USE mientras algun agente todavia la tenga
        asignada, y el error dice cual.
      operationId: PublicToolsController_remove
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - PAT: []
components:
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````