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

# Create MCR Prefix List

POST https://api.megaport.com/v2/product/mcr2/{productUid}/prefixList
Content-Type: application/json

Creates prefix filter lists for the MCR specified by the `productUid`.

The MCR prefix filter list is a named list of IP network addresses. Create a prefix filter list to match and filter routes based on the routeâ€™s prefix and apply the filter to routes received from or advertised to BGP peers on the MCR. The MCR compares each route prefix against the conditions in the list, one match at a time, from the top down to deny or advertise the route.

- A prefix filter list can be applied multiple times to different BGP peers.
    
- Up to 50 prefix filter lists can be configured on each MCR.
    
- Each list is able to contain up to 200 entries.
    

The parameters have these values:

- `description` - (Required) The name for the new prefix filter list.
    
- `addressFamily` - (Required) The IP address standard of the IP network addresses in the prefix filter list.
    
- `action` - (Required) The action to take for the network address in the filter list. Accepted values are permit and deny.
    
- `prefix` - (Required) The network address.
    
- `ge` - (Optional) The minimum starting prefix length to be matched. Valid values are from 0 to 32 (IPv4), or 0 to 128 (IPv6). The minimum (ge) must be no greater than or equal to the maximum value (le).
    
- `le` - (Optional) The maximum ending prefix length to be matched. The prefix length is greater than or equal to the minimum value (ge). Valid values are from 0 to 32 (IPv4), or 0 to 128 (IPv6), but the maximum must be no less than the minimum value (ge).
    

