# Delete Object

`DELETE /storage/buckets/{bucketName}/objects` · Core · Storage & Schema

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

| Name | In | Required | Description |
|---|---|---|---|
| `bucketName` | path | yes | The bucket's name. It is unique within the project. Example: `"product-images"`. |
| `path` | query | yes | The path of the object to delete. |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | The result of the delete. |
| `data.bucket` | string | yes | The bucket name. |
| `data.path` | string | yes | The object's path in the bucket. |
| `data.deleted` | boolean | yes | True when an object existed at the path and was deleted; false when there was nothing to delete. |
| `meta` | object | yes | Request metadata: cost, timing and correlation ids. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_UNAUTHENTICATED` | Authentication is required. |
| 403 | `K9O_RBAC_DENY` | The caller's project role does not permit this object operation. |
| 404 | `K9O_BUCKET_NOT_FOUND` | No bucket with this name exists in the project. |
| 403 | `K9O_ACCESS_DENIED` | The 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. |

## Code samples

### cURL

```bash
curl -X DELETE 'https://<org>.api-<region>.k9o.io/@storefront/storage/buckets/product-images/objects' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/storage/buckets/product-images/objects', {
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`
  },
});
const { data, meta } = await res.json();
```

### @k9o/core

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

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.from_("<collection>").remove()
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.From("<collection>").Remove()
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.from("<collection>").remove().await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.from("<collection>").remove()
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.From("<collection>").RemoveAsync()
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.from("<collection>").remove()
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->from('<collection>')->remove()
```

### K9o

```swift
// let k9o = try K9o.createClient(orgSlug: "playground", projectSlug: "storefront", apiKey: "k9o_…")
let result = try await k9o.from("<collection>").remove()
```

### core-kotlin

```kotlin
// val k9o = createClient { orgSlug = "playground"; projectSlug = "storefront"; apiKey = "k9o_…" }
val result = k9o.from("<collection>").remove()
```

### k9o (Flutter)

```dart
// final k9o = K9o.createClient(orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…');
final result = await k9o.from('<collection>').remove()
```

### @k9o/react-native

```javascript
// const k9o = createClient({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })  // RN, secure storage
const { data } = await k9o.from('<collection>').remove()
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/delete-object
