Claude Platform Docs

Delete File

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

Delete File

Parameters
fileID string

ID of the File.

Returns
type DeletedFile struct{…}
ID string

ID of the deleted file.

Type DeletedFileType Optional

Deleted object type.

For file deletion, this is always "file_deleted".

defaultfile_deleted

Delete File

package main

import (
	"context"
	"fmt"

	"github.com/anthropics/anthropic-sdk-go"
	"github.com/anthropics/anthropic-sdk-go/option"
)

func main() {
	client := anthropic.NewClient(
		option.WithAPIKey("my-anthropic-api-key"),
	)
	deletedFile, err := client.Files.Delete(context.TODO(), "file_id")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", deletedFile.ID)
}
{
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "type": "file_deleted"
}
Returns Examples
{
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "type": "file_deleted"
}