For more information on prefix filter lists, see [Creating an MCR VXC with the API ](https://docs.megaport.com/api/api-mcr-vxc-csp/) and [MCR Route Filtering](https://docs.megaport.com/mcr/route-filtering/). For information on applying a prefix filter via API for an MCR VXC, see [POST Validate MCR VXC Order (v3)](https://dev.megaport.com/#88537ea2-f3de-49c1-907d-d4037a2082e9).

Reference: https://en.megaport.ferndocs.com/api-reference/megaport-cloud-router-mcr/create-mcr-prefix-list

## Servers

- `https://api.megaport.com` (Production environment, default)
- `https://api-staging.megaport.com` (Staging environment (test only, reset every 24 hours))

## Request

### Path parameters

- `productUid` (string, required)

### Body (application/json)

This endpoint expects an object.

- `addressFamily` (string, optional)
- `description` (string, optional)
- `entries` (list of V2ProductMcr2ProductUidPrefixListPostRequestBodyContentApplicationJsonSchemaEntriesItems, optional)

## Response

### 200

Create MCR Prefix List / Create MCR Prefix List

- `data` (V2ProductMcr2ProductUidPrefixListPostResponsesContentApplicationJsonSchemaData, optional)
- `message` (string, optional)
- `terms` (string, optional)

## Types

### V2ProductMcr2ProductUidPrefixListPostRequestBodyContentApplicationJsonSchemaEntriesItems

- `action` (string, optional)
- `ge` (double, optional)
- `le` (double, optional)
- `prefix` (string, optional)

### V2ProductMcr2ProductUidPrefixListPostResponsesContentApplicationJsonSchemaData

- `addressFamily` (string, optional)
- `description` (string, optional)
- `entries` (list of V2ProductMcr2ProductUidPrefixListPostResponsesContentApplicationJsonSchemaDataEntriesItems, optional)
- `id` (double, optional)

### V2ProductMcr2ProductUidPrefixListPostResponsesContentApplicationJsonSchemaDataEntriesItems

- `action` (string, optional)
- `ge` (string, optional)
- `le` (string, optional)
- `prefix` (string, optional)

## Examples

**Request**

```json
{
  "addressFamily": "IPv4",
  "description": "New Prefix Filter List",
  "entries": [
    {
      "action": "permit",
      "ge": 24,
      "le": 24,
      "prefix": "10.0.0.0/24"
    },
    {
      "action": "deny",
      "ge": 24,
      "le": 24,
      "prefix": "10.1.0.0/24"
    },
    {
      "action": "permit",
      "ge": 20,
      "le": 32,
      "prefix": "10.2.0.0/16"
    }
  ]
}
```

**Response**

```json
{
  "data": {
    "addressFamily": "IPv4",
    "description": "New Prefix Filter List",
    "entries": [
      {
        "action": "permit",
        "prefix": "10.0.0.0/24"
      },
      {
        "action": "deny",
        "prefix": "10.1.0.0/24"
      },
      {
        "action": "permit",
        "ge": "20",
        "le": "32",
        "prefix": "10.2.0.0/16"
      }
    ],
    "id": 2798
  },
  "message": "Created a new prefix list for MCR",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python
import requests

url = "https://api.megaport.com/v2/product/mcr2/productUid/prefixList"

payload = {
    "addressFamily": "IPv4",
    "description": "New Prefix Filter List",
    "entries": [
        {
            "action": "permit",
            "ge": 24,
            "le": 24,
            "prefix": "10.0.0.0/24"
        },
        {
            "action": "deny",
            "ge": 24,
            "le": 24,
            "prefix": "10.1.0.0/24"
        },
        {
            "action": "permit",
            "ge": 20,
            "le": 32,
            "prefix": "10.2.0.0/16"
        }
    ]
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://api.megaport.com/v2/product/mcr2/productUid/prefixList';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"addressFamily":"IPv4","description":"New Prefix Filter List","entries":[{"action":"permit","ge":24,"le":24,"prefix":"10.0.0.0/24"},{"action":"deny","ge":24,"le":24,"prefix":"10.1.0.0/24"},{"action":"permit","ge":20,"le":32,"prefix":"10.2.0.0/16"}]}'
};

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.megaport.com/v2/product/mcr2/productUid/prefixList"

	payload := strings.NewReader("{\n  \"addressFamily\": \"IPv4\",\n  \"description\": \"New Prefix Filter List\",\n  \"entries\": [\n    {\n      \"action\": \"permit\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.0.0.0/24\"\n    },\n    {\n      \"action\": \"deny\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.1.0.0/24\"\n    },\n    {\n      \"action\": \"permit\",\n      \"ge\": 20,\n      \"le\": 32,\n      \"prefix\": \"10.2.0.0/16\"\n    }\n  ]\n}")

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

	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.megaport.com/v2/product/mcr2/productUid/prefixList")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"addressFamily\": \"IPv4\",\n  \"description\": \"New Prefix Filter List\",\n  \"entries\": [\n    {\n      \"action\": \"permit\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.0.0.0/24\"\n    },\n    {\n      \"action\": \"deny\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.1.0.0/24\"\n    },\n    {\n      \"action\": \"permit\",\n      \"ge\": 20,\n      \"le\": 32,\n      \"prefix\": \"10.2.0.0/16\"\n    }\n  ]\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.megaport.com/v2/product/mcr2/productUid/prefixList")
  .header("Content-Type", "application/json")
  .body("{\n  \"addressFamily\": \"IPv4\",\n  \"description\": \"New Prefix Filter List\",\n  \"entries\": [\n    {\n      \"action\": \"permit\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.0.0.0/24\"\n    },\n    {\n      \"action\": \"deny\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.1.0.0/24\"\n    },\n    {\n      \"action\": \"permit\",\n      \"ge\": 20,\n      \"le\": 32,\n      \"prefix\": \"10.2.0.0/16\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.megaport.com/v2/product/mcr2/productUid/prefixList', [
  'body' => '{
  "addressFamily": "IPv4",
  "description": "New Prefix Filter List",
  "entries": [
    {
      "action": "permit",
      "ge": 24,
      "le": 24,
      "prefix": "10.0.0.0/24"
    },
    {
      "action": "deny",
      "ge": 24,
      "le": 24,
      "prefix": "10.1.0.0/24"
    },
    {
      "action": "permit",
      "ge": 20,
      "le": 32,
      "prefix": "10.2.0.0/16"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/product/mcr2/productUid/prefixList");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"addressFamily\": \"IPv4\",\n  \"description\": \"New Prefix Filter List\",\n  \"entries\": [\n    {\n      \"action\": \"permit\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.0.0.0/24\"\n    },\n    {\n      \"action\": \"deny\",\n      \"ge\": 24,\n      \"le\": 24,\n      \"prefix\": \"10.1.0.0/24\"\n    },\n    {\n      \"action\": \"permit\",\n      \"ge\": 20,\n      \"le\": 32,\n      \"prefix\": \"10.2.0.0/16\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "addressFamily": "IPv4",
  "description": "New Prefix Filter List",
  "entries": [
    [
      "action": "permit",
      "ge": 24,
      "le": 24,
      "prefix": "10.0.0.0/24"
    ],
    [
      "action": "deny",
      "ge": 24,
      "le": 24,
      "prefix": "10.1.0.0/24"
    ],
    [
      "action": "permit",
      "ge": 20,
      "le": 32,
      "prefix": "10.2.0.0/16"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/product/mcr2/productUid/prefixList")! 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()
```