IP Policy Rules
Create IP Policy Rule
Create a new IP policy rule attached to an IP Policy.
Request
POST /ip_policy_rules
Example Request
curl \
-X POST \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"description":"nyc office","cidr":"212.3.14.0/24","ip_policy_id":"ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV","action":"allow"}' \
https://api.ngrok.com/ip_policy_rules
Parameters
description | string | human-readable description of the source IPs of this IP rule. optional, max 255 bytes. |
metadata | string | arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes. |
cidr | string | an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported. |
ip_policy_id | string | ID of the IP policy this IP policy rule will be attached to |
action | string | the action to apply to the policy rule, either allow or deny |
Response
Returns a 201 response on success
Example Response
{
"id": "ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"created_at": "2023-07-31T23:17:39Z",
"description": "nyc office",
"cidr": "212.3.14.0/24",
"ip_policy": {
"id": "ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV"
},
"action": "allow"
}
Fields
id | string | unique identifier for this IP policy rule |
uri | string | URI of the IP policy rule API resource |
created_at | string | timestamp when the IP policy rule was created, RFC 3339 format |
description | string | human-readable description of the source IPs of this IP rule. optional, max 255 bytes. |
metadata | string | arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes. |
cidr | string | an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported. |
ip_policy | Ref | object describing the IP policy this IP Policy Rule belongs to |
action | string | the action to apply to the policy rule, either allow or deny |
Ref fields
id | string | a resource identifier |
uri | string | a uri for locating a resource |
Delete IP Policy Rule
Delete an IP policy rule.
Request
DELETE /ip_policy_rules/{id}
Example Request
curl \
-X DELETE \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/ip_policy_rules/ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA
Response
Returns a 204 response with no body on success
Get IP Policy Rule
Get detailed information about an IP policy rule by ID.
Request
GET /ip_policy_rules/{id}
Example Request
curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/ip_policy_rules/ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA
Response
Returns a 200 response on success
Example Response
{
"id": "ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"created_at": "2023-07-31T23:17:39Z",
"description": "nyc office",
"cidr": "212.3.15.0/24",
"ip_policy": {
"id": "ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV"
},
"action": "allow"
}
Fields
id | string | unique identifier for this IP policy rule |
uri | string | URI of the IP policy rule API resource |
created_at | string | timestamp when the IP policy rule was created, RFC 3339 format |
description | string | human-readable description of the source IPs of this IP rule. optional, max 255 bytes. |
metadata | string | arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes. |
cidr | string | an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported. |
ip_policy | Ref | object describing the IP policy this IP Policy Rule belongs to |
action | string | the action to apply to the policy rule, either allow or deny |
Ref fields
id | string | a resource identifier |
uri | string | a uri for locating a resource |
List IP Policy Rules
List all IP policy rules on this account
Request
GET /ip_policy_rules
Example Request
curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/ip_policy_rules
Response
Returns a 200 response on success
Example Response
{
"ip_policy_rules": [
{
"id": "ipr_2TMGIyU0GbPfNcmU81JtxmuDlJh",
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2TMGIyU0GbPfNcmU81JtxmuDlJh",
"created_at": "2023-07-31T23:17:39Z",
"description": "sf office",
"cidr": "132.2.19.0/24",
"ip_policy": {
"id": "ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV"
},
"action": "allow"
},
{
"id": "ipr_2TMGIx3VMLCUhRq0EkPF2mRvREa",
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2TMGIx3VMLCUhRq0EkPF2mRvREa",
"created_at": "2023-07-31T23:17:39Z",
"description": "alan laptop",
"cidr": "2.2.2.2/32",
"ip_policy": {
"id": "ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV"
},
"action": "allow"
},
{
"id": "ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"created_at": "2023-07-31T23:17:39Z",
"description": "nyc office",
"cidr": "212.3.14.0/24",
"ip_policy": {
"id": "ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV"
},
"action": "allow"
}
],
"uri": "https://api.ngrok.com/ip_policy_rules",
"next_page_uri": null
}
Fields
ip_policy_rules | IPPolicyRule | the list of all IP policy rules on this account |
uri | string | URI of the IP policy rule list API resource |
next_page_uri | string | URI of the next page, or null if there is no next page |
IPPolicyRule fields
id | string | unique identifier for this IP policy rule |
uri | string | URI of the IP policy rule API resource |
created_at | string | timestamp when the IP policy rule was created, RFC 3339 format |
description | string | human-readable description of the source IPs of this IP rule. optional, max 255 bytes. |
metadata | string | arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes. |
cidr | string | an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported. |
ip_policy | Ref | object describing the IP policy this IP Policy Rule belongs to |
action | string | the action to apply to the policy rule, either allow or deny |
Ref fields
id | string | a resource identifier |
uri | string | a uri for locating a resource |
Update IP Policy Rule
Update attributes of an IP policy rule by ID
Request
PATCH /ip_policy_rules/{id}
Example Request
curl \
-X PATCH \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"cidr":"212.3.15.0/24"}' \
https://api.ngrok.com/ip_policy_rules/ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA
Parameters
id | string | |
description | string | human-readable description of the source IPs of this IP rule. optional, max 255 bytes. |
metadata | string | arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes. |
cidr | string | an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported. |
Response
Returns a 200 response on success
Example Response
{
"id": "ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2TMGItv8Hgeo4XLgLnhyBbHdSMA",
"created_at": "2023-07-31T23:17:39Z",
"description": "nyc office",
"cidr": "212.3.15.0/24",
"ip_policy": {
"id": "ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGIwB04GGz7E6ZH6TQD1MGITV"
},
"action": "allow"
}
Fields
id | string | unique identifier for this IP policy rule |
uri | string | URI of the IP policy rule API resource |
created_at | string | timestamp when the IP policy rule was created, RFC 3339 format |
description | string | human-readable description of the source IPs of this IP rule. optional, max 255 bytes. |
metadata | string | arbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes. |
cidr | string | an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported. |
ip_policy | Ref | object describing the IP policy this IP Policy Rule belongs to |
action | string | the action to apply to the policy rule, either allow or deny |
Ref fields
id | string | a resource identifier |
uri | string | a uri for locating a resource |