All Products
Search
Document Center

Smart Access Gateway:AddACLRule

Last Updated:Oct 22, 2026

Adds an access control rule.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

smartag:AddACLRule

create

*Acl

acs:smartag:{#regionId}:{#accountId}:acl/{#AclId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the access control instance.

You can call the DescribeRegions operation to query the region ID.

cn-shanghai

AclId

string

Yes

The instance ID of the access control instance.

acl-xhwhyuo43l0n*****

Description

string

No

The description of the access control rule.

The description must be 1 to 512 characters in length.

desctest

Direction

string

Yes

The direction in which the access control rule is applied. Valid values:

  • in: inbound. Traffic from the Internet to the local branch where the Smart Access Gateway (SAG) instance is deployed.

  • out: outbound. Traffic from the local branch where the SAG instance is deployed to the Internet.

in

SourceCidr

string

Yes

The source CIDR block.

The source CIDR block must be in CIDR format. Example: 192.168.1.0/24.

192.168.20.0/24

DestCidr

string

Yes

The destination CIDR block.

The destination CIDR block must be in CIDR format. Example: 192.168.10.0/24.

192.168.10.0/24

IpProtocol

string

Yes

The protocol used by the access control rule.

For the protocol types supported by the access control feature, refer to the console. The protocol format is not case-sensitive.

tcp

SourcePortRange

string

Yes

The source port range.

Valid values: -1 or 1 to 65535.

The source port range is in the format of X/Y, such as 1/200 or 80/80. A value of -1/-1 indicates that all ports are allowed.

1/200

DestPortRange

string

Yes

The destination port range.

Valid values: -1 or 1 to 65535.

The destination port range is in the format of X/Y, such as 1/200 or 80/80. A value of -1/-1 indicates that all ports are allowed.

1/200

Policy

string

Yes

The authorization policy of the access control rule. Valid values:

  • accept: Allow.

  • drop: Deny.

accept

Priority

integer

No

The priority of the access control rule.

A smaller value indicates a higher priority. If multiple rules have the same priority, the rule that is first delivered to the Smart Access Gateway device takes effect first.

Valid values: 1 to 100. Default value: 1.

12

Type

string

No

The type of the access control rule. Valid values:

  • LAN: private network. This is the default value. It specifies the Settings of access control rules for traffic of the private endpoint.

  • WAN: public network. It specifies the Settings of access control rules for traffic of public IP addresses.

LAN

Name

string

No

The name of the access control rule.

The name must be 2 to 100 characters in length, and must start with a letter or a Chinese character. It can contain digits, periods (.), underscores (_), and hyphens (-).

doctest

DpiSignatureIds

array

No

The IDs of the applications matched by the access control rule.

You can call the ListDpiSignatures operation to query application IDs and the corresponding application information. Maximum value of N: 10.

1

string

No

The application ID.

You can enter up to 100 application IDs at a time.

1

DpiGroupIds

array

No

The IDs of the application groups matched by the access control rule.

You can call the ListDpiGroups operation to query application group IDs and the included application information. Maximum value of N: 10.

20

string

No

The application group ID.

You can enter up to 100 application group IDs at a time.

20

Response elements

Element

Type

Description

Example

object

Policy

string

The authorization policy of the access control rule.

  • accept: Allow.

  • drop: Deny.

drop

Description

string

The description of the access control rule.

test

RequestId

string

The request ID.

880F84CB-9B54-4413-A8A3-8832C82D1BC4

SourcePortRange

string

The source port range.

1/65535

SourceCidr

string

The source CIDR block.

The source CIDR block must be in CIDR format. Example: 192.168.1.0/24.

192.168.20.0/24

Priority

integer

The priority of the access control rule.

A smaller value indicates a higher priority. If multiple rules have the same priority, the rule that is first delivered to the Smart Access Gateway device takes effect first.

1

AclId

string

The instance ID of the access control instance.

acl-xhwhyuo43l0*******

AcrId

string

The ID of the access control rule.

acr-c1hkd054qywi******

DestPortRange

string

The destination port range.

1/65535

Direction

string

The direction in which the access control rule is applied. Valid values:

  • in: inbound. Traffic from the Internet to the local branch where the Smart Access Gateway (SAG) instance is deployed.

  • out: outbound. Traffic from the local branch where the SAG instance is deployed to the Internet.

out

DpiGroupIds

object

DpiGroupId

array

The IDs of the application groups matched by the access control rule.

string

The IDs of the application groups matched by the access control rule.

20

Name

string

The name of the access control rule.

doctest

Type

string

The type of the access control rule.

  • LAN: private network. It specifies the Settings of access control rules for traffic of the private endpoint.

  • WAN: public network. It specifies the Settings of access control rules for traffic of public IP addresses.

LAN

GmtCreate

integer

The timestamp when the access control rule was created.

The timestamp is of the Long type. If multiple rules have the same priority, the rule with the smaller timestamp takes effect first.

1553766882689

DestCidr

string

The destination CIDR block.

The destination CIDR block must be in CIDR format. Example: 192.168.10.0/24.

192.168.10.0/24

DpiSignatureIds

object

DpiSignatureId

array

The IDs of the applications matched by the access control rule.

string

The IDs of the applications matched by the access control rule.

1

IpProtocol

string

The protocol used by the access control rule.

TCP

Examples

Success response

JSON format

{
  "Policy": "drop",
  "Description": "test",
  "RequestId": "880F84CB-9B54-4413-A8A3-8832C82D1BC4",
  "SourcePortRange": "1/65535",
  "SourceCidr": "192.168.20.0/24",
  "Priority": 1,
  "AclId": "acl-xhwhyuo43l0*******",
  "AcrId": "acr-c1hkd054qywi******",
  "DestPortRange": "1/65535",
  "Direction": "out",
  "DpiGroupIds": {
    "DpiGroupId": [
      "20"
    ]
  },
  "Name": "doctest",
  "Type": "LAN",
  "GmtCreate": 1553766882689,
  "DestCidr": "192.168.10.0/24",
  "DpiSignatureIds": {
    "DpiSignatureId": [
      "1"
    ]
  },
  "IpProtocol": "TCP"
}

Error codes

HTTP status code

Error code

Error message

Description

400 ACL.NoSupportWanType An SAG 1000 device does not support a WAN ACL. An SAG 1000 device does not support a WAN ACL.
400 ACL.InvalidType The specified ACL type is invalid. The specified ACL type is invalid.
403 Forbidden User not authorized to operate on the specified resource. You do not have permissions to manage the specified resource.
403 MissingParameter The input parameter is missing, please check your input. Missing parameters. Check whether all required parameters are set.
403 InvalidDescription Description not valid. The length of the description has exceeded the upper limit.
403 InvalidParameter The specified parameter is invalid. Invalid parameters.
403 FeatureNotSupport The current edition of the smart access gateway does not support this feature. The current version of Smart Access Gateway does not support this feature.
403 FeatureNotSupportForActiveSmartAG The current edition of the active smart access gateway does not support this feature. The current edition of the active SAG instance does not support this feature.
403 FeatureNotSupportForStandBySmartAG The current edition of the standby smart access gateway does not support this feature. The current version of Smart Access Gateway does not support this feature.
403 NotSupportedProtocol The specified protocol of the ACL rule is not supported. The specified protocol of the ACL rule is not supported.
403 InvalidId.ACL The specified ACL ID is invalid. The specified ACL group ID is invalid.
403 InvalidPortRange The specified port range is invalid. The specified port range is invalid.
403 AcrPerAclAmountLimit The maximum number of rules in an ACL is exceeded. You can open a ticket to increase the quota. The number of ACL rules has reached the upper limit of ACL rules that you can create under each ACL group. You can submit a ticket to request a quota increase.
403 InternalError An internal server error occurred. An internal server error occurred.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.