tencent cloud

Cloud Object Storage

Deleting Objects

PDF
Focus Mode
Font Size
Last updated: 2026-02-05 10:48:09

Introduction

This document provides an overview of APIs related to object deletion operations, as well as SDK sample code.
Note:
Once an object is deleted, its corresponding data will no longer be accessible. Please proceed with caution.
API
Operation Name
Operation Description
Deleting an Object
Delete a specified object from a bucket.

Deleting an Object

Feature Overview

Delete the specified object (DELETE Object).

Example Code

// Bucket name, which consists of bucketname-appid (appid must be included), can be viewed in the COS console. https://console.tencentcloud.com/cos5/bucket
let bucket = "examplebucket-1250000000";
//The location identifier of an object in a bucket, also known as the object key
let cosPath = "exampleobject.txt";

let request = new DeleteObjectRequest(bucket, cosPath);
try {
let result = await CosXmlBaseService.default().deleteObject(request)
// The result includes http headers, etc.
} catch (e) {
// Exception handling
}


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback