curl --request POST \
--url https://api.ngrok.com/edges/tcp \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'ngrok-version: <ngrok-version>' \
--data '
{
"description": "<string>",
"metadata": "<string>",
"hostports": [
"<string>"
],
"backend": {
"enabled": true,
"backend_id": "<string>"
},
"ip_restriction": {
"enabled": true,
"ip_policy_ids": [
"<string>"
]
},
"traffic_policy": {
"enabled": true,
"value": "<string>"
}
}
'import requests
url = "https://api.ngrok.com/edges/tcp"
payload = {
"description": "<string>",
"metadata": "<string>",
"hostports": ["<string>"],
"backend": {
"enabled": True,
"backend_id": "<string>"
},
"ip_restriction": {
"enabled": True,
"ip_policy_ids": ["<string>"]
},
"traffic_policy": {
"enabled": True,
"value": "<string>"
}
}
headers = {
"ngrok-version": "<ngrok-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'ngrok-version': '<ngrok-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: '<string>',
metadata: '<string>',
hostports: ['<string>'],
backend: {enabled: true, backend_id: '<string>'},
ip_restriction: {enabled: true, ip_policy_ids: ['<string>']},
traffic_policy: {enabled: true, value: '<string>'}
})
};
fetch('https://api.ngrok.com/edges/tcp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ngrok.com/edges/tcp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'description' => '<string>',
'metadata' => '<string>',
'hostports' => [
'<string>'
],
'backend' => [
'enabled' => true,
'backend_id' => '<string>'
],
'ip_restriction' => [
'enabled' => true,
'ip_policy_ids' => [
'<string>'
]
],
'traffic_policy' => [
'enabled' => true,
'value' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"ngrok-version: <ngrok-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ngrok.com/edges/tcp"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"metadata\": \"<string>\",\n \"hostports\": [\n \"<string>\"\n ],\n \"backend\": {\n \"enabled\": true,\n \"backend_id\": \"<string>\"\n },\n \"ip_restriction\": {\n \"enabled\": true,\n \"ip_policy_ids\": [\n \"<string>\"\n ]\n },\n \"traffic_policy\": {\n \"enabled\": true,\n \"value\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ngrok-version", "<ngrok-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ngrok.com/edges/tcp")
.header("ngrok-version", "<ngrok-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"metadata\": \"<string>\",\n \"hostports\": [\n \"<string>\"\n ],\n \"backend\": {\n \"enabled\": true,\n \"backend_id\": \"<string>\"\n },\n \"ip_restriction\": {\n \"enabled\": true,\n \"ip_policy_ids\": [\n \"<string>\"\n ]\n },\n \"traffic_policy\": {\n \"enabled\": true,\n \"value\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ngrok.com/edges/tcp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ngrok-version"] = '<ngrok-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"metadata\": \"<string>\",\n \"hostports\": [\n \"<string>\"\n ],\n \"backend\": {\n \"enabled\": true,\n \"backend_id\": \"<string>\"\n },\n \"ip_restriction\": {\n \"enabled\": true,\n \"ip_policy_ids\": [\n \"<string>\"\n ]\n },\n \"traffic_policy\": {\n \"enabled\": true,\n \"value\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"description": "<string>",
"metadata": "<string>",
"created_at": "<string>",
"uri": "<string>",
"hostports": [
"<string>"
],
"backend": {
"enabled": true,
"backend": {
"id": "<string>",
"uri": "<string>"
}
},
"ip_restriction": {
"enabled": true,
"ip_policies": [
{
"id": "<string>",
"uri": "<string>"
}
]
},
"traffic_policy": {
"enabled": true,
"value": "<string>"
}
}Create
Create a TCP Edge
curl --request POST \
--url https://api.ngrok.com/edges/tcp \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'ngrok-version: <ngrok-version>' \
--data '
{
"description": "<string>",
"metadata": "<string>",
"hostports": [
"<string>"
],
"backend": {
"enabled": true,
"backend_id": "<string>"
},
"ip_restriction": {
"enabled": true,
"ip_policy_ids": [
"<string>"
]
},
"traffic_policy": {
"enabled": true,
"value": "<string>"
}
}
'import requests
url = "https://api.ngrok.com/edges/tcp"
payload = {
"description": "<string>",
"metadata": "<string>",
"hostports": ["<string>"],
"backend": {
"enabled": True,
"backend_id": "<string>"
},
"ip_restriction": {
"enabled": True,
"ip_policy_ids": ["<string>"]
},
"traffic_policy": {
"enabled": True,
"value": "<string>"
}
}
headers = {
"ngrok-version": "<ngrok-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'ngrok-version': '<ngrok-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: '<string>',
metadata: '<string>',
hostports: ['<string>'],
backend: {enabled: true, backend_id: '<string>'},
ip_restriction: {enabled: true, ip_policy_ids: ['<string>']},
traffic_policy: {enabled: true, value: '<string>'}
})
};
fetch('https://api.ngrok.com/edges/tcp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ngrok.com/edges/tcp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'description' => '<string>',
'metadata' => '<string>',
'hostports' => [
'<string>'
],
'backend' => [
'enabled' => true,
'backend_id' => '<string>'
],
'ip_restriction' => [
'enabled' => true,
'ip_policy_ids' => [
'<string>'
]
],
'traffic_policy' => [
'enabled' => true,
'value' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"ngrok-version: <ngrok-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ngrok.com/edges/tcp"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"metadata\": \"<string>\",\n \"hostports\": [\n \"<string>\"\n ],\n \"backend\": {\n \"enabled\": true,\n \"backend_id\": \"<string>\"\n },\n \"ip_restriction\": {\n \"enabled\": true,\n \"ip_policy_ids\": [\n \"<string>\"\n ]\n },\n \"traffic_policy\": {\n \"enabled\": true,\n \"value\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ngrok-version", "<ngrok-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ngrok.com/edges/tcp")
.header("ngrok-version", "<ngrok-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"metadata\": \"<string>\",\n \"hostports\": [\n \"<string>\"\n ],\n \"backend\": {\n \"enabled\": true,\n \"backend_id\": \"<string>\"\n },\n \"ip_restriction\": {\n \"enabled\": true,\n \"ip_policy_ids\": [\n \"<string>\"\n ]\n },\n \"traffic_policy\": {\n \"enabled\": true,\n \"value\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ngrok.com/edges/tcp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ngrok-version"] = '<ngrok-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"metadata\": \"<string>\",\n \"hostports\": [\n \"<string>\"\n ],\n \"backend\": {\n \"enabled\": true,\n \"backend_id\": \"<string>\"\n },\n \"ip_restriction\": {\n \"enabled\": true,\n \"ip_policy_ids\": [\n \"<string>\"\n ]\n },\n \"traffic_policy\": {\n \"enabled\": true,\n \"value\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"description": "<string>",
"metadata": "<string>",
"created_at": "<string>",
"uri": "<string>",
"hostports": [
"<string>"
],
"backend": {
"enabled": true,
"backend": {
"id": "<string>",
"uri": "<string>"
}
},
"ip_restriction": {
"enabled": true,
"ip_policies": [
{
"id": "<string>",
"uri": "<string>"
}
]
},
"traffic_policy": {
"enabled": true,
"value": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
human-readable description of what this edge will be used for; optional, max 255 bytes.
arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes.
hostports served by this edge
edge modules
Show child attributes
Show child attributes
n/a
Show child attributes
Show child attributes
the traffic policy associated with this edge or null
Show child attributes
Show child attributes
Response
Create a TCP Edge
unique identifier of this edge
human-readable description of what this edge will be used for; optional, max 255 bytes.
arbitrary user-defined machine-readable data of this edge. Optional, max 4096 bytes.
timestamp when the edge was created, RFC 3339 format
URI of the edge API resource
hostports served by this edge
edge modules
Show child attributes
Show child attributes
n/a
Show child attributes
Show child attributes
the traffic policy associated with this edge or null
Show child attributes
Show child attributes
Was this page helpful?