curl --request POST \
--url https://api.primeintellect.ai/api/v1/tunnel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"local_port": 8765,
"teamId": "<string>",
"labels": [
"<string>"
],
"httpUser": "<string>"
}
'import requests
url = "https://api.primeintellect.ai/api/v1/tunnel"
payload = {
"name": "<string>",
"local_port": 8765,
"teamId": "<string>",
"labels": ["<string>"],
"httpUser": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
local_port: 8765,
teamId: '<string>',
labels: ['<string>'],
httpUser: '<string>'
})
};
fetch('https://api.primeintellect.ai/api/v1/tunnel', 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.primeintellect.ai/api/v1/tunnel",
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([
'name' => '<string>',
'local_port' => 8765,
'teamId' => '<string>',
'labels' => [
'<string>'
],
'httpUser' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.primeintellect.ai/api/v1/tunnel"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"local_port\": 8765,\n \"teamId\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"httpUser\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.primeintellect.ai/api/v1/tunnel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"local_port\": 8765,\n \"teamId\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"httpUser\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.primeintellect.ai/api/v1/tunnel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"local_port\": 8765,\n \"teamId\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"httpUser\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tunnel_id": "<string>",
"hostname": "<string>",
"url": "<string>",
"frp_token": "<string>",
"binding_secret": "<string>",
"server_host": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"server_port": 7000,
"labels": [
"<string>"
],
"http_user": "<string>",
"http_password": "<string>"
}{
"errors": [
{
"param": "<string>",
"details": "<string>"
}
]
}Create Tunnel Endpoint
Create a new tunnel for exposing a local service.
curl --request POST \
--url https://api.primeintellect.ai/api/v1/tunnel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"local_port": 8765,
"teamId": "<string>",
"labels": [
"<string>"
],
"httpUser": "<string>"
}
'import requests
url = "https://api.primeintellect.ai/api/v1/tunnel"
payload = {
"name": "<string>",
"local_port": 8765,
"teamId": "<string>",
"labels": ["<string>"],
"httpUser": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
local_port: 8765,
teamId: '<string>',
labels: ['<string>'],
httpUser: '<string>'
})
};
fetch('https://api.primeintellect.ai/api/v1/tunnel', 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.primeintellect.ai/api/v1/tunnel",
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([
'name' => '<string>',
'local_port' => 8765,
'teamId' => '<string>',
'labels' => [
'<string>'
],
'httpUser' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.primeintellect.ai/api/v1/tunnel"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"local_port\": 8765,\n \"teamId\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"httpUser\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.primeintellect.ai/api/v1/tunnel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"local_port\": 8765,\n \"teamId\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"httpUser\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.primeintellect.ai/api/v1/tunnel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"local_port\": 8765,\n \"teamId\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"httpUser\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tunnel_id": "<string>",
"hostname": "<string>",
"url": "<string>",
"frp_token": "<string>",
"binding_secret": "<string>",
"server_host": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"server_port": 7000,
"labels": [
"<string>"
],
"http_user": "<string>",
"http_password": "<string>"
}{
"errors": [
{
"param": "<string>",
"details": "<string>"
}
]
}Rate Limit
600 requests per 60 seconds per user.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request to create a new tunnel.
Optional friendly name for the tunnel
1 - 64Local port the tunnel will forward traffic to
1 <= x <= 65535Team ID for team tunnels
Labels/tags for the tunnel
50Username for HTTP basic auth on tunnel traffic. Setting this enables auth; the password is auto-generated server-side and returned once in the create response.
1 - 64Response
Successful Response
Response containing tunnel connection details.
Unique tunnel identifier
Full hostname for the tunnel
Full HTTPS URL for accessing the tunnel
Authentication token for frpc client
Per-tunnel secret for additional authentication via frpc metadata
frps server hostname
Token expiration timestamp
frps server port
Tunnel labels
HTTP basic auth username, if auth is enabled
Auto-generated HTTP basic auth password, if auth is enabled. Only returned at creation; stored encrypted and never retrievable afterwards.
Was this page helpful?