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

# Delete a collection

> Permanently remove or recreate collections.

This page explains how to permanently remove a collection or reset it to an empty state.

## Delete permanently

> [!WARNING]
>
> Deleted collections cannot be recovered. All vectors, payloads, and indexes associated with the collection are permanently removed. Back up important data before deleting.

Use the following code to permanently remove a collection and all its data.

```python Python theme={null}
import asyncio
from actian_vectorai import AsyncVectorAIClient

async def main():
    # Connect to VectorAI DB server
    async with AsyncVectorAIClient("localhost:6574") as client:
        # Permanently delete collection
        await client.collections.delete("my_collection")
        print("Collection deleted")

asyncio.run(main())
```

```javascript JavaScript theme={null}
import { VectorAIClient } from '@actian/vectorai-client';

async function main() {
    // Connect to VectorAI DB server
    const client = new VectorAIClient('localhost:6574');
    try {
        // Permanently delete collection
        await client.collections.delete('my_collection');
        console.log('Collection deleted');
    } finally {
        client.close();
    }
}

main().catch(console.error);
```

## Recreate a collection

To reset a collection to an empty state, delete and recreate it with the same name. This is useful for testing scenarios or when you need to start fresh with a collection while maintaining the same name. The operation deletes the old collection and creates a new one in a single call.

```python Python theme={null}
import asyncio
from actian_vectorai import AsyncVectorAIClient, VectorParams, Distance

async def main():
    # Connect to VectorAI DB server
    async with AsyncVectorAIClient("localhost:6574") as client:
        # Removes all data and recreates with specified configuration
        await client.collections.recreate(
            "my_collection",  # Collection name
            vectors_config=VectorParams(size=128, distance=Distance.Cosine)  # Vector configuration
        )
        print("Collection recreated")

asyncio.run(main())
```

```javascript JavaScript theme={null}
import { VectorAIClient } from '@actian/vectorai-client';

async function main() {
    // Connect to VectorAI DB server
    const client = new VectorAIClient('localhost:6574');
    try {
        // Removes all data and recreates with specified configuration
        await client.collections.recreate('my_collection', {
            dimension: 128,            // Vector dimension
            distanceMetric: 'COSINE'   // Distance metric
        });
        console.log('Collection recreated');
    } finally {
        client.close();
    }
}

main().catch(console.error);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.