Skip to content
Primary navigation

Delete file

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

Delete a file and remove it from all vector stores.

ParametersExpand Collapse
fileID: string
ReturnsExpand Collapse
FileDeleted { id, deleted, object }
id: string
deleted: boolean
object: "file"

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();
{
  "id": "file-abc123",
  "object": "file",
  "deleted": true
}
Returns Examples
{
  "id": "file-abc123",
  "object": "file",
  "deleted": true
}