Skip to main content
DELETE/storage/buckets/{bucketName}/objects

Delete Object

Deletes the object at the path query parameter (a query parameter because paths contain slashes).

Answers with the bucket, the path and deleted: true when an object was removed, false when nothing was there.

Needs delete rights on the bucket; in a custom bucket the storage policy decides.

A system bucket refuses writes.

A deletion is audited as data.write.storage.object.deleted.

Parameters
bucketName *path

The bucket's name.

It is unique within the project.

path *query

The path of the object to delete.

projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Responses
HTTPK9O CodeDescription
200Success
401K9O_UNAUTHENTICATEDAuthentication is required.
403K9O_RBAC_DENYThe caller's project role does not permit this object operation.
403K9O_ACCESS_DENIEDThe bucket's storage policy does not allow delete for this caller (context.reason storage_policy_denied). Checked after the role and IAM checks; a bucket with no policy is unaffected.
404K9O_BUCKET_NOT_FOUNDNo bucket with this name exists in the project.
Response body (200)
data *object

The result of the delete.

bucket *string

The bucket name.

path *string

The object's path in the bucket.

deleted *boolean

True when an object existed at the path and was deleted; false when there was nothing to delete.

meta *any

Request metadata: cost, timing and correlation ids.

TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.from('<collection>').remove()

Showing example in TypeScript

Response example (200)
{
  "data": {
    "bucket": "string",
    "path": "string",
    "deleted": false
  }
}

More in Storage & Schema