Help Center/ Elastic Cloud Server/ API Reference/ APIs/ Recycle Bin Management/ Querying the Recycle Bin Configuration
Updated on 2026-08-14 GMT+08:00

Querying the Recycle Bin Configuration

Function

This API is used to query the recycle bin configuration.

Constraints

This function is only available in the following regions: CN North-Beijing4, CN North-Ulanqab1, CN East-Shanghai1, CN South-Guangzhou, CN South-Guangzhou-InvitationOnly, CN Southwest-Guiyang1, and AP-Singapore.

Debugging

You can debug this API in API Explorer.

Authorization

Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.
  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the permissions listed below are required.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

ecs:recycleBin:get

read

-

-

-

-

URI

GET /v1/{project_id}/recycle-bin

Table 1 describes the parameters in the URI.

Table 1 Path parameter

Parameter

Mandatory

Description

project_id

Yes

Definition

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request

None.

Response

Table 2 describes the response parameter.

Table 2 Response parameters

Parameter

Type

Description

project_id

String

Definition

Specifies the project ID.

Range

N/A

switch

String

Definition

Specifies whether the recycle bin is enabled.

Range

  • on: The recycle bin is enabled.
  • off: The recycle bin is disabled.

policy

Object

Definition

Specifies the recycle bin policy. For details, see Table 3.

Range

N/A

Table 3 policy parameters

Parameter

Type

Description

recycle_threshold_day

Integer

Definition

Specifies how long an instance can be moved to the recycle bin after it is created.

Range

An integer greater than or equal to 0

retention_hour

Integer

Definition

Specifies how long an instance can be retained in the recycle bin before being permanently deleted.

Range

An integer greater than or equal to 0

Example Request

Query the recycle bin configuration.

GET https://{endpoint}/v1/{project_id}/recycle-bin

Example Response

{
	"project_id": "74d4d6ac2da84aa5bdc6fed4efc20413",
	"switch": "off",
	"policy": {
		"recycle_threshold_day": 8,
		"retention_hour": 8
	}
}

Error Codes

See Error Codes.