Skip to contents

Permanently deletes a file from the OpenAI Files API. This action cannot be undone. Note that files associated with active batch jobs cannot be deleted until the job completes.

Usage

oai_file_delete(file_id, key_name = "OPENAI_API_KEY")

Arguments

file_id

File identifier (starts with 'file-'), returned by oai_batch_upload() or oai_file_list()

key_name

Name of the environment variable containing your API key

Value

A list containing the file id, object type, and deletion status (deleted = TRUE/FALSE)

See also

oai_file_list() to find file IDs, oai_file_content() to retrieve file contents before deletion

Examples

if (FALSE) { # \dontrun{
# Delete a specific file
result <- oai_file_delete("file-abc123")
result$deleted # TRUE if successful

} # }