Skip to content
Primary navigation

Delete vector store file

client.vectorStores.files.delete(stringfileID, FileDeleteParams { vector_store_id } params, RequestOptionsoptions?): VectorStoreFileDeleted { id, deleted, object }
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.

ParametersExpand Collapse
fileID: string
params: FileDeleteParams { vector_store_id }
vector_store_id: string

The ID of the vector store that the file belongs to.

ReturnsExpand Collapse
VectorStoreFileDeleted { id, deleted, object }
id: string
deleted: boolean
object: "vector_store.file.deleted"

Delete vector store file

import OpenAI from "openai";
const openai = new OpenAI();

async function main() {
  const deletedVectorStoreFile = await openai.vectorStores.files.delete(
    "file-abc123",
    { vector_store_id: "vs_abc123" }
  );
  console.log(deletedVectorStoreFile);
}

main();
{
  id: "file-abc123",
  object: "vector_store.file.deleted",
  deleted: true
}
Returns Examples
{
  id: "file-abc123",
  object: "vector_store.file.deleted",
  deleted: true
}