SpyBara
Go Premium

java/resources/files/methods/delete/index.md 2026-07-10 23:02 UTC to 2026-07-12 06:58 UTC

This page contains 1 addition and 1 deletion.

2026
Thu 9 20:58 Sun 12 06:58

Delete file

FileDeleted files().delete(FileDeleteParamsparams = FileDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())

delete /files/{file_id}

Delete a file and remove it from all vector stores.

Parameters

  • FileDeleteParams params

    • Optional<String> fileId

Returns

  • class FileDeleted:

    • String id

    • boolean deleted

    • JsonValue; object_ "file"constant

      • FILE("file")

Example

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

{
  "id": "id",
  "deleted": true,
  "object": "file"
}