列出应用的出站连接
通过 GET /v2/apps/:app_id/network/outbound 查看应用在过去 15 分钟内连接了谁,按主机名列出:平台、连接数、请求频率和发送字节数。
GET
/
v2
/
apps
/
{app_id}
/
network
/
outbound
列出应用的出站连接
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/network/outbound \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/network/outbound"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/network/outbound', 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.squarecloud.app/v2/apps/{app_id}/network/outbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.squarecloud.app/v2/apps/{app_id}/network/outbound"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.squarecloud.app/v2/apps/{app_id}/network/outbound")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/network/outbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": {
"window": { "from": "2026-11-25T14:05:00.000Z", "to": "2026-11-25T14:20:00.000Z" },
"hosts": [
{
"host": "discord.com",
"platform": "discord",
"source": "sni",
"protocol": "tcp",
"connections": 42,
"requests_per_second": 11.8,
"bytes_out": 1843200,
"first_seen": "2026-11-25T14:05:02.000Z",
"last_seen": "2026-11-25T14:19:58.000Z",
"destinations": ["162.159.135.232:443"],
"approx": false
}
],
"other": { "hosts": 12, "connections": 31 },
"connections_per_minute": [
{ "at": "2026-11-25T14:05:00.000Z", "count": 3 },
{ "at": "2026-11-25T14:06:00.000Z", "count": 5 }
]
}
}
返回应用自身在过去 15 分钟内连接了谁,每个主机名一行,即 Square Shield 所看到的情况。它与网络日志方向相反,后者显示经由边缘到达网站的请求;它适用于任何应用(包括机器人)和任何套餐。
需要具有
每个应用每分钟最多调用 10 次,超出后会被封锁 60 秒。
你账户的 API 密钥。你可以在账户设置中找到它。
apps:read 权限范围的 API 密钥。在 workspace 共享的应用上,调用者需要具备 manager 或 admin 角色。
可以用它查看机器人在和谁通信,或找出导致 Square Shield 因请求发出警告或停止的代码。最多列出 64 个主机名,其余的计入 other。只有 Square Shield 监控的外部 API(例如 Discord)才有请求频率和发送字节数,其他情况为 null。已停止的应用返回空的 hosts。
参数
响应
响应的内容。
显示 属性
显示 属性
每个主机名一行,最多 64 行。
显示 属性
显示 属性
最多 3 个目标地址,格式为
ip:port。在 squareweb.app 或 squarecloud.app 主机名背后的 IPv4 地址只显示第一个和最后一个八位组(104.XXX.XXX.191:443)。{
"status": "success",
"response": {
"window": { "from": "2026-11-25T14:05:00.000Z", "to": "2026-11-25T14:20:00.000Z" },
"hosts": [
{
"host": "discord.com",
"platform": "discord",
"source": "sni",
"protocol": "tcp",
"connections": 42,
"requests_per_second": 11.8,
"bytes_out": 1843200,
"first_seen": "2026-11-25T14:05:02.000Z",
"last_seen": "2026-11-25T14:19:58.000Z",
"destinations": ["162.159.135.232:443"],
"approx": false
}
],
"other": { "hosts": 12, "connections": 31 },
"connections_per_minute": [
{ "at": "2026-11-25T14:05:00.000Z", "count": 3 },
{ "at": "2026-11-25T14:06:00.000Z", "count": 5 }
]
}
}
常见错误
| 代码 | HTTP | 说明 |
|---|---|---|
PERMISSION_DENIED | 403 | 在 workspace 共享的应用上,你的角色既不是 manager 也不是 admin。 |
APP_NOT_FOUND | 404 | 应用不存在,或你无权访问它。 |
OUTBOUND_UNAVAILABLE | 409 | Square Shield 目前没有在应用所在的服务器上记录出站连接。请稍后再试。 |
KEEP_CALM | 429 | 一分钟内对此应用的调用超过 10 次。请等待一分钟后重试。 |
OUTBOUND_FAILED | 500 | 无法读取连接。请稍后重试。 |
相关内容
- 网络日志:经由边缘到达网站的请求。
- 超出限制的状态:Square Shield 会停止或限制什么,以及如何修复。
- MCP:
get_outbound_connections
⌘I
列出应用的出站连接
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/network/outbound \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/network/outbound"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/network/outbound', 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.squarecloud.app/v2/apps/{app_id}/network/outbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.squarecloud.app/v2/apps/{app_id}/network/outbound"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.squarecloud.app/v2/apps/{app_id}/network/outbound")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/network/outbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": {
"window": { "from": "2026-11-25T14:05:00.000Z", "to": "2026-11-25T14:20:00.000Z" },
"hosts": [
{
"host": "discord.com",
"platform": "discord",
"source": "sni",
"protocol": "tcp",
"connections": 42,
"requests_per_second": 11.8,
"bytes_out": 1843200,
"first_seen": "2026-11-25T14:05:02.000Z",
"last_seen": "2026-11-25T14:19:58.000Z",
"destinations": ["162.159.135.232:443"],
"approx": false
}
],
"other": { "hosts": 12, "connections": 31 },
"connections_per_minute": [
{ "at": "2026-11-25T14:05:00.000Z", "count": 3 },
{ "at": "2026-11-25T14:06:00.000Z", "count": 5 }
]
}
}

