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 '{"action":"allow","cidr":"212.3.14.0/24","description":"nyc office","ip_policy_id":"ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8"}' \
https://api.ngrok.com/ip_policy_rules
Parameters
Name | Type | Description |
---|---|---|
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
{
"action": "allow",
"cidr": "212.3.14.0/24",
"created_at": "2024-08-02T07:15:38Z",
"description": "nyc office",
"id": "ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK",
"ip_policy": {
"id": "ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8",
"uri": "https://api.ngrok.com/ip_policies/ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK"
}
Fields
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
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_2k5ok7w8MvXlRYlfXgGYXJisvRK
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_2k5ok7w8MvXlRYlfXgGYXJisvRK
Response
Returns a 200 response on success
Example Response
{
"action": "allow",
"cidr": "212.3.15.0/24",
"created_at": "2024-08-02T07:15:38Z",
"description": "nyc office",
"id": "ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK",
"ip_policy": {
"id": "ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8",
"uri": "https://api.ngrok.com/ip_policies/ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK"
}
Fields
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
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": [
{
"action": "allow",
"cidr": "132.2.19.0/24",
"created_at": "2024-08-02T07:15:38Z",
"description": "sf office",
"id": "ipr_2k5okAwcU24tafyR7fLn4Z7VZ1c",
"ip_policy": {
"id": "ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8",
"uri": "https://api.ngrok.com/ip_policies/ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2k5okAwcU24tafyR7fLn4Z7VZ1c"
},
{
"action": "allow",
"cidr": "2.2.2.2/32",
"created_at": "2024-08-02T07:15:38Z",
"description": "alan laptop",
"id": "ipr_2k5ok9SHv0d3oNnGoLOSahHWU9p",
"ip_policy": {
"id": "ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8",
"uri": "https://api.ngrok.com/ip_policies/ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2k5ok9SHv0d3oNnGoLOSahHWU9p"
},
{
"action": "allow",
"cidr": "212.3.14.0/24",
"created_at": "2024-08-02T07:15:38Z",
"description": "nyc office",
"id": "ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK",
"ip_policy": {
"id": "ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8",
"uri": "https://api.ngrok.com/ip_policies/ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK"
}
],
"next_page_uri": null,
"uri": "https://api.ngrok.com/ip_policy_rules"
}
Fields
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
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_2k5ok7w8MvXlRYlfXgGYXJisvRK
Parameters
Name | Type | Description |
---|---|---|
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
{
"action": "allow",
"cidr": "212.3.15.0/24",
"created_at": "2024-08-02T07:15:38Z",
"description": "nyc office",
"id": "ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK",
"ip_policy": {
"id": "ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8",
"uri": "https://api.ngrok.com/ip_policies/ipp_2k5okCR1vfteDqvzBk7ZrkAZEr8"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2k5ok7w8MvXlRYlfXgGYXJisvRK"
}
Fields
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
id | string | a resource identifier |
uri | string | a uri for locating a resource |