Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Delete file

client.files.delete(fileID, options?): FileDeleted { id, deleted, object }
DELETE
/files/{file_id}

Delete a file and remove it from all vector stores.

Delete file

import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const file = await openai.files.delete("file-abc123");

  console.log(file);
}

main();
Response example
{
  "id": "file-abc123",
  "object": "file",
  "deleted": true
}
Parameters
fileID: string
Returns
FileDeleted { id, deleted, object }
id: string
deleted: boolean
object: "file"
Returns Examples
Response example
{
  "id": "file-abc123",
  "object": "file",
  "deleted": true
}