All Products
Search
Document Center

Expenses and Costs:QueryCostUnitResource

Last Updated:Sep 08, 2026

Queries the list of resource instances that belong to a financial unit of a user. When UnitId is set to 0, the query returns unallocated primary and sub-resource instances.

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

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

bss:QueryCostUnitResource

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

OwnerUid

integer

Yes

The user ID of the financial unit owner.

23453245

UnitId

integer

Yes

The ID of the financial unit.

235325

PageNum

integer

No

The page number.

1

PageSize

integer

No

The number of entries per page.

20

Response elements

Element

Type

Description

Example

object

Code

string

The status code.

Success

Data

object

The returned data.

CostUnit

object

The financial unit information.

OwnerUid

integer

The user ID of the financial unit owner.

321432

ParentUnitId

integer

The ID of the parent financial unit. A value of -1 indicates the root financial unit.

23421

UnitId

integer

The ID of the financial unit.

123412

UnitName

string

The name of the financial unit.

test

CostUnitStatisInfo

object

The statistics information of the financial unit.

ResourceCount

integer

The number of resource instances in the current financial unit.

1

ResourceGroupCount

integer

The number of resource groups in the current financial unit.

1

SubUnitCount

integer

The number of sub-units in the current financial unit.

2

TotalResourceCount

integer

The total number of resource instances in the current financial unit, including those in sub-financial units.

3

TotalResourceGroupCount

integer

The total number of resource groups in the current financial unit, including those in sub-financial units.

2

TotalUserCount

integer

The total number of linked accounts in the current financial unit, including those in sub-financial units.

2

UserCount

integer

The number of sub-units in the current financial unit.

0

PageNum

integer

The page number.

1

PageSize

integer

The number of entries per page.

20

ResourceInstanceDtoList

array<object>

The list of resource instances.

object

ApportionCode

string

The attached resource code.

test

ApportionName

string

The attached resource name.

test

CommodityCode

string

The commodity code of the resource.

rds

CommodityName

string

The commodity name of the resource.

ApsaraDB

PipCode

string

The product code, which is the same as the product code in User Center bills.

rds

RelatedResources

string

The resources related to the resource instance.

oss

ResourceGroup

string

The resource group to which the resource belongs.

Default resource group

ResourceId

string

The instance ID of the resource.

OSSBAG-cn-v0h1s4hma018

ResourceNick

string

The custom nickname of the resource.

testResource

ResourceSource

string

The source of the resource. Valid values:

  • AUTO_ALLOCATE: automatic allocation.

  • MANUAL_ALLOCATE: manual allocation.

MANUAL_ALLOCATE

ResourceStatus

string

The status of the resource.

Available

ResourceTag

string

The tag of the resource.

testResource

ResourceType

string

The type of the resource.

FPT_ossbag_absolute_Storage_bj

ResourceUserId

integer

The user ID of the resource owner.

2424242134

ResourceUserName

string

The username of the resource owner.

test@test.aliyun.com

TotalCount

integer

The total number of records.

12

Message

string

The error message.

Successful!

RequestId

string

The request ID.

04332CB7-9A57-4461-97E0-02821D044414

Success

boolean

Indicates whether the request was successful.

true

Examples

Success response

JSON format

{
  "Code": "Success",
  "Data": {
    "CostUnit": {
      "OwnerUid": 321432,
      "ParentUnitId": 23421,
      "UnitId": 123412,
      "UnitName": "test"
    },
    "CostUnitStatisInfo": {
      "ResourceCount": 1,
      "ResourceGroupCount": 1,
      "SubUnitCount": 2,
      "TotalResourceCount": 3,
      "TotalResourceGroupCount": 2,
      "TotalUserCount": 2,
      "UserCount": 0
    },
    "PageNum": 1,
    "PageSize": 20,
    "ResourceInstanceDtoList": [
      {
        "ApportionCode": "test",
        "ApportionName": "test",
        "CommodityCode": "rds",
        "CommodityName": "ApsaraDB\n",
        "PipCode": "rds",
        "RelatedResources": "oss",
        "ResourceGroup": "Default Resource Group\n",
        "ResourceId": "OSSBAG-cn-v0h1s4hma018",
        "ResourceNick": "testResource",
        "ResourceSource": "MANUAL_ALLOCATE",
        "ResourceStatus": "Available",
        "ResourceTag": "testResource",
        "ResourceType": "FPT_ossbag_absolute_Storage_bj",
        "ResourceUserId": 2424242134,
        "ResourceUserName": "test@test.aliyun.com"
      }
    ],
    "TotalCount": 12
  },
  "Message": "Successful!",
  "RequestId": "04332CB7-9A57-4461-97E0-02821D044414",
  "Success": true
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.