All Products
Search
Document Center

Resource Management:GetResourceCounts

Last Updated:Dec 23, 2025

Queries the number of resources in your account that you have permission to access.

Operation description

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

GroupByKey

string

No

The dimension by which the resource count is grouped. Valid values:

  • ResourceType: The resource type.

  • RegionId: The region.

  • ResourceGroupId: The resource group ID.

ResourceType

Filter

array<object>

No

The filter conditions.

object

No

A filter condition.

Key

string

No

The key of the filter condition. For valid values, see Supported filter parameters.

RegionId

MatchType

string

No

The match type.

The value must be Equals, which indicates an exact match.

Equals

Value

array

No

The value of the filter condition.

string

No

The value of the filter condition.

cn-shanghai

Supported filter parameters

ParameterDescriptionSupported match types
ResourceTypeThe resource type.Equals
RegionIdThe region ID.Equals
ResourceIdThe resource ID.Equals, Prefix
ResourceGroupIdThe resource group ID.Equals, Exists, NotExists
ResourceNameThe resource name.Equals, Contains
TagThe key-value pair of a tag. The value is a JSON string in the { "key": $key, "value": $value } format. You must specify at least one of `key` and `value`. For example, to query for the tag key foo and tag value bar, pass { "key": "foo", "value": "bar" }. To query for only the tag key foo, pass { "key": "foo" }.Contains, NotContains, NotExists
VpcIdThe VPC ID.Equals
VSwitchIdThe vSwitch ID.Equals

Response elements

Element

Type

Description

Example

object

The response parameters.

Filters

array<object>

The filter conditions.

object

A filter condition.

Key

string

The key of the filter condition.

RegionId

Values

array

The values of the filter condition.

string

The value of the filter condition.

cn-shanghai

GroupByKey

string

The dimension by which the resources are grouped.

ResourceType

RequestId

string

The request ID.

6D98D9B0-318D-56A4-910C-93B5F945AF2B

ResourceCounts

array<object>

The list of resource counts.

object

The resource count.

Count

integer

The number of resources.

2

GroupName

string

The group name.

ACS::ECS::NetworkInterface

Examples

Success response

JSON format

{
  "Filters": [
    {
      "Key": "RegionId",
      "Values": [
        "cn-shanghai"
      ]
    }
  ],
  "GroupByKey": "ResourceType",
  "RequestId": "6D98D9B0-318D-56A4-910C-93B5F945AF2B",
  "ResourceCounts": [
    {
      "Count": 2,
      "GroupName": "ACS::ECS::NetworkInterface"
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.Filter.ResourceType The specified parameter value of Filter.ResourceType is not valid.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.