> ## Documentation Index
> Fetch the complete documentation index at: https://actianvectorai-docs-low-effort-fixes.mintlify.site/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.
</Warning>

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

<CodeGroup>
  ```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);
  ```
</CodeGroup>

## 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.

<CodeGroup>
  ```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);
  ```
</CodeGroup>
