tencent cloud

Application Load Balancer

CreateRules

Download
Focus Mode
Font Size
Last updated: 2026-09-28 14:18:17

1. API Description

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

This API is used to create forwarding rules. It is an async API. After returning successfully, call the DescribeAsyncJobs API with the returned RequestID as an input parameter to check whether this task is successful.
A rule supports up to 10 forward Conditions and 5 forward Actions.

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: CreateRules.
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.
ListenerId Yes String Listener ID, in the format of lst- followed by 8 alphanumeric characters.
LoadBalancerId Yes String CLB instance ID. The format is alb- followed by 8 alphanumeric characters.
Rules.N Yes Array of RuleInput Forwarding rule list.
ClientToken No String Client Token, used to ensure the idempotency of requests. Generate a parameter value from your client, ensuring uniqueness of the value for different requests. ClientToken supports only ASCII characters. If not specified, the system automatically uses the RequestId of the API request as the ClientToken flag. The RequestId may not be the same for each API request.
DryRun No Boolean Whether it is a pre-check only request.

3. Output Parameters

Parameter Name Type Description
RuleIds Array of String List of forwarding rule IDs. Each ID is in the format of rule- followed by 8 alphanumeric characters.
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 Create rules

Input Example

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

{
    "LoadBalancerId": "alb-f8q2xk9m",
    "ListenerId": "lst-d9p3k7wa",
    "Rules": [
        {
            "Direction": "Request",
            "Priority": 1,
            "RuleName": "rule1",
            "Conditions": [
                {
                    "Type": "Host",
                    "HostConfig": [
                        "test.com"
                    ]
                }
            ],
            "Actions": [
                {
                    "Type": "TargetGroup",
                    "Order": 1,
                    "TargetGroupConfig": {
                        "TargetGroups": [
                            {
                                "TargetGroupId": "lbtg-0zrnc9qa",
                                "Weight": 10
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

Output Example

{
    "Response": {
        "RuleIds": [
            "rule-h8cy5gwl"
        ],
        "RequestId": "d3614848-765c-4890-b381-72a192ac8c21"
    }
}

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
AuthFailure CAM signature/authentication error.
DryRunOperation DryRun operation means the request will be successful, but the DryRun parameter is passed.
FailedOperation Operation failed.
FailedOperation.ResourceAlreadyExists Resource already exists.
FailedOperation.RuleAlreadyExists Rule priority already exists.
InternalError Internal error.
InvalidFilter Invalid Filter
InvalidParameter Parameter error.
InvalidParameter.InvalidClientToken Invalid ClientToken format.
InvalidParameter.InvalidFieldFormat Field format error.
InvalidParameter.InvalidFieldType Field type error.
InvalidParameter.InvalidFieldValue Field value is incorrect.
InvalidParameter.MissingAction Action parameter is missing.
InvalidParameter.MissingField Please enter the required parameter.
InvalidParameterValue Parameter value error.
InvalidParameterValue.BusinessParameterMismatch Business parameter inconsistency.
LimitExceeded The quota limit is exceeded.
LimitExceeded.Quota The quota limit is exceeded.
MissingParameter Parameters are missing.
OperationDenied Operation denied.
RegionError Region error
RequestLimitExceeded Number of requests exceeds the frequency limit.
ResourceInUse The resource is occupied.
ResourceNotFound The resource does not exist.
ResourceNotFound.Listener Listener not found.
ResourceNotFound.LoadBalancer The CLB resource does not exist.
ResourceNotFound.TargetGroup Target group not found.
ResourceUnavailable Resources are unavailable.
ResourceUnavailable.Listener Listener is in unavailable status.
ResourceUnavailable.LoadBalancer ALB status is unavailable.
ResourceUnavailable.PreviousTaskNotCompleted The previous task is not completed.
ResourceUnavailable.TargetGroup Target group is in unavailable status
ResourceUnavailable.UpstreamStatusBlocked Resource status of the superior is blocked.
ResourcesSoldOut Resources are sold out.
UnauthorizedOperation Unauthorized operation.
UnauthorizedOperation.ServiceRoleUnauthorized Service role not authorized.
UnknownParameter Unknown parameter error.
UnsupportedOperation The operation is not supported.
UnsupportedOperation.InvalidStateTransition Invalid state transition.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback