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

# Delete

Removes vectors from the index by their IDs. This operation permanently deletes the specified vectors and their associated data.

```go theme={null}
func (e *EncryptedIndex) Delete(ctx context.Context, ids []string) error
```

### Parameters

| Parameter | Type              | Description                           |
| --------- | ----------------- | ------------------------------------- |
| `ctx`     | `context.Context` | Context for cancellation and timeouts |
| `ids`     | `[]string`        | Slice of vector IDs to delete         |

### Error Handling

<AccordionGroup>
  <Accordion title="API Errors">
    * Returns error if the API request fails due to network connectivity issues
    * Returns error if authentication fails (invalid API key)
    * Returns error if the encryption key is invalid for the specified index
    * Returns error if there are internal server errors during deletion
  </Accordion>

  <Accordion title="Validation Errors">
    * Returns error if the IDs slice is empty
    * The operation succeeds even if some IDs don't exist in the index
  </Accordion>
</AccordionGroup>

### Example Usage

```go theme={null}
package main

import (
    "context"
    "encoding/hex"
    "fmt"
    "log"

    "github.com/cyborginc/cyborgdb-go"
)

func main() {
    client, err := cyborgdb.NewClient("http://localhost:8000", "your-api-key")
    if err != nil {
        log.Fatal(err)
    }

    // Load an existing index
    indexKeyHex := "your-64-character-hex-key-here"
    indexKey, err := hex.DecodeString(indexKeyHex)
    if err != nil {
        log.Fatal(err)
    }

    index, err := client.LoadIndex(context.Background(), "my-vector-index", indexKey)
    if err != nil {
        log.Fatal(err)
    }

    // Delete specific vectors by ID
    ids := []string{"doc1", "doc2", "doc3"}

    err = index.Delete(context.Background(), ids)
    if err != nil {
        log.Fatalf("Delete failed: %v", err)
    }

    fmt.Printf("Successfully deleted %d vectors\n", len(ids))
}
```
