tencent cloud

Feedback

DescribeBillDetail

Last updated: 2024-12-03 10:23:38

    1. API Description

    Domain name for API request: billing.intl.tencentcloudapi.com.

    u200cThis API is used to get bill details.
    Note:

    1. The API request may fail due to network instability or other exceptions. In this case, we recommend you manually retry the request when the API request fails.
      2.If the volume of your bill data is high (for example, if over 200 thousand bill entries are generated for a month), bill data query via APIs may be slow. We recommend you enable bill storage so that you can obtain bill files from COS buckets for analysis. For details, see Saving Bills to COS.

    A maximum of 5 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: DescribeBillDetail.
    Version Yes String Common Params. The value used for this API: 2018-07-09.
    Region No String Common Params. This parameter is not required.
    Offset Yes Integer Offset
    Limit Yes Integer Quantity, maximum is 100
    Month No String Month; format: yyyy-mm. You only have to enter either Month or BeginTime and EndTime. When you enter values for BeginTime and EndTime, Month becomes invalid. This value must be no earlier than the month when Bill 2.0 is activated; last 24 months data are available.
    BeginTime No String The start time of the query range, which should be in the format Y-m-d H:i:s . The query range must be in the last 18 months and cannot be earlier than May 2018 (when Bill 2.0 was introduced). The start time and end time must be in the same month.

    Example: tccli billing DescribeBillDetail --cli-unfold-argument --Offset 1 --Limit 100 --BeginTime '2023-04-01 12:05:15' --EndTime '2023-04-18 12:00:10' --ProjectId 1000000731 --version "2018-07-09"

    Alternatively, you can use Month to query the billing details of a month.
    Example:
    ccli billing DescribeBillDetail --cli-unfold-argument --Offset 1 --Limit 100 --Month 2023-04 --version "2018-07-09" --ResourceId "disk-oj9okstm"
    EndTime No String The end time of the query range, which should be in the format Y-m-d H:i:s . The query range must be in the last 18 months and cannot be earlier than May 2018 (when Bill 2.0 was introduced). The start time and end time must be in the same month.

    Example: tccli billing DescribeBillDetail --cli-unfold-argument --Offset 1 --Limit 100 --BeginTime '2023-04-01 12:05:15' --EndTime '2023-04-18 12:00:10' --ProjectId 1000000731 --version "2018-07-09"

    Alternatively, you can use Month to query the billing details of a month.
    Example:
    ccli billing DescribeBillDetail --cli-unfold-argument --Offset 1 --Limit 100 --Month 2023-04 --version "2018-07-09" --ResourceId "disk-oj9okstm"
    NeedRecordNum No Integer Indicates whether or not the total number of records of accessing the list is required, used for frontend pages.
    1 = yes, 0 = no
    ProductCode No String Queries information on a specified product
    PayMode No String Billing mode: prePay/postPay
    ResourceId No String Queries information on a specified resource
    ActionType No String Hourly settlement
    Daily settlement
    Monthly settlement
    Spot
    New monthly subscription
    Monthly subscription renewal
    Monthly subscription specification adjustment
    Monthly subscription refund
    Adjustment - deduction
    Adjustment - refund
    Hourly RI fee
    One-off RI Fee
    Hourly Savings Plan fee
    Offline project deduction
    Offline product deduction
    ProjectId No Integer Project ID: ID of the project to which the resource belongs
    BusinessCode No String Product code
    Note: To query the product codes used in the current month, call DescribeBillSummaryByProduct.
    Context No String Context information returned by the last request. You can set Month to 2023-05 or later to accelerate queries. We recommend users whose data volume is over 100 thousand entries use the paginated query feature, which can help greatly speed up your queries.
    PayerUin No String The account ID of the payer, which is the unique identifier of a Tencent Cloud user. This account is allowed to query its own bills by default. If an organization admin account needs to query the self-pay bills of members, this field should be specified as the member account ID.

    3. Output Parameters

    Parameter Name Type Description
    DetailSet Array of BillDetail Details list
    Total Integer
    Note: This field may return null, indicating that no valid values can be obtained.
    Context String Note: This field may return null, indicating that no valid values can be obtained.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Getting Bill Details

    This example shows you how to get bill details.

    Input Example

    POST / HTTP/1.1
    Host: billing.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeBillDetail
    <Common request parameters>{
        "Offset": 0,
        "Limit": 1,
        "Month": "2023-07",
        "NeedRecordNum": 1,
        "ResourceId": "ins-wxf3fmq8"
    }
    

    Output Example

    {
        "Response": {
            "Context": "m7u3i6W6Xt6VmK1NGvNzCXEBwkmoH/Y3ROhw2ICs3RkxMDTe6z/M5dFHpIoeEc+MOBKEhnly44tsqyRJRRL0ZNpmtARd8SDzLfknCLcJtVkf6NJGoV8FXlYLQxABqcSt",
            "DetailSet": [
                {
                    "ActionType": "pre_to_post",
                    "ActionTypeName": "Monthly subscription to pay-as-you-go",
                    "AssociatedOrder": {
                        "PrepayPurchase": "20230707400000442656611",
                        "PrepayRenew": "20230707400000442695851,20230707400000442708571"
                    },
                    "BillDay": "2023-07-17 00:00:00",
                    "BillId": "20230707400000442821061",
                    "BusinessCode": "p_cvm",
                    "BusinessCodeName": "Cloud Virtual Machine CVM",
                    "BillMonth": "2023-07-01 00:00:00",
                    "ComponentSet": [
                        {
                            "BlendedDiscount": "1.00000000",
                            "CashPayAmount": "-80.43264806",
                            "ComponentCode": "virtual_v_cvm_compute",
                            "ComponentCodeName": "Computing components",
                            "ComponentConfig": [
                                {
                                    "Name": "Project",
                                    "Value": "element_test"
                                },
                                {
                                    "Name": "Host",
                                    "Value": "ins-wxf3fmq8"
                                },
                                {
                                    "Name": "Private IP address",
                                    "Value": "10.12.0.42"
                                },
                                {
                                    "Name": "Network",
                                    "Value": "Virtual Private Cloud"
                                },
                                {
                                    "Name": "Availability zone",
                                    "Value": "Guangzhou zone 2"
                                }
                            ],
                            "ContractPrice": "-80.89000000",
                            "Cost": "-80.89000000",
                            "DeductedMeasure": "-",
                            "Discount": "1",
                            "IncentivePayAmount": "-0.45735194",
                            "InstanceType": "",
                            "ItemCode": "virtual_v_cvm_compute_s2",
                            "ItemCodeName": "Computing components-Standard S2-2-Core 4 GB",
                            "OriginalCostWithRI": "0.00000000",
                            "OriginalCostWithSP": "0.00000000",
                            "PriceUnit": "CNY/unit/month",
                            "RealCost": "-80.89000000",
                            "RealTotalMeasure": "-",
                            "ReduceType": "Discount",
                            "RiTimeSpan": "0.00000000",
                            "SPDeduction": "0.00000000",
                            "SPDeductionRate": "0.00000000",
                            "SinglePrice": "-80.89000000",
                            "SpecifiedPrice": "-80.89000000",
                            "TimeSpan": "1",
                            "TimeUnitName": "Month",
                            "TransferPayAmount": "0",
                            "UsedAmount": "1",
                            "UsedAmountUnit": "unit",
                            "VoucherPayAmount": "0"
                        }
                    ],
                    "FeeBeginTime": "2023-07-07 16:14:21",
                    "FeeEndTime": "2023-07-07 16:14:21",
                    "Formula": "Refund: 343.12 CNY, cash voucher: 0 CNY, vouchers/discount vouchers are not refundable (order number 20230707400000442656611: component cvm: cash payment 88.81 CNY-used tier 1 pay-as-you-go: 0.02 CNY=remaining 88.79 CNY; order number 20230707400000442656611: component bandwidth: cash payment 0 CNY=remaining 0 CNY; order number 20230707400000442695851: component cvm: cash payment 172.92 CNY=remaining 172.92 CNY; order number 20230707400000442695851: component bandwidth: cash payment 0 CNY=remaining 0 CNY; order number 20230707400000442708571: component cvm: cash payment 84.12 CNY-original price 95.6* usage time 3.2258%*discount:88=remaining 81.41 CNY;",
                    "FormulaUrl": "https://buy.tencentcloud.com/price/cvm",
                    "Id": "1725547686519644160",
                    "OperateUin": "909619400",
                    "OrderId": "20230707400000442821061",
                    "OwnerUin": "909619400",
                    "PayModeName": "Monthly subscription",
                    "PayTime": "2023-07-07 16:14:18",
                    "PayerUin": "909619400",
                    "PriceInfo": [
                        "Operating system: linux",
                        "Continuous usage time T: no tiers",
                        "Platform: Yunping"
                    ],
                    "ProductCode": "sp_cvm_s2",
                    "ProductCodeName": "Cloud Virtual Machine CVM-Standard S2",
                    "ProjectId": 1002227,
                    "ProjectName": "element_test",
                    "RegionId": "1",
                    "RegionName": "South China (Guangzhou)",
                    "ResourceId": "ins-wxf3fmq8",
                    "ResourceName": "",
                    "Tags": [],
                    "ZoneName": "Guangzhou zone 2"
                }
            ],
            "RequestId": "ca7573cb-473d-40f3-8c58-7be43ae60195",
            "Total": 14
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.QueryCountFailed Failed to get the number of data entries.
    InternalError Internal error.
    InternalError.GatewayError Gateway error.
    InternalError.UnknownError Undefined exception.
    InvalidParameter Invalid parameter.
    InvalidParameterValue Invalid parameter value.
    UnsupportedOperation Operation unsupported.