Network Policies
Manage reusable network policy definitions and their rules.
Network Policies object
Attributes
object
Stringid
Stringname
Stringdescription
StringNullablestatus
Enumversion
Numberrules
Objectfirewall_ids
Array of StringsNullablecreated_at
Dateupdated_at
Datearchived_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
NumberOptionalafter
StringOptionalbefore
StringOptionalcursor
StringOptionalorder
EnumOptionalid
UnionOptionalstatus
UnionOptionalfirewall_id
UnionOptionalsearch
StringOptionalcreated_at
ObjectOptionalFilter network policy creation time by date range
updated_at
ObjectOptionalFilter network policy last update time by date range
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
StringThe unique identifier for the network_policy
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
Stringdescription
StringOptionalrules
ObjectOptionalcurl -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
StringThe unique identifier for the network_policy
Request Body
name
StringOptionaldescription
StringOptionalrules
ObjectOptionalcurl -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
StringThe unique identifier for the network_policy
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
StringThe unique identifier for the network_policy
Request Body
effect
Enumdirection
Enumcidrs
Array of Stringsdescription
StringOptionalenabled
Booleanpriority
Numberports
ObjectOptionalcurl -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
StringThe unique identifier for the network_policy
rule_id
StringThe unique identifier for the rule
Request Body
effect
Enumdirection
Enumcidrs
Array of Stringsdescription
StringOptionalenabled
Booleanpriority
Numberports
ObjectOptionalcurl -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
StringThe unique identifier for the network_policy
rule_id
StringThe unique identifier for the rule
curl -X DELETE "https://api.metorial.com/network-policies/net_Rm4Mnheq2bfEPhBhP7SY/rules/rul_Rm4Mnheq2bfEPhBhP7SY" \-H "Authorization: Bearer metorial_sk_..."