> 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/describebilldetail.md).

# DescribeBillDetail

## 1. 接口描述

本接口(DescribeBillDetail)用于获取月账单明细相关数据信息（包含月账单总费用等信息），支持按订单或资源ID筛选。

## 2. 请求参数

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

| 参数名称        | 必选 | 类型      | 描述                                                                   |
| ----------- | -- | ------- | -------------------------------------------------------------------- |
| billMonthly | 否  | Integer | <p>账单月份，默认当前月。</p><p>格式yyyyMM。</p>                                   |
| pageSize    | 否  | Integer | <p>每页大小，不能超过5000，超过5000返回5000条。</p><p>可选值范围：\[1, +)</p><p>默认值：20</p> |
| pageNum     | 否  | Integer | <p>页码，默认1。</p><p>可选值范围：\[1, +)</p><p>默认值：1</p>                       |
| resourceId  | 否  | String  | 资源ID（实例ID）。                                                          |
| orderSn     | 否  | String  | 订单号。                                                                 |
| product     | 否  | String  | 产品名称。                                                                |

## 3. 响应结果

| 参数名称         | 类型                                                                                                      | 描述                                                       |
| ------------ | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| requestId    | String                                                                                                  | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| totalCount   | Integer                                                                                                 | 符合条件的数据总数。                                               |
| dataSet      | Array of [BillingDetailInfo](/api-reference/cn/platform-service/zbc/datastructure.md#billingdetailinfo) | 结果集。                                                     |
| totalSpend   | Float                                                                                                   | 总支出。                                                     |
| totalVoucher | Float                                                                                                   | 代金券总支付金额。                                                |
| totalCash    | Float                                                                                                   | 现金总支付金额。                                                 |
| totalRefund  | Float                                                                                                   | 退款总金额。                                                   |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 按资源 ID 查询指定月份的账单明细。**

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

Request:
  {
    "billMonthly": 202307,
    "resourceId": "945345672712820433",
    "pageNum": 1,
    "pageSize": 2
  }

Response:
  {
    "requestId": "T2A96D54A-6A16-41B7-A991-A6691B4F32BA",
    "response": {
      "requestId": "T2A96D54A-6A16-41B7-A991-A6691B4F32BA",
      "totalSpend": 16114.870000,
      "totalVoucher": 306.320000,
      "totalCash": 24024.280000,
      "totalRefund": 8215.730000,
      "totalCount": 122,
      "dataSet": [
        {
          "billMonthly": 202307,
          "label": "M9Y-AMS-D-01",
          "resourceId": "938831989325181400",
          "product": "Compute",
          "productSubitem": "Bare Metal Instance",
          "billingMode": "Time pricing",
          "location": "AMS-D",
          "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
          "resourceGroupName": "Default Resource Group",
          "orderSn": "938832035772898264",
          "deductionTime": "2023-07-21T02:00:00Z",
          "startTime": "2023-07-19T08:17:33Z",
          "endTime": "2023-07-21T02:30:16Z",
          "amount": 83.260000,
          "voucher": 40.410000,
          "cash": 42.850000
        },
        {
          "billMonthly": 202307,
          "label": "98.96.193.64/29",
          "resourceId": "938125503838038232",
          "product": "Compute",
          "productSubitem": "Public Virtual Interface",
          "billingMode": "Time pricing",
          "location": "DFW2A",
          "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
          "resourceGroupName": "Default Resource Group",
          "orderSn": "938125516571936216",
          "deductionTime": "2023-07-31T23:00:00Z",
          "startTime": "2023-07-18T09:00:00Z",
          "endTime": "2023-07-31T23:59:59Z",
          "amount": 6.240000,
          "voucher": 1.820000,
          "cash": 4.420000
        }
      ]
    }
  }
```

**2. 按产品筛选，使用默认分页与默认月份。**

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

Request:
  {
    "product": "Compute"
  }

Response:
  {
    "requestId": "TB63F0A2D-8E14-4C97-A5B0-3D9F2E6C81A7",
    "response": {
      "requestId": "TB63F0A2D-8E14-4C97-A5B0-3D9F2E6C81A7",
      "totalSpend": 1204.500000,
      "totalVoucher": 100.000000,
      "totalCash": 1304.500000,
      "totalRefund": 0.000000,
      "totalCount": 1,
      "dataSet": [
        {
          "billMonthly": 202408,
          "label": "M9Y-AMS-D-02",
          "resourceId": "945345672712820433",
          "product": "Compute",
          "productSubitem": "Bare Metal Instance",
          "billingMode": "Time pricing",
          "location": "AMS-D",
          "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
          "resourceGroupName": "Default Resource Group",
          "orderSn": "945345699112820433",
          "deductionTime": "2024-08-01T02:00:00Z",
          "startTime": "2024-08-01T00:00:00Z",
          "endTime": "2024-08-31T23:59:59Z",
          "amount": 1304.500000,
          "voucher": 100.000000,
          "cash": 1204.500000
        }
      ]
    }
  }
```

{% 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状态码 | 错误码 | 说明 |
| ------- | --- | -- |
