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

Delete file

FileDeleted files().delete(params = FileDeleteParams.none(), requestOptions = RequestOptions.none())
DELETE
/files/{file_id}

Delete a file and remove it from all vector stores.

Delete file

package com.openai.example;

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

public final class Main {
    private Main() {}

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

        FileDeleted fileDeleted = client.files().delete("file_id");
    }
}
Response example
{
  "id": "file-abc123",
  "object": "file",
  "deleted": true
}
Parameters
FileDeleteParams params
Optional<String> fileId
Returns
class FileDeleted:
String id
boolean deleted
JsonValue; object_
constant
constant
Returns Examples
Response example
{
  "id": "file-abc123",
  "object": "file",
  "deleted": true
}