--- title: "Check Object Availability" url: https://docs.catalyst.zoho.com/en/sdk/java/v1/cloud-scale/stratus/check-object-availability/ description: "This page lists the Java SDK method to check if an object is present 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: "Objects Help Documentation" url: /en/cloud-scale/help/stratus/objects/introduction/ - name: "JavaScript SDK Documentation" url: /en/sdk/javascript/v1/cloudscale/stratus/rename-move/ - name: "Python SDK" url: /en/sdk/python/v1/cloud-scale/stratus/check-object-availability/ - name: "iOS SDK" url: /en/sdk/ios/v2/cloud-scale/stratus/overview/ - name: "Android SDK" url: /en/sdk/android/v2/cloud-scale/stratus/overview/ - name: "Flutter SDK" url: /en/sdk/flutter/v2/cloud-scale/stratus/overview/ - name: "REST API" url: /en/api/code-reference/cloud-scale/stratus/get-all-buckets/#GetAllBuckets --- # Check Object Availability Using this SDK method, you can check if a particular object is present in the bucket, if the user has the required permissions to access the object. 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) If you have enabled [Versioning](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/stratus-config/general-settings/#versioning) for your bucket, then you need to pass the `versionID` as the param, to check if a particular version of the object is available. When you use this SDK method, you will get either of the following responses: - `true`: If the object is available, the specified version is available, and if the user has the relevant permissions to access the objects. - `false`: - If the object or the particular version of the object is not available in the bucket. - If the user does not have the required permissions to access the object. - If the bucket does not exist. **Parameters Used**
Parameter Name Data Type Definition
`key` **String** A **Mandatory** parameter. Will hold the complete name of the object.
`versionId` **String** An **Optional** parameter. Will hold the unique version ID of the object, if [Versioning](https://docs.catalyst.zoho.com/en/cloud-scale/help/stratus/stratus-config/general-settings/#versioning) is enabled.
`throwErr` **Boolean** An **Optional** parameter. If you set this parameter as "**true**", then it will throw an error when the object is not found in the project. The default value is "**false**"
```java Boolean throwErr = true; Boolean headObjectRes = bucket.headObject("sam/out/sample.txt", "versionId", throwErr); System.out.println(headObjectRes); ``` **Possible Errors** > **Note:** If you use the SDK with the `throw_err` parameter, and the object does not exist, or if you do not have sufficient permissions then you may encounter any of the errors listed below.
Error Code Meaning
`404` Not Found. Object Not found.
`401` Unauthorized/Access Denied - User doesn't have permission to perform the particular operation.
`403` Permission Denied - User does not have permission to access the particular object.