TsgcHTTP_API_OpenAIMethods › DeleteFile

DeleteFile Method

Permanently deletes a file previously uploaded to OpenAI

Syntax

function DeleteFile(const aFileId: string): TsgcOpenAIClass_Response_Delete;

Parameters

NameTypeDescription
aFileIdconst stringIdentifier of the file to delete

Return Value

Deletion result containing the target id and a Deleted flag (TsgcOpenAIClass_Response_Delete)

Remarks

Calls the DELETE /v1/files/{file_id} endpoint. Once deleted, the file can no longer be referenced by assistants, batches, fine-tuning jobs or other features. The operation is immediate and cannot be undone; consider listing and verifying the file before deleting.

Example

oResponse := oAPI.DeleteFile('file-abc123');
if oResponse.Deleted then
  ShowMessage('File ' + oResponse.Id + ' deleted');

Back to Methods