Skip to content
Get started

Delete a file

client.Files.Delete(ctx, fileID) (*FileDeleteResponse, error)
DELETE/v1/files/{file_id}

Delete a file. This cannot be undone.

ParametersExpand Collapse
fileID string

The unique identifier of the file.

ReturnsExpand Collapse
type FileDeleteResponse struct{…}

Response from deleting a file.

Following the OpenAI API convention for delete responses.

ID string

The unique identifier of the deleted file.

Deleted bool

Whether the file was successfully deleted.

Object File

The object type, which is always 'file'.

Delete a file

package main

import (
  "context"
  "fmt"

  "github.com/deeptable-com/deeptable-go"
  "github.com/deeptable-com/deeptable-go/option"
)

func main() {
  client := deeptable.NewClient(
    option.WithAPIKey("My API Key"),
  )
  file, err := client.Files.Delete(context.TODO(), "file_01kfxgjd94fn9stqm414vjb0s8")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", file.ID)
}
{
  "id": "file_01kfxgjd94fn9stqm414vjb0s8",
  "deleted": true,
  "object": "file"
}
Returns Examples
{
  "id": "file_01kfxgjd94fn9stqm414vjb0s8",
  "deleted": true,
  "object": "file"
}