tencent cloud



Last updated: 2022-05-05 16:20:41

1. API Description

Domain name for API request: apigateway.tencentcloudapi.com.

This API is used to bind a custom domain name to a service.
Each service in API Gateway provides a default domain name for users to call. If you want to use your own domain name, you can bind a custom domain name to the target service. After getting the ICP filing and configuring the CNAME record between the custom and default domain names, you can directly call the custom domain name.

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: BindSubDomain.
Version Yes String Common Params. The value used for this API: 2018-08-08.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
ServiceId Yes String Unique service ID.
SubDomain Yes String Custom domain name to be bound.
Protocol Yes String Protocol supported by service. Valid values: http, https, http&https.
NetType Yes String Network type. Valid values: OUTER, INNER.
IsDefaultMapping Yes Boolean Whether the default path mapping is used. The default value is true. If the value is false, the custom path mapping will be used and PathMappingSet will be required in this case.
NetSubDomain Yes String Default domain name.
CertificateId No String Unique certificate ID of the custom domain name to be bound. The certificate can be uploaded if Protocol is https or http&https.
PathMappingSet.N No Array of PathMapping Custom domain name path mapping. It can contain up to 3 Environment values which can be set to only test, prepub, and release, respectively.
IsForcedHttps No Boolean Whether to force HTTP requests to redirect to HTTPS. Default value: false. When this parameter is true, API Gateway will redirect all requests using the custom domain name over the HTTP protocol to the HTTPS protocol for forwarding.

3. Output Parameters

Parameter Name Type Description
Result Boolean Whether binding succeeded.
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Binding a custom domain name

Input Example

&<Common request parameters>

Output Example

  "Response": {
    "Result": true,
    "RequestId": "6e00553a-8158-4f70-ad43-e1b046af1502"

5. Developer Resources


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.CertificateIdEnterpriseWaitSubmit The certificate is an enterprise certificate and waiting to be submitted.
FailedOperation.CertificateIdError The certificate does not exist or you do not have permission to view it. Please upload a valid certificate in the SSL Certificates Service Console.
FailedOperation.CertificateIdExpired The certificate has expired. Please upload a valid one.
FailedOperation.CertificateIdInfoError The certificate information is empty. Please submit a ticket for assistance.
FailedOperation.CertificateIdUnderVerify The certificate is under review. Please upload a valid one.
FailedOperation.CertificateIdUnknownError The certificate is in an unknown status. Please submit a ticket to check its specific status.
FailedOperation.CertificateIdVerifyFail The certificate has been rejected. Please upload a valid one.
FailedOperation.CertificateIsNull The Apis certificate is empty. Please upload a certificate.
FailedOperation.DefineMappingEnvironmentError The Apis environment configuration is incorrect.
FailedOperation.DefineMappingNotNull The Apis custom path mapping cannot be empty.
FailedOperation.DefineMappingParamRepeat The Apis parameters are repeated.
FailedOperation.DefineMappingPathError The Apis custom path configuration is incorrect.
FailedOperation.DomainAlreadyBindOtherService The domain name has been bound to another service.
FailedOperation.DomainAlreadyBindService The domain name has already been bound to this service.
FailedOperation.DomainInBlackList Unable to connect: the current domain name is not compliant.
FailedOperation.DomainNeedBeian The domain name does not have an ICP filing through Tencent Cloud. Please get the ICP filing before binding the domain name.
FailedOperation.DomainResolveError The domain name is not configured with a CNAME record resolving to the default domain name, or the resolution has not taken effect yet.
FailedOperation.FormatError The domain name format is incorrect.
FailedOperation.IsDefaultMapping The Apis custom path conflicts with the default path.
FailedOperation.NetSubDomainError The entered default second-level domain name is incorrect.
FailedOperation.ServiceError Service error.
FailedOperation.ServiceInOperation The service is in use. Please try again later.
FailedOperation.SubDomainFormatError The custom domain name format is incorrect.
InternalError Internal error.
InternalError.ApigwException API Gateway internal request error. Please try again later. If the problem persists, please contact the smart customer service or submit a ticket.
InternalError.OssException OSS internal request error. Please try again. If the problem persists, please contact the smart customer service or submit a ticket.
InvalidParameter.FormatError Incorrect parameter format.
InvalidParameterValue.InvalidProcotol Invalid protocol type parameter.
LimitExceeded.ExceededDefineMappingLimit You can set up to 3 sets of custom path mappings.
LimitExceeded.ExceededDomainLimit The number of bound domain names exceeds the limit. You can bind up to 5 domain names by default.
LimitExceeded.RequestLimitExceeded The request frequency has reached the limit. Please try again later.
ResourceNotFound.InvalidService The corresponding service is invisible.
UnsupportedOperation.ForceHttps Cannot force HTTPS when the protocol is HTTP.
UnsupportedOperation.InvalidServiceTrade The service is currently isolated and therefore the operation is not supported.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support