BucktDocs

Delete file

DELETE/v1/buckets/{bucketId}/files/{path}files:deleteSDK: files.delete

Deletes the object from S3 and decrements the bucket's storageUsedBytes. The change propagates to the CDN within seconds.

Path parameters

NameTypeDefaultDescription
bucketIdrequiredstringThe bucket containing the file.
pathrequiredstringThe file's object key.

Example request

import { Buckt } from "@buckt/sdk";

const client = new Buckt({ apiKey: process.env.BUCKT_API_KEY });

await client.files.delete(
  "bkt_01H8XYZABCDEFGHJKMNPQRSTVW",
  "images/logo.png"
);
// Returns: { object: "file", id: "images/logo.png" }

Responses

{
  "data": {
    "object": "file",
    "id": "images/logo.png"
  },
  "error": null,
  "meta": null
}