Skip to content

Delete vector store file

VectorStoreFileDeleted vectorStores().files().delete(FileDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
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
FileDeleteParams params
String vectorStoreId
Optional<String> fileId
ReturnsExpand Collapse
class VectorStoreFileDeleted:
String id
boolean deleted
JsonValue; object_ "vector_store.file.deleted"constant"vector_store.file.deleted"constant

Delete vector store file

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.files.FileDeleteParams;
import com.openai.models.vectorstores.files.VectorStoreFileDeleted;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        FileDeleteParams params = FileDeleteParams.builder()
            .vectorStoreId("vector_store_id")
            .fileId("file_id")
            .build();
        VectorStoreFileDeleted vectorStoreFileDeleted = client.vectorStores().files().delete(params);
    }
}
{
  "id": "id",
  "deleted": true,
  "object": "vector_store.file.deleted"
}
Returns Examples
{
  "id": "id",
  "deleted": true,
  "object": "vector_store.file.deleted"
}