> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/platform-service/zbc/bill/describemonthlybillsummary.md).

# DescribeMonthlyBillSummary

## 1. 接口描述

本接口(DescribeMonthlyBillSummary)用于获取产品或资源组维度月账单汇总金额信息以及账单总帐信息。

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称        | 必选 | 类型                                                                                 | 描述                 |
| ----------- | -- | ---------------------------------------------------------------------------------- | ------------------ |
| billMonthly | 否  | Integer                                                                            | 账单月份，默认当前月。        |
| summaryType | 否  | [SummaryType](/api-reference/cn/platform-service/zbc/datastructure.md#summarytype) | 账单分组维度，默认 PRODUCT。 |

## 3. 响应结果

| 参数名称            | 类型                                                                                                        | 描述                                                       |
| --------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| requestId       | String                                                                                                    | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| billMonthly     | Integer                                                                                                   | 账单月份。                                                    |
| totalSpend      | Float                                                                                                     | 总支出。                                                     |
| totalVoucher    | Float                                                                                                     | 代金券总支付金额。                                                |
| totalCash       | Float                                                                                                     | 现金总支付金额。                                                 |
| totalRefund     | Float                                                                                                     | 退款总金额。                                                   |
| summaryInfoList | Array of [MonthlyBillSummary](/api-reference/cn/platform-service/zbc/datastructure.md#monthlybillsummary) | 账单分组列表。                                                  |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 按资源组维度查询指定月份的账单汇总。**

```json
POST /api/v2/zbc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeMonthlyBillSummary
<Common Request Params>

Request:
  {
    "billMonthly": 202307,
    "summaryType": "RESOURCE_GROUP"
  }

Response:
  {
    "requestId": "T7BAF1918-4900-4CBC-B2AD-08A11854DBDD",
    "response": {
      "requestId": "T7BAF1918-4900-4CBC-B2AD-08A11854DBDD",
      "billMonthly": 202307,
      "totalSpend": 3781.650000,
      "totalVoucher": 0.000000,
      "totalCash": 1732.650000,
      "totalRefund": 2049.000000,
      "summaryInfoList": [
        {
          "resourceGroupId": "29b4a7bd-b1c7-4f81-b2cb-d75084811ca9",
          "resourceGroupName": "Default Resource Group",
          "spend": 1732.650000,
          "voucher": 0.000000,
          "cash": 3781.650000,
          "refund": 2049.000000
        }
      ]
    }
  }
```

**2. 使用默认维度与默认月份查询。**

```json
POST /api/v2/zbc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeMonthlyBillSummary
<Common Request Params>

Request:
  {}

Response:
  {
    "requestId": "TA47C1E09-52B8-4D3F-91A6-7C0E5B82D164",
    "response": {
      "requestId": "TA47C1E09-52B8-4D3F-91A6-7C0E5B82D164",
      "billMonthly": 202408,
      "totalSpend": 1204.500000,
      "totalVoucher": 100.000000,
      "totalCash": 1104.500000,
      "totalRefund": 0.000000,
      "summaryInfoList": [
        {
          "product": "Compute",
          "spend": 1204.500000,
          "voucher": 100.000000,
          "cash": 1104.500000,
          "refund": 0.000000
        }
      ]
    }
  }
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码 | 说明 |
| ------- | --- | -- |
