Skip to main content

Tcp Edge Policies Module

Replace TCP Edge Policy Module

Request

PUT /edges/tcp/{id}/policies

Example Request

curl \
-X PUT \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"enabled":true,"inbound":[{"expressions":["conn.Geo.Latitude \u003e= \"45.0\" \u0026\u0026 conn.Geo.Longitude \u003c= \"-93.0\""],"actions":[{"type":"deny"}],"name":"Block Inbound Traffic From Specific Geographical Area."}],"outbound":[{"expressions":["conn.Geo.CountryCode in [\"US\", \"CA\", \"MX\", \"GT\", \"BZ\", \"SV\"] \u0026\u0026 conn.ClientIP == \"192.0.2.0\""],"actions":[{"type":"log","config":{"Metadata":{"Message":"Outbound Traffic to North America with IP 192.0.2.0"}}}],"name":"Log Outbound Traffic From Specific Country Codes"}]}' \
https://api.ngrok.com/edges/tcp/edgtcp_2bIPj6oQwNg5kIeZv6hDuNQoGy0/policies

Parameters

NameTypeDescription
enabledboolean
inboundEndpointPolicy
outboundEndpointPolicy

EndpointPolicy parameters

NameTypeDescription
expressionsList<string>
actionsEndpointAction
namestring

EndpointAction parameters

NameTypeDescription
typestring
configobject

Response

Returns a 200 response on success

Example Response

{
"enabled": true,
"inbound": [
{
"expressions": [
"conn.Geo.Latitude \u003e= \"45.0\" \u0026\u0026 conn.Geo.Longitude \u003c= \"-93.0\""
],
"actions": [
{
"type": "deny",
"config": null
}
],
"name": "Block Inbound Traffic From Specific Geographical Area."
}
],
"outbound": [
{
"expressions": [
"conn.Geo.CountryCode in [\"US\", \"CA\", \"MX\", \"GT\", \"BZ\", \"SV\"] \u0026\u0026 conn.ClientIP == \"192.0.2.0\""
],
"actions": [
{
"type": "log",
"config": {
"Metadata": {
"Message": "Outbound Traffic to North America with IP 192.0.2.0"
}
}
}
],
"name": "Log Outbound Traffic From Specific Country Codes"
}
]
}

Fields

NameTypeDescription
enabledboolean
inboundEndpointPolicy
outboundEndpointPolicy

EndpointPolicy fields

NameTypeDescription
expressionsList<string>
actionsEndpointAction
namestring

EndpointAction fields

NameTypeDescription
typestring
configobject

Get TCP Edge Policy Module

Request

GET /edges/tcp/{id}/policies

Example Request

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

Response

Returns a 200 response on success

Example Response

{
"enabled": true,
"inbound": [
{
"expressions": [
"conn.Geo.Latitude \u003e= \"45.0\" \u0026\u0026 conn.Geo.Longitude \u003c= \"-93.0\""
],
"actions": [
{
"type": "deny",
"config": null
}
],
"name": "Block Inbound Traffic From Specific Geographical Area."
}
],
"outbound": [
{
"expressions": [
"conn.Geo.CountryCode in [\"US\", \"CA\", \"MX\", \"GT\", \"BZ\", \"SV\"] \u0026\u0026 conn.ClientIP == \"192.0.2.0\""
],
"actions": [
{
"type": "log",
"config": {
"Metadata": {
"Message": "Outbound Traffic to North America with IP 192.0.2.0"
}
}
}
],
"name": "Log Outbound Traffic From Specific Country Codes"
}
]
}

Fields

NameTypeDescription
enabledboolean
inboundEndpointPolicy
outboundEndpointPolicy

EndpointPolicy fields

NameTypeDescription
expressionsList<string>
actionsEndpointAction
namestring

EndpointAction fields

NameTypeDescription
typestring
configobject

Delete TCP Edge Policy Module

Request

DELETE /edges/tcp/{id}/policies

Example Request

curl \
-X DELETE \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/edges/tcp/edgtcp_2bIPj6oQwNg5kIeZv6hDuNQoGy0/policies

Response

Returns a 204 response with no body on success