---
title: "Delete Objects"
url: https://docs.catalyst.zoho.com/en/sdk/java/v1/cloud-scale/stratus/delete-objects/
description: "This page lists the Java SDK method to delete objects stores in a bucket."
last_updated: 2026-09-08T11:07:33Z
service: Cloud Scale
type: general
related_links:
- name: "Stratus Component Help Documentation"
url: /en/cloud-scale/help/stratus/introduction
- name: "Delete an Object Help Documentation"
url: /en/cloud-scale/help/stratus/objects/manage-object/delete-object/
- name: "JavaScript SDK Documentation"
url: /en/sdk/javascript/v1/cloudscale/stratus/delete-object/
- name: "Python SDK"
url: /en/sdk/python/v1/cloud-scale/stratus/delete-objects/
- name: "iOS SDK"
url: /en/sdk/ios/v2/cloud-scale/stratus/delete-object/
- name: "Android SDK"
url: /en/sdk/android/v2/cloud-scale/stratus/delete-object/
- name: "Flutter SDK"
url: /en/sdk/flutter/v2/cloud-scale/stratus/delete-object/
- name: "REST API"
url: /en/api/code-reference/cloud-scale/stratus/get-all-buckets/#GetAllBuckets
---
# Delete Objects
The following SDK methods will allow you to perform delete operations in Stratus. The Bucket reference used in the below code snippet is the [component instance](https://docs.catalyst.zoho.com/en/sdk/java/v1/cloud-scale/stratus/create-bucket-instance/).
> **Info:** To use this SDK method, you need intialize it with **Admin** scope. You can learn more about this requirement from this [section](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/overview/#initialize-sdk-with-scopes)
**Parameters Used**
| Parameter Name |
Data Type |
Definition |
| `key` |
**String** |
A **Mandatory** parameter. Will hold the complete name of the object along with it's [path](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/objects/introduction/#path). |
| `versionId` |
**String** |
An **Optional** parameter. If [Versioning](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/stratus-config/general-settings/#versioning) is enabled for your bucket then, this param will help you refer to a particular version using its unique Version ID. |
| `ttl` |
**int** |
An **Optional** parameter. It allows you to schedule your delete operations. For example, if you provide the value of `ttl` as **60**, the delete operation will only occur after 60 seconds. The value of `ttl` has to be >= 60 seconds. |
### Delete a Single Object
Using this SDK method, you can delete a particular object by passing the object name to the `deleteObject()` method.
> **Info:** To use this SDK method, you need intialize it with **Admin** scope. You can learn more about this requirement from this [section](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/overview/#initialize-sdk-with-scopes)
#### Sample Code Snippet
**Package Imports**
```java
import org.json.simple.JSONObject;
```
```java
int ttl = 200; //time to live in seconds
JSONObject deleteRes = bucket.deleteObject("sam/out/sample.txt", "versionId", ttl);
System.out.println(deleteRes);
```
> **Note:** If [Versioning](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/stratus-config/general-settings/#versioning) is enabled on the bucket and no specific `versionId` is provided, deleting an object will **remove all versions** of that object by default.
### Delete Multiple Objects
Using this SDK method, you can delete multiple objects by passing the names of the objects that need to be deleted as an array.
> **Info:** To use this SDK method, you need intialize it with **Admin** scope. You can learn more about this requirement from this [section](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/overview/#initialize-sdk-with-scopes)
Ensure you provide the `versionId` of the object if you enabled [Versioning](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/stratus-config/general-settings/#versioning) for your bucket. You can also schedule your delete operation using the `ttl` variable. For example, if you provide the value of `ttl` as **60**, the delete operation will only occur after **60 seconds**.
#### Sample Code Snippet
**Package Imports**
```java
import com.zc.component.stratus.beans.ZCDeleteObjectRequest;
import org.json.simple.JSONObject;
```
```java
ZCDeleteObjectRequest deleteRequest = ZCDeleteObjectRequest.getInstance();
deleteRequest.setObject("sam/out/sample.txt", "76dhe7yr738rud");
deleteRequest.setObject("sam/out/add.txt", "cjdhf73673g7yt7d");
deleteRequest.setTTL(70);
JSONObject res = bucket.deleteObjects(deleteRequest);
System.out.println(res);
```
### Truncate Bucket
Using this SDK method you will be able to essentially every single object present in the bucket.
> **Info:** To use this SDK method, you need intialize it with **Admin** scope. You can learn more about this requirement from this [section](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/overview/#initialize-sdk-with-scopes)
#### Sample Code Snippet
**Package Imports**
```java
import org.json.simple.JSONObject;
```
```java
JSONObject truncateRes = bucket.truncate();
System.out.println(truncateRes);
```
### Delete a Path in the Bucket
Using this SDK, you will be able to delete all the objects present in a [path](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/objects/introduction/#path). You need to pass the complete path to the `deletePath()` method.
> **Info:** To use this SDK method, you need intialize it with **Admin** scope. You can learn more about this requirement from this [section](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/overview/#initialize-sdk-with-scopes)
#### Sample Code Snippet
**Package Imports**
```java
import org.json.simple.JSONObject;
```
```java
JSONObject res = bucket.deletePath("sam/");
System.out.println(res);
```
> **Note:** Ensure that you provide the exact path. If an incorrect path is provided, the delete action will get scheduled, but it will result in an error.