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

NameTypeDescription
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

{
"created_at": "2024-05-23T20:36:00Z",
"description": "API Outbound Gateway",
"id": "ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs"
}

Fields

NameTypeDescription
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_2gsqJTWcYNgdyt27CYoWMe8ODqs

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_2gsqJTWcYNgdyt27CYoWMe8ODqs

Response

Returns a 200 response on success

Example Response

{
"created_at": "2024-05-23T20:36:00Z",
"description": "API Outbound Gateway",
"id": "ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs",
"metadata": "metadata={\"pod-id\": \"b3d9c464-4f48-4783-a741-d7d7d5db310f\"}",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs"
}

Fields

NameTypeDescription
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": [
{
"created_at": "2024-05-23T20:36:00Z",
"description": "API Outbound Gateway",
"id": "ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs"
},
{
"created_at": "2024-05-23T20:36:00Z",
"description": "Developer Environments",
"id": "ipp_2gsqJQ8636mHIVyUCx2pQ91FnSv",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqJQ8636mHIVyUCx2pQ91FnSv"
}
],
"next_page_uri": null,
"uri": "https://api.ngrok.com/ip_policies"
}

Fields

NameTypeDescription
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

NameTypeDescription
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_2gsqJTWcYNgdyt27CYoWMe8ODqs

Parameters

NameTypeDescription
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

{
"created_at": "2024-05-23T20:36:00Z",
"description": "API Outbound Gateway",
"id": "ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs",
"metadata": "metadata={\"pod-id\": \"b3d9c464-4f48-4783-a741-d7d7d5db310f\"}",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqJTWcYNgdyt27CYoWMe8ODqs"
}

Fields

NameTypeDescription
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.