Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Delete vector store file

client.VectorStores.Files.Delete(ctx, vectorStoreID, fileID) (*VectorStoreFileDeleted, error)
DELETE
/vector_stores/{vector_store_id}/files/{file_id}

Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.

Delete vector store file

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  vectorStoreFileDeleted, err := client.VectorStores.Files.Delete(
    context.TODO(),
    "vector_store_id",
    "file_id",
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", vectorStoreFileDeleted.ID)
}
Response example
{
  "id": "file-abc123",
  "object": "vector_store.file.deleted",
  "deleted": true
}
Parameters
vectorStoreID string
fileID string
Returns
type VectorStoreFileDeleted struct{…}
ID string
Deleted bool
Object VectorStoreFileDeleted
Returns Examples
Response example
{
  "id": "file-abc123",
  "object": "vector_store.file.deleted",
  "deleted": true
}