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

Delete specific items from the index by their IDs.

## Authentication

Required - API key via `X-API-Key` header:

```http theme={null}
X-API-Key: cyborg_your_api_key_here
```

You can get an API key from the [CyborgDB Admin Dashboard](https://cyborgdb.co). For more info, follow [this guide](../../../intro/get-api-key).

## Request Body

```json theme={null}
{
  "index_name": "my_index",
  "index_key": "64_character_hex_string_representing_32_bytes",
  "ids": ["item_1", "item_2", "item_3"]
}
```

<Expandable title="parameters">
  <ParamField body="index_name" type="string" required="true">
    Name of the target index
  </ParamField>

  <ParamField body="index_key" type="string">
    32-byte encryption key as a hex string. Required for indexes created with the SDK-supplied KEK path; omit for KMS-backed indexes (the service resolves the key via the stored KMSBlob).
  </ParamField>

  <ParamField body="ids" type="array[string]" required="true">
    List of item IDs to delete
  </ParamField>
</Expandable>

## Response

```json theme={null}
{
  "status": "success",
  "message": "Deleted 3 vectors"
}
```

<Expandable title="response fields">
  <ResponseField name="status" type="string">
    Status of the operation (always "success" on successful deletion)
  </ResponseField>

  <ResponseField name="message" type="string">
    Confirmation message with count of deleted vectors (format: "Deleted N vectors")
  </ResponseField>
</Expandable>

## Exceptions

* `401`: Authentication failed (invalid API key) **or** wrong `index_key` on SDK-supplied indexes — see [error model](../introduction#error-model-api-keys-index-keys-and-kms)
* `404`: Index not found
* `422`: Invalid request parameters
* `500`: Internal server error

<Note>If some IDs don't exist in the index, they will be silently ignored and the operation will continue with the existing IDs.</Note>

## Example Usage

**Delete Single Item:**

```bash theme={null}
curl -X POST "http://localhost:8000/v1/vectors/delete" \
     -H "X-API-Key: cyborg_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{
       "index_name": "my_index",
       "index_key": "your_64_character_hex_key_here",
       "ids": ["item_1"]
     }'
```

**Delete Multiple Items:**

```bash theme={null}
curl -X POST "http://localhost:8000/v1/vectors/delete" \
     -H "X-API-Key: cyborg_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{
       "index_name": "my_index",
       "index_key": "your_64_character_hex_key_here",
       "ids": ["item_1", "item_2", "item_3", "item_4", "item_5"]
     }'
```

**Batch Delete:**

```bash theme={null}
curl -X POST "http://localhost:8000/v1/vectors/delete" \
     -H "X-API-Key: cyborg_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{
       "index_name": "cleanup_index",
       "index_key": "your_64_character_hex_key_here",
       "ids": [
         "old_1", "old_2", "old_3", "old_4", "old_5",
         "temp_1", "temp_2", "temp_3", "temp_4", "temp_5",
         "test_1", "test_2", "test_3", "test_4", "test_5"
       ]
     }'
```

## Safe Delete Pattern

```bash theme={null}
# First, verify items exist
curl -X POST "http://localhost:8000/v1/vectors/get" \
     -H "X-API-Key: cyborg_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{
       "index_name": "my_index",
       "index_key": "your_64_character_hex_key_here",
       "ids": ["item_to_delete"],
       "include": ["metadata"]
     }'

# Then delete if confirmed
curl -X POST "http://localhost:8000/v1/vectors/delete" \
     -H "X-API-Key: cyborg_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{
       "index_name": "my_index",
       "index_key": "your_64_character_hex_key_here",
       "ids": ["item_to_delete"]
     }'
```

## Data Removal

When vectors are deleted, the following data is permanently removed:

* **Vector embeddings**: The stored vector representation
* **Item contents**: Any associated text or binary content
* **Metadata**: All key-value metadata pairs for the item
* **Index references**: Internal index pointers to the deleted items

## Performance Considerations

* **Batch operations**: Delete multiple items in single requests for better performance
* **Index impact**: Large deletions may affect index efficiency; consider retraining after significant deletions
* **Memory**: Deleted items may not immediately free memory until index optimization occurs

## Use Cases

* **Data cleanup**: Remove outdated or invalid items
* **Content moderation**: Delete inappropriate or flagged content
* **User management**: Remove user-associated data upon account deletion
* **Testing cleanup**: Clean up test data after development
* **Data governance**: Remove data that exceeds retention policies
