Skip to main content

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_2gsqM7JbZDBNsppXeR60IRtfdcZ"}' \
https://api.ngrok.com/ip_policy_rules

Parameters

NameTypeDescription
descriptionstringhuman-readable description of the source IPs of this IP rule. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
cidrstringan IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported.
ip_policy_idstringID of the IP policy this IP policy rule will be attached to
actionstringthe 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-05-23T20:36:21Z",
"description": "nyc office",
"id": "ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3",
"ip_policy": {
"id": "ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3"
}

Fields

NameTypeDescription
idstringunique identifier for this IP policy rule
uristringURI of the IP policy rule API resource
created_atstringtimestamp when the IP policy rule was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP rule. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
cidrstringan IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported.
ip_policyRefobject describing the IP policy this IP Policy Rule belongs to
actionstringthe action to apply to the policy rule, either allow or deny

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa 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_2gsqM7Edewb0nGtEKhSrYDOeXc3

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_2gsqM7Edewb0nGtEKhSrYDOeXc3

Response

Returns a 200 response on success

Example Response

{
"action": "allow",
"cidr": "212.3.15.0/24",
"created_at": "2024-05-23T20:36:21Z",
"description": "nyc office",
"id": "ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3",
"ip_policy": {
"id": "ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3"
}

Fields

NameTypeDescription
idstringunique identifier for this IP policy rule
uristringURI of the IP policy rule API resource
created_atstringtimestamp when the IP policy rule was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP rule. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
cidrstringan IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported.
ip_policyRefobject describing the IP policy this IP Policy Rule belongs to
actionstringthe action to apply to the policy rule, either allow or deny

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa 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": "2.2.2.2/32",
"created_at": "2024-05-23T20:36:21Z",
"description": "alan laptop",
"id": "ipr_2gsqMAAknlfv8aNCeIjs1vvdec0",
"ip_policy": {
"id": "ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2gsqMAAknlfv8aNCeIjs1vvdec0"
},
{
"action": "allow",
"cidr": "212.3.14.0/24",
"created_at": "2024-05-23T20:36:21Z",
"description": "nyc office",
"id": "ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3",
"ip_policy": {
"id": "ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3"
},
{
"action": "allow",
"cidr": "132.2.19.0/24",
"created_at": "2024-05-23T20:36:21Z",
"description": "sf office",
"id": "ipr_2gsqM42nqcmg8PhtiqJUzuEfV3H",
"ip_policy": {
"id": "ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2gsqM42nqcmg8PhtiqJUzuEfV3H"
}
],
"next_page_uri": null,
"uri": "https://api.ngrok.com/ip_policy_rules"
}

Fields

NameTypeDescription
ip_policy_rulesIPPolicyRulethe list of all IP policy rules on this account
uristringURI of the IP policy rule list API resource
next_page_uristringURI of the next page, or null if there is no next page

IPPolicyRule fields

NameTypeDescription
idstringunique identifier for this IP policy rule
uristringURI of the IP policy rule API resource
created_atstringtimestamp when the IP policy rule was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP rule. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
cidrstringan IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported.
ip_policyRefobject describing the IP policy this IP Policy Rule belongs to
actionstringthe action to apply to the policy rule, either allow or deny

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa 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_2gsqM7Edewb0nGtEKhSrYDOeXc3

Parameters

NameTypeDescription
idstring
descriptionstringhuman-readable description of the source IPs of this IP rule. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
cidrstringan 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-05-23T20:36:21Z",
"description": "nyc office",
"id": "ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3",
"ip_policy": {
"id": "ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqM7JbZDBNsppXeR60IRtfdcZ"
},
"uri": "https://api.ngrok.com/ip_policy_rules/ipr_2gsqM7Edewb0nGtEKhSrYDOeXc3"
}

Fields

NameTypeDescription
idstringunique identifier for this IP policy rule
uristringURI of the IP policy rule API resource
created_atstringtimestamp when the IP policy rule was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP rule. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy rule. optional, max 4096 bytes.
cidrstringan IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported.
ip_policyRefobject describing the IP policy this IP Policy Rule belongs to
actionstringthe action to apply to the policy rule, either allow or deny

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa uri for locating a resource