Skip to main content

IP Restrictions

Create IP Restriction

Create a new IP restriction

Request

POST /ip_restrictions

Example Request

curl \
-X POST \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"ip_policy_ids":["ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY"],"type":"dashboard"}' \
https://api.ngrok.com/ip_restrictions

Parameters

NameTypeDescription
descriptionstringhuman-readable description of this IP restriction. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
enforcedbooleantrue if the IP restriction will be enforced. if false, only warnings will be issued
typestringthe type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: dashboard, api, agent, and endpoints
ip_policy_idsList<string>the set of IP policy identifiers that are used to enforce the restriction

Response

Returns a 201 response on success

Example Response

{
"created_at": "2024-05-23T20:36:22Z",
"enforced": false,
"id": "ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs",
"ip_policies": [
{
"id": "ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY"
}
],
"type": "dashboard",
"uri": "https://api.ngrok.com/ip_restrictions/ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs"
}

Fields

NameTypeDescription
idstringunique identifier for this IP restriction
uristringURI of the IP restriction API resource
created_atstringtimestamp when the IP restriction was created, RFC 3339 format
descriptionstringhuman-readable description of this IP restriction. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
enforcedbooleantrue if the IP restriction will be enforced. if false, only warnings will be issued
typestringthe type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: dashboard, api, agent, and endpoints
ip_policiesRefthe set of IP policies that are used to enforce the restriction

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa uri for locating a resource

Delete IP Restriction

Delete an IP restriction

Request

DELETE /ip_restrictions/{id}

Example Request

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

Response

Returns a 204 response with no body on success

Get IP Restriction

Get detailed information about an IP restriction

Request

GET /ip_restrictions/{id}

Example Request

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

Response

Returns a 200 response on success

Example Response

{
"created_at": "2024-05-23T20:36:22Z",
"enforced": false,
"id": "ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs",
"ip_policies": [
{
"id": "ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY"
},
{
"id": "ipp_2gsqMDxlc6R4kmHxwDVR8RLxtyt",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqMDxlc6R4kmHxwDVR8RLxtyt"
}
],
"type": "dashboard",
"uri": "https://api.ngrok.com/ip_restrictions/ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs"
}

Fields

NameTypeDescription
idstringunique identifier for this IP restriction
uristringURI of the IP restriction API resource
created_atstringtimestamp when the IP restriction was created, RFC 3339 format
descriptionstringhuman-readable description of this IP restriction. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
enforcedbooleantrue if the IP restriction will be enforced. if false, only warnings will be issued
typestringthe type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: dashboard, api, agent, and endpoints
ip_policiesRefthe set of IP policies that are used to enforce the restriction

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa uri for locating a resource

List IP Restrictions

List all IP restrictions on this account

Request

GET /ip_restrictions

Example Request

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

Response

Returns a 200 response on success

Example Response

{
"ip_restrictions": [
{
"created_at": "2024-05-23T20:36:22Z",
"enforced": false,
"id": "ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs",
"ip_policies": [
{
"id": "ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY"
}
],
"type": "dashboard",
"uri": "https://api.ngrok.com/ip_restrictions/ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs"
}
],
"next_page_uri": null,
"uri": "https://api.ngrok.com/ip_restrictions"
}

Fields

NameTypeDescription
ip_restrictionsIPRestrictionthe list of all IP restrictions on this account
uristringURI of the IP restrictions list API resource
next_page_uristringURI of the next page, or null if there is no next page

IPRestriction fields

NameTypeDescription
idstringunique identifier for this IP restriction
uristringURI of the IP restriction API resource
created_atstringtimestamp when the IP restriction was created, RFC 3339 format
descriptionstringhuman-readable description of this IP restriction. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
enforcedbooleantrue if the IP restriction will be enforced. if false, only warnings will be issued
typestringthe type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: dashboard, api, agent, and endpoints
ip_policiesRefthe set of IP policies that are used to enforce the restriction

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa uri for locating a resource

Update IP Restriction

Update attributes of an IP restriction by ID

Request

PATCH /ip_restrictions/{id}

Example Request

curl \
-X PATCH \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"ip_policy_ids":["ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY","ipp_2gsqMDxlc6R4kmHxwDVR8RLxtyt"]}' \
https://api.ngrok.com/ip_restrictions/ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs

Parameters

NameTypeDescription
idstring
descriptionstringhuman-readable description of this IP restriction. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
enforcedbooleantrue if the IP restriction will be enforced. if false, only warnings will be issued
ip_policy_idsList<string>the set of IP policy identifiers that are used to enforce the restriction

Response

Returns a 200 response on success

Example Response

{
"created_at": "2024-05-23T20:36:22Z",
"enforced": false,
"id": "ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs",
"ip_policies": [
{
"id": "ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqMCkWqsj4QOSB1tzsTKGeEIY"
},
{
"id": "ipp_2gsqMDxlc6R4kmHxwDVR8RLxtyt",
"uri": "https://api.ngrok.com/ip_policies/ipp_2gsqMDxlc6R4kmHxwDVR8RLxtyt"
}
],
"type": "dashboard",
"uri": "https://api.ngrok.com/ip_restrictions/ipx_2gsqMETDQdEq5JZyqL6YjUgp4Zs"
}

Fields

NameTypeDescription
idstringunique identifier for this IP restriction
uristringURI of the IP restriction API resource
created_atstringtimestamp when the IP restriction was created, RFC 3339 format
descriptionstringhuman-readable description of this IP restriction. optional, max 255 bytes.
metadatastringarbitrary user-defined machine-readable data of this IP restriction. optional, max 4096 bytes.
enforcedbooleantrue if the IP restriction will be enforced. if false, only warnings will be issued
typestringthe type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: dashboard, api, agent, and endpoints
ip_policiesRefthe set of IP policies that are used to enforce the restriction

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa uri for locating a resource