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

# Delete Stack

> Permanently delete a stack from your ToolRouter account

## Overview

Permanently deletes a stack and all its associated data from your ToolRouter account. This action cannot be undone.

<Warning>
  This action is irreversible. Deleting a stack will permanently remove all its servers, configurations, and credentials.
</Warning>

## Endpoint

```
DELETE https://api.toolrouter.ai/v1/stacks/{stack_id}
```

## Authentication

This endpoint requires an API key. Include it in the Authorization header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

<ParamField path="stack_id" type="string" required>
  The unique identifier of the stack to delete
</ParamField>

## Response

<ResponseField name="message" type="string">
  Confirmation message indicating successful deletion
</ResponseField>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

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

  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }

  response = requests.delete(
      "https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000",
      headers=headers
  )

  result = response.json()
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.toolrouter.ai/v1/stacks/stack_123e4567-e89b-12d3-a456-426614174000', {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const result = await response.json();
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "message": "Stack stack_123e4567-e89b-12d3-a456-426614174000 deleted successfully"
}
```

## What Gets Deleted

When you delete a stack, the following data is permanently removed:

* **Stack configuration**: All stack settings and metadata
* **Server associations**: All servers added to the stack
* **Credentials**: All stored credentials for servers in the stack
* **Usage analytics**: Historical usage data for the stack
* **Secure endpoints**: Any secure client endpoints created for the stack

<Note>
  The actual servers in the ToolRouter marketplace are not deleted - only their association with your stack is removed.
</Note>

## Error Responses

<ResponseField name="401 Unauthorized">
  Invalid or missing API key

  ```json theme={null}
  {
    "detail": "Unauthorized"
  }
  ```
</ResponseField>

<ResponseField name="404 Not Found">
  Stack not found or doesn't belong to your account

  ```json theme={null}
  {
    "detail": "Stack not found"
  }
  ```
</ResponseField>

<ResponseField name="429 Too Many Requests">
  Rate limit exceeded

  ```json theme={null}
  {
    "detail": "Too many requests"
  }
  ```
</ResponseField>

<ResponseField name="500 Internal Server Error">
  Server error occurred during deletion

  ```json theme={null}
  {
    "detail": "Failed to delete stack"
  }
  ```
</ResponseField>

## Best Practices

Before deleting a stack, consider:

1. **Backup important data**: Export any important configurations or credential information
2. **Check dependencies**: Ensure no applications are actively using this stack
3. **Review usage**: Check if the stack has been used recently
4. **Alternative approach**: Consider updating the stack instead of deleting it

## Recovery

<Warning>
  There is no way to recover a deleted stack. Make sure you want to permanently delete the stack before proceeding.
</Warning>

If you accidentally delete a stack, you will need to:

1. Create a new stack with the same configuration
2. Re-add all servers to the new stack
3. Re-configure all credentials
4. Update any applications to use the new stack
