TsgcHTTP_API_AnthropicMethods › DeleteFile

DeleteFile Method

Deletes a previously uploaded file from the Anthropic Files API

Syntax

function DeleteFile(const aFileId: string) : TsgcAnthropicClass_Response_File_Deleted;

Parameters

NameTypeDescription
aFileIdconst stringIdentifier of the file to delete, as returned by UploadFile or ListFiles.

Return Value

Response confirming the deletion with the file Id and Deleted flag (TsgcAnthropicClass_Response_File_Deleted)

Remarks

Sends a DELETE /v1/files/{file_id} request to the Anthropic Files API. Once deleted the file id can no longer be referenced from new messages, although existing message histories that already included the file content are unaffected. The anthropic-version header from AnthropicOptions is included automatically. The returned object must be freed by the caller.

Example

oResponse := oAPI.DeleteFile('file_01ABCxyz');
try
  if oResponse.Deleted then ShowMessage('file removed');
finally
  oResponse.Free;
end;

Back to Methods