tencent cloud

APIs

CreateHealthCheckTemplate

下载
聚焦模式
字号
最后更新时间: 2026-09-28 14:18:10

1. API Description

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

This API is used to create a health check Template.

A maximum of 20 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: CreateHealthCheckTemplate.
Version Yes String Common Params. The value used for this API: 2025-10-30.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
DryRun No Boolean Whether to preview this request.
- false (default): Send a normal request to directly modify the health check template.
- true: Send a preview request to check whether the parameters, format, and service limits of the health check template to modify meet the requirements.
HealthCheckCodes.N No Array of String Health check status code. Value:
- When the health check protocol is HTTP/HTTPS:
- http_1xx
- http_2xx (default value)
- http_3xx
- http_4xx
- http_5xx
- When the health check protocol is GRPC/GRPCS: the default value is 12, the value range is 0-99, and the input value can be a numerical value, multiple values, a range, or a composite, for example:
- "20"
- "0-99"
HealthCheckHealthyThreshold No Integer Threshold for determining backend service health. After the health check succeeds consecutively for this number of times, the backend service status changes from unhealthy to healthy.
Value range: 2-10.
Default value: 2.
HealthCheckHost No String Health check domain name.
Length limit: 1–255 characters.
It can contain lowercase letters, digits, dashes (-), and half-width periods (.).

> This parameter takes effect only when HealthCheckProtocol is set to HTTP/HTTPS/GRPC/GRPCS.
HealthCheckHttpVersion No String HTTP version for health check. Value:
- HTTP1.1 (default)
- HTTP1.0
> This parameter takes effect only when HealthCheckProtocol is set to HTTP or HTTPS.
HealthCheckInterval No Integer The interval of health check. Unit: second. Value range: 2-300. Default value: 5.
HealthCheckMethod No String Health check method. Valid values: - GET - HEAD (default value)
> This parameter takes effect only when HealthCheckProtocol is set to HTTP or HTTPS.
HealthCheckPath No String Forwarding rule path for health check. Length: 1-80 characters. Only can use letters, numbers, characters -/.%?#&= as well as extended characters _;~!()*[]@$^:',+. The URL must start with a forward slash (/).
> The forwarding rule path parameter takes effect only when HealthCheckProtocol is HTTP/HTTPS/GRPC/GRPCS.
HealthCheckPort No Integer Health check access to the backend server port. Value range: 0-65535. Default value: 0, which means the backend server port.
HealthCheckProtocol No String Health check protocol. Valid values:
- HTTP (default): Check whether the server application is healthy by sending HEAD or GET requests to simulate browser access requests.
- HTTPS: Check whether the server application is healthy by sending HEAD or GET requests to simulate browser access requests. (Data encryption, more secure compared with HTTP.)
- TCP: Detect whether the server port is alive by sending SYN handshake messages.
- GRPC: Check whether the server application is healthy by sending a POST or GET request.
- GRPCS: Check whether the server application is healthy by sending a POST or GET request.
HealthCheckTemplateName No String Health check template name. It must be 1-255 characters long and can contain digits, upper- and lower-case letters, Chinese characters, half-width periods (.), underscores (_), and dashes (-).
HealthCheckTimeout No Integer timeout period for the health check. Unit: seconds.
Valid values: 2-60.
Default value: 2.
HealthCheckUnhealthyThreshold No Integer Threshold for determining an unhealthy backend service. The backend service status changes from healthy to unhealthy after the health check fails consecutively for this number of times.
Value range: 2-10.
Default value: 2.
Tags.N No Array of TagInfo Tag.

3. Output Parameters

Parameter Name Type Description
HealthCheckTemplateId String Health check template ID. The format is hct- followed by alphanumeric characters. All APIs (create, query, modify, delete) use the hct- prefix.
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 Creating a Health Check Template

Input Example

POST / HTTP/1.1
Host: alb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateHealthCheckTemplate
<Common request parameters>

{
    "HealthCheckCodes": [
        "http_1xx"
    ],
    "HealthCheckHealthyThreshold": 2,
    "HealthCheckHost": "example.com",
    "HealthCheckHttpVersion": "HTTP1.1",
    "HealthCheckInterval": 10,
    "HealthCheckMethod": "GET",
    "HealthCheckPath": "/hello/index.html",
    "HealthCheckPort": 80,
    "HealthCheckProtocol": "HTTP",
    "HealthCheckTemplateName": "lbtg-0zrnc9qa-template",
    "HealthCheckTimeout": 2,
    "HealthCheckUnhealthyThreshold": 2,
    "Tags": [
        {
            "TagKey": "key-xxx",
            "TagValue": "value-xxx"
        }
    ]
}

Output Example

{
    "Response": {
        "HealthCheckTemplateId": "hct-m4x8q2pa",
        "RequestId": "3b848733-70e5-4558-ae39-4b9938eb7609"
    }
}

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

There is no error code related to the API business logic. For other error codes, please see Common Error Codes.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