Network Policies

Manage reusable network policy definitions and their rules.

Network Policies object

Attributes

object

String

id

String

name

String

description

StringNullable

status

Enum

version

Number

rules

Object

firewall_ids

Array of StringsNullable

created_at

Date

updated_at

Date

archived_at

DateNullable
{
"object": "network.policy",
"status": "active",
"rules": [
{
"object": "network.policy.rule",
"effect": "allow",
"direction": "ingress",
"ports": [
{
"object": "network.policy.port_range"
},
{
"object": "network.policy.port_range"
}
]
},
{
"object": "network.policy.rule",
"effect": "allow",
"direction": "ingress",
"ports": [
{
"object": "network.policy.port_range"
},
{
"object": "network.policy.port_range"
}
]
}
]
}

List network policies

Returns a paginated list of network policies.

Query Parameters

limit

NumberOptional

after

StringOptional

before

StringOptional

cursor

StringOptional

order

EnumOptional

id

UnionOptional

status

UnionOptional

firewall_id

UnionOptional

search

StringOptional

created_at

ObjectOptional

Filter network policy creation time by date range

updated_at

ObjectOptional

Filter network policy last update time by date range

GEThttp://api.metorial.com/network-policies
curl -X GET "https://api.metorial.com/network-policies" \
-H "Authorization: Bearer metorial_sk_..."

Get network policy

Retrieves a specific network policy by ID.

URL Parameters

network_policy_id

String

The unique identifier for the network_policy

GEThttp://api.metorial.com/network-policies/:network_policy_id
curl -X GET "https://api.metorial.com/network-policies/net_Rm4Mnheq2bfEPhBhP7SY" \
-H "Authorization: Bearer metorial_sk_..."

Create network policy

Creates a new network policy.

Request Body

name

String

description

StringOptional

rules

ObjectOptional
POSThttp://api.metorial.com/network-policies
curl -X POST "https://api.metorial.com/network-policies" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer metorial_sk_..." \
-d '{
"name": "example_name",
"description": "example_description",
"rules": {
"effect": "allow",
"direction": "ingress",
"cidrs": [
"example_item"
],
"description": "example_description",
"enabled": false,
"priority": 0,
"ports": {
"from": 0,
"to": 0
}
}
}'

Update network policy

Updates a network policy definition.

URL Parameters

network_policy_id

String

The unique identifier for the network_policy

Request Body

name

StringOptional

description

StringOptional

rules

ObjectOptional
PATCHhttp://api.metorial.com/network-policies/:network_policy_id
curl -X PATCH "https://api.metorial.com/network-policies/net_Rm4Mnheq2bfEPhBhP7SY" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer metorial_sk_..." \
-d '{
"name": "example_name",
"description": "example_description",
"rules": {
"effect": "allow",
"direction": "ingress",
"cidrs": [
"example_item"
],
"description": "example_description",
"enabled": false,
"priority": 0,
"ports": {
"from": 0,
"to": 0
}
}
}'

Delete network policy

Archives a network policy.

URL Parameters

network_policy_id

String

The unique identifier for the network_policy

DELETEhttp://api.metorial.com/network-policies/:network_policy_id
curl -X DELETE "https://api.metorial.com/network-policies/net_Rm4Mnheq2bfEPhBhP7SY" \
-H "Authorization: Bearer metorial_sk_..."

Create network policy rule

Adds a rule to a network policy.

URL Parameters

network_policy_id

String

The unique identifier for the network_policy

Request Body

effect

Enum

direction

Enum

cidrs

Array of Strings

description

StringOptional

enabled

Boolean

priority

Number

ports

ObjectOptional
POSThttp://api.metorial.com/network-policies/:network_policy_id/rules
curl -X POST "https://api.metorial.com/network-policies/net_Rm4Mnheq2bfEPhBhP7SY/rules" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer metorial_sk_..." \
-d '{
"effect": "allow",
"direction": "ingress",
"cidrs": [
"example_item"
],
"description": "example_description",
"enabled": false,
"priority": 0,
"ports": {
"from": 0,
"to": 0
}
}'

Update network policy rule

Updates a rule on a network policy.

URL Parameters

network_policy_id

String

The unique identifier for the network_policy

rule_id

String

The unique identifier for the rule

Request Body

effect

Enum

direction

Enum

cidrs

Array of Strings

description

StringOptional

enabled

Boolean

priority

Number

ports

ObjectOptional
PATCHhttp://api.metorial.com/network-policies/:network_policy_id/rules/:rule_id
curl -X PATCH "https://api.metorial.com/network-policies/net_Rm4Mnheq2bfEPhBhP7SY/rules/rul_Rm4Mnheq2bfEPhBhP7SY" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer metorial_sk_..." \
-d '{
"effect": "allow",
"direction": "ingress",
"cidrs": [
"example_item"
],
"description": "example_description",
"enabled": false,
"priority": 0,
"ports": {
"from": 0,
"to": 0
}
}'

Delete network policy rule

Removes a rule from a network policy.

URL Parameters

network_policy_id

String

The unique identifier for the network_policy

rule_id

String

The unique identifier for the rule

DELETEhttp://api.metorial.com/network-policies/:network_policy_id/rules/:rule_id
curl -X DELETE "https://api.metorial.com/network-policies/net_Rm4Mnheq2bfEPhBhP7SY/rules/rul_Rm4Mnheq2bfEPhBhP7SY" \
-H "Authorization: Bearer metorial_sk_..."