Claude Platform Docs

Delete File

DeletedFile files().delete(FileDeleteParamsparams = FileDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
DELETE/v1/files/{file_id}

Delete File

Parameters
FileDeleteParams params
Optional<String> fileId

ID of the File.

Returns
class DeletedFile:
String id

ID of the deleted file.

Optional<Type> type

Deleted object type.

For file deletion, this is always "file_deleted".

Delete File

package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.files.DeletedFile;
import com.anthropic.models.files.FileDeleteParams;

public final class Main {
    private Main() {}

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

        DeletedFile deletedFile = client.files().delete("file_id");
    }
}
{
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "type": "file_deleted"
}
Returns Examples
{
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "type": "file_deleted"
}