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

# Delete agent

> Delete one agent from the workspace.

Deletes one agent in the workspace tied to your API key.

<Warning>
  Deleting an agent removes it from the workspace. Use [List agents](/en/api-reference/list-agents) first to confirm the ID and name before calling this route.
</Warning>

## Headers

<ParamField header="Authorization" type="string" required>
  Bearer token containing your Fini workspace API key. Format: `Bearer fini_...` The key needs `write` scope.
</ParamField>

## Path parameters

<ParamField path="id" type="string" required>
  Agent ID to delete. Use [List agents](/en/api-reference/list-agents) to get the `botId`.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url 'https://api-prod.usefini.com/v2/bots/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/public' \
    --header 'Authorization: Bearer fini_your_api_key'
  ```

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

  response = requests.delete(
      "https://api-prod.usefini.com/v2/bots/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/public",
      headers={"Authorization": "Bearer fini_your_api_key"},
  )
  result = response.json()
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api-prod.usefini.com/v2/bots/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/public",
    {
      method: "DELETE",
      headers: {
        Authorization: "Bearer fini_your_api_key",
      },
    }
  );
  const result = await response.json();
  ```
</RequestExample>

## Response

Returns a confirmation message.

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "message": "Bot Support Agent deleted"
  }
  ```
</ResponseExample>

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The agent ID is not a valid UUID.
  </Accordion>

  <Accordion title="401 Unauthorized" icon="lock">
    The API key is missing, malformed, revoked, or invalid.
  </Accordion>

  <Accordion title="403 Forbidden" icon="shield-halved">
    The API key does not include the `write` scope required for this route.
  </Accordion>

  <Accordion title="404 Not Found" icon="ghost">
    The agent does not exist in the API key's workspace.
  </Accordion>

  <Accordion title="500 Internal Server Error" icon="triangle-exclamation">
    Fini failed while deleting the agent.
  </Accordion>
</AccordionGroup>
