> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://americancloud.com/docs/api/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://americancloud.com/docs/api/_mcp/server.

# Create a new Network ACL Rule for an ACL List

POST https://api.americancloud.com/api/v1/networks/acl/lists/{listId}/rules
Content-Type: application/json

Reference: https://americancloud.com/docs/api/api-reference/network-acls/create-rule-network-acls

## Authentication

- `X-API-Client-ID` header (required) — API Client ID
- `X-API-Client-Secret` header (required) — API Client Secret

## Request

### Path parameters

- `listId` (string, required) — ID of the Network ACL List

### Body (application/json)

This endpoint expects a CreateNetworkAclRuleDto.

- `cidrList` (string, required) — Remote CIDR — source CIDR for `Ingress` rules, destination CIDR for `Egress` rules.
- `protocol` (string, required) — Protocol the rule applies to. One of `TCP`, `UDP`, `ICMP`, or `ALL`.
- `action` (string, required) — Whether to allow or deny matching traffic.
- `trafficType` (string, required) — Direction of traffic the rule applies to.
- `number` (string, optional) — Rule number (1-1000). Unique within the ACL list and determines evaluation order.
- `startPort` (integer, optional) — Start of the port range. Used for `TCP` and `UDP` protocols.
- `endPort` (integer, optional) — End of the port range. Used for `TCP` and `UDP` protocols.
- `icmpType` (string, optional) — ICMP message type. Used for the `ICMP` protocol.
- `icmpCode` (string, optional) — ICMP message code. Used for the `ICMP` protocol.

## Response

### 201

The Network ACL Rule has been created

- `id` (string, required) — Unique identifier for the ACL rule.
- `aclListId` (string, required) — Identifier of the ACL list the rule belongs to.
- `number` (integer, required) — Rule number. Determines evaluation order within the ACL list.
- `protocol` (string, required) — Protocol the rule applies to. One of `TCP`, `UDP`, `ICMP`, or `ALL`.
- `cidrList` (string, required) — Remote CIDR — source CIDR for `Ingress` rules, destination CIDR for `Egress` rules.
- `action` (string, required) — Whether matching traffic is allowed or denied.
- `trafficType` (string, required) — Direction of traffic the rule applies to.
- `startPort` (integer, optional) — Start of the port range. Used for `TCP` and `UDP` protocols.
- `endPort` (integer, optional) — End of the port range. Used for `TCP` and `UDP` protocols.
- `icmpType` (integer, optional) — ICMP message type. Used for the `ICMP` protocol.
- `icmpCode` (integer, optional) — ICMP message code. Used for the `ICMP` protocol.
- `createdAt` (datetime, optional) — When the rule was created.

## Errors

### 400 Bad Request Error

The request was malformed or failed validation.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 401 Unauthorized Error

Authentication credentials were missing or invalid.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 403 Forbidden Error

The authenticated principal is not permitted to perform this action.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 404 Not Found Error

Network ACL List not found

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

### 500 Internal Server Error

An unexpected error occurred on the server.

- `statusCode` (double, required) — HTTP status code.
- `message` (ApiErrorDtoMessage, required) — Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.
- `error` (string, optional) — Short HTTP error label.
- `code` (string, optional) — Machine-readable reason for the error. Match on this value rather than on `message`, which can be reworded at any time. Present on the errors that have more than one cause for the same status code; omitted otherwise.
- `errors` (list of ValidationErrorItemDto, optional) — Per-field validation details. Present on 400 responses produced by request-body validation; omitted otherwise.
- `snapshots` (list of BlockingSnapshotDto, optional) — The snapshots that block a delete. Present on a 409 whose `code` is `volume_has_snapshots`; omitted otherwise.

## Types

### ApiErrorDtoMessage

Human-readable error message. A single string for most errors, or an array of strings when the request failed multiple validation checks.

### ValidationErrorItemDto

- `field` (string, required) — Dotted path to the field that failed validation.
- `message` (string, required) — Human-readable validation message for this field.

### BlockingSnapshotDto

- `id` (string, required) — Snapshot ID.
- `name` (string, required) — Snapshot name.

## Examples

**Request**

```json
{
  "cidrList": "0.0.0.0/0",
  "protocol": "TCP",
  "action": "Allow",
  "trafficType": "Ingress"
}
```

**Response**

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "aclListId": "123e4567-e89b-12d3-a456-426614174000",
  "number": 100,
  "protocol": "TCP",
  "cidrList": "0.0.0.0/0",
  "action": "Allow",
  "trafficType": "Ingress",
  "startPort": 80,
  "endPort": 80,
  "icmpType": 8,
  "icmpCode": 0,
  "createdAt": "2026-05-29T12:34:56Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules"

payload = {
    "cidrList": "0.0.0.0/0",
    "protocol": "TCP",
    "action": "Allow",
    "trafficType": "Ingress"
}
headers = {
    "X-API-Client-ID": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules';
const options = {
  method: 'POST',
  headers: {'X-API-Client-ID': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"cidrList":"0.0.0.0/0","protocol":"TCP","action":"Allow","trafficType":"Ingress"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules"

	payload := strings.NewReader("{\n  \"cidrList\": \"0.0.0.0/0\",\n  \"protocol\": \"TCP\",\n  \"action\": \"Allow\",\n  \"trafficType\": \"Ingress\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Client-ID", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Client-ID"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"cidrList\": \"0.0.0.0/0\",\n  \"protocol\": \"TCP\",\n  \"action\": \"Allow\",\n  \"trafficType\": \"Ingress\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules")
  .header("X-API-Client-ID", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"cidrList\": \"0.0.0.0/0\",\n  \"protocol\": \"TCP\",\n  \"action\": \"Allow\",\n  \"trafficType\": \"Ingress\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules', [
  'body' => '{
  "cidrList": "0.0.0.0/0",
  "protocol": "TCP",
  "action": "Allow",
  "trafficType": "Ingress"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Client-ID' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Client-ID", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"cidrList\": \"0.0.0.0/0\",\n  \"protocol\": \"TCP\",\n  \"action\": \"Allow\",\n  \"trafficType\": \"Ingress\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Client-ID": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "cidrList": "0.0.0.0/0",
  "protocol": "TCP",
  "action": "Allow",
  "trafficType": "Ingress"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.americancloud.com/api/v1/networks/acl/lists/123e4567-e89b-12d3-a456-426614174000/rules")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```