Skip to main content

IP Policies


Create IP Policy

Create a new IP policy. It will not apply to any traffic until you associate to a traffic source via an endpoint configuration or IP restriction.

Request

POST /ip_policies

Example Request

curl \
-X POST \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"description":"API Outbound Gateway"}' \
https://api.ngrok.com/ip_policies

Parameters

   
descriptionstringhuman-readable description of the source IPs of this IP policy. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.

Response

Returns a 201 response on success

Example Response

{
"id": "ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"created_at": "2023-07-31T23:17:17Z",
"description": "API Outbound Gateway"
}

Fields

   
idstringunique identifier for this IP policy
uristringURI of the IP Policy API resource
created_atstringtimestamp when the IP policy was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP policy. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.

Delete IP Policy

Delete an IP policy. If the IP policy is referenced by another object for the purposes of traffic restriction it will be treated as if the IP policy remains but has zero rules.

Request

DELETE /ip_policies/{id}

Example Request

curl \
-X DELETE \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/ip_policies/ipp_2TMGGCISN6MLWglZBZWrmyzPoA2

Response

Returns a 204 response with no body on success

Get IP Policy

Get detailed information about an IP policy by ID.

Request

GET /ip_policies/{id}

Example Request

curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/ip_policies/ipp_2TMGGCISN6MLWglZBZWrmyzPoA2

Response

Returns a 200 response on success

Example Response

{
"id": "ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"created_at": "2023-07-31T23:17:17Z",
"description": "API Outbound Gateway",
"metadata": "metadata={\"pod-id\": \"b3d9c464-4f48-4783-a741-d7d7d5db310f\"}"
}

Fields

   
idstringunique identifier for this IP policy
uristringURI of the IP Policy API resource
created_atstringtimestamp when the IP policy was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP policy. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.

List IP Policies

List all IP policies on this account

Request

GET /ip_policies

Example Request

curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/ip_policies

Response

Returns a 200 response on success

Example Response

{
"ip_policies": [
{
"id": "ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"created_at": "2023-07-31T23:17:17Z",
"description": "API Outbound Gateway"
},
{
"id": "ipp_2TMGG77q6dAqx34tc2W8nAO3STY",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGG77q6dAqx34tc2W8nAO3STY",
"created_at": "2023-07-31T23:17:17Z",
"description": "Developer Environments"
}
],
"uri": "https://api.ngrok.com/ip_policies",
"next_page_uri": null
}

Fields

   
ip_policiesIPPolicythe list of all IP policies on this account
uristringURI of the IP policy list API resource
next_page_uristringURI of the next page, or null if there is no next page

IPPolicy fields

   
idstringunique identifier for this IP policy
uristringURI of the IP Policy API resource
created_atstringtimestamp when the IP policy was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP policy. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.

Update IP Policy

Update attributes of an IP policy by ID

Request

PATCH /ip_policies/{id}

Example Request

curl \
-X PATCH \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"metadata":"metadata={\"pod-id\": \"b3d9c464-4f48-4783-a741-d7d7d5db310f\"}"}' \
https://api.ngrok.com/ip_policies/ipp_2TMGGCISN6MLWglZBZWrmyzPoA2

Parameters

   
idstring
descriptionstringhuman-readable description of the source IPs of this IP policy. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.

Response

Returns a 200 response on success

Example Response

{
"id": "ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"uri": "https://api.ngrok.com/ip_policies/ipp_2TMGGCISN6MLWglZBZWrmyzPoA2",
"created_at": "2023-07-31T23:17:17Z",
"description": "API Outbound Gateway",
"metadata": "metadata={\"pod-id\": \"b3d9c464-4f48-4783-a741-d7d7d5db310f\"}"
}

Fields

   
idstringunique identifier for this IP policy
uristringURI of the IP Policy API resource
created_atstringtimestamp when the IP policy was created, RFC 3339 format
descriptionstringhuman-readable description of the source IPs of this IP policy. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP policy. optional, max 4096 bytes.