> 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/platform-service/zbc/bill/describebilldetail.md). Agents can also search and read this documentation through its [MCP server](https://docs.console.zenlayer.com/api-reference/~gitbook/mcp).

# DescribeBillDetail

## 1. API Description

This API (DescribeBillDetail) is used to queries the monthly bill details, including the total monthly bill amount, and supports filtering by order or resource ID.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type    | Description                                                                                                                                                |
| -------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| billMonthly    | No       | Integer | <p>Bill month. Defaults to the current month.</p><p>Format: yyyyMM.</p>                                                                                    |
| pageSize       | No       | Integer | <p>Number of records per page. It cannot exceed 5000. Values greater than 5000 are handled as 5000.</p><p>Value range: \[1, +)</p><p>Default value: 20</p> |
| pageNum        | No       | Integer | <p>Page number. Defaults to 1.</p><p>Value range: \[1, +)</p><p>Default value: 1</p>                                                                       |
| resourceId     | No       | String  | Resource ID (instance ID).                                                                                                                                 |
| orderSn        | No       | String  | Order number.                                                                                                                                              |
| product        | No       | String  | Product name.                                                                                                                                              |

## 3. Output Parameters

| Parameter Name | Type                                                                                                                                  | Description                                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String                                                                                                                                | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |
| totalCount     | Integer                                                                                                                               | Total number of records that match the query conditions.                                                              |
| dataSet        | Array of [BillingDetailInfo](https://docs.console.zenlayer.com/api-reference/platform-service/zbc/datastructure.md#billingdetailinfo) | Result set.                                                                                                           |
| totalSpend     | Float                                                                                                                                 | Total spend.                                                                                                          |
| totalVoucher   | Float                                                                                                                                 | Total amount paid with vouchers.                                                                                      |
| totalCash      | Float                                                                                                                                 | Total amount paid in cash.                                                                                            |
| totalRefund    | Float                                                                                                                                 | Total refund amount.                                                                                                  |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Query the bill details of a specified month by resource 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. Filter by product, using the default pagination and the default month.**

```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. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk.md)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code | Description |
| ---------------- | ---------- | ----------- |
