Skip to content

Delete Vectors

client.VectorStores.Delete(ctx, vectorStoreName, body) (*VectorStoreDeleteResponse, error)
POST/v5/vector-stores/{vector_store_name}/delete

Delete documents from a vector store by document IDs or metadata filter criteria.

Delete by IDs: Provide an array of document IDs to delete specific documents. Non-existent documents are silently skipped.

Delete by Filter: Use metadata filters to delete all documents matching the specified criteria (e.g., delete all documents where status: "archived"). The filter must specify at least one condition and cannot be empty. To delete all documents, use the drop endpoint instead.

Filter Operators: Supports MongoDB-style operators including equality ({"field": "value"}), comparison ($gt, $gte, $lt, $lte, $eq, $ne), logical ($and, $or, $not), and membership ($in, $nin). Only indexed metadata fields can be used for filtering.

Best Practice: Use the count endpoint with the same filter to preview the number of documents that will be deleted before executing the deletion operation.

ParametersExpand Collapse
vectorStoreName string

The name of the vector store

body VectorStoreDeleteParams
Filter param.Field[map[string, any]]Optional

Metadata filter expression for deletion

IDs param.Field[[]string]Optional

Array of document IDs to delete

ReturnsExpand Collapse
type VectorStoreDeleteResponse struct{…}

Response for delete operation.

DeletedCount int64

Number of documents deleted

Delete Vectors

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  vectorStore, err := client.VectorStores.Delete(
    context.TODO(),
    "vector_store_name",
    sgpdev.VectorStoreDeleteParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", vectorStore.DeletedCount)
}
{
  "deleted_count": 0
}
Returns Examples
{
  "deleted_count": 0
}