DolphinBrowser Local API

本机接口由已登录的客户端提供,默认监听 http://127.0.0.1:52702。端口被占用时会递增。开启安全校验后,除「接口状态」外,每个请求都要带请求头 X-API-Key。同一端口的 POST /mcp 是 MCP Server,工具名与下面的接口 id 一致。

统一响应:{"code":0,"msg":"Success","data":{...}}。code 非 0 表示失败,msg 为原因。示例里的 YOUR_API_KEY、环境 ID 请换成客户端页面上的实际值。地址中的端口会按打开本页时的 ?port= 替换。

接口状态

检查本机接口是否在监听,以及客户端是否已登录。此接口不校验 API Key。

GET /api/v1/status

请求参数

字段位置类型必填说明
无

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
okboolean进程已在监听时为 true
portnumber实际监听端口
loggedInboolean客户端当前是否已登录
authRequiredboolean是否开启了安全校验

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "ok": true,
    "port": 52702,
    "loggedIn": true,
    "authRequired": false
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/status' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/status", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/status"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/status"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/status");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/status", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/status");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/status' \
  -H 'X-API-Key: YOUR_API_KEY'

启动浏览器

按环境配置在本机拉起浏览器。未安装对应内核时会失败,需先调用下载内核。

POST /api/v1/browser/start

请求参数

字段位置类型必填说明
profileIdBodystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
pidnumber浏览器进程 PID
debugPortnumberCDP / Marionette 调试端口
webSocketDebuggerUrlstring | null浏览器级 WebSocket 调试地址,Firefox 可能为空
statusSyncedboolean是否已把运行状态同步到云端

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "pid": 12345,
    "debugPort": 9222,
    "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/xxxx",
    "statusSynced": true
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/browser/start' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileId\": \"cmxxxxxxxx\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/browser/start", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/browser/start"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/browser/start"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileId\": \"cmxxxxxxxx\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/start");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/browser/start", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/start");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/start' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'

关闭浏览器

关闭指定环境的浏览器进程,并把云端状态改为未打开。

POST /api/v1/browser/stop

请求参数

字段位置类型必填说明
profileIdBodystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
stoppedboolean本次是否关闭了一个正在运行的进程

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "stopped": true
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileId\": \"cmxxxxxxxx\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/browser/stop", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/browser/stop"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/browser/stop"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileId\": \"cmxxxxxxxx\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/browser/stop", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'

浏览器状态

查询某个环境当前是否已在本机打开,以及调试端口。

GET /api/v1/browser/status

请求参数

字段位置类型必填说明
profileIdQuerystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
openedboolean是否已打开
pidnumber | null进程 PID,未打开时为 null
debugPortnumber | null调试端口
webSocketDebuggerUrlstring | nullWebSocket 调试地址

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "opened": true,
    "pid": 12345,
    "debugPort": 9222,
    "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/xxxx"
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/status?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'

环境已被打开

环境已在本机打开时返回成功;未打开时 code 非 0,msg 为「环境未被打开」。

GET /api/v1/browser/opened

请求参数

字段位置类型必填说明
profileIdQuerystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
debugPortnumber调试端口
pidnumber进程 PID

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "debugPort": 9222,
    "pid": 12345
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/opened?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'

环境未被打开

环境未打开时返回成功;已经打开时 code 非 0,msg 为「环境已被打开」。

GET /api/v1/browser/closed

请求参数

字段位置类型必填说明
profileIdQuerystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
openedboolean固定为 false

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "opened": false
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/closed?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'

查询已启动浏览器

列出当前这台电脑上已启动的全部环境。

GET /api/v1/browser/started

请求参数

字段位置类型必填说明
无

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
listarray已启动环境
list[].profileIdstring环境 ID
list[].pidnumber进程 PID
list[].debugPortnumber调试端口
list[].webSocketDebuggerUrlstring | nullWebSocket 调试地址
list[].startedAtnumber启动时间戳(毫秒)

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "list": [
      {
        "profileId": "cmxxxxxxxx",
        "pid": 12345,
        "debugPort": 9222,
        "webSocketDebuggerUrl": "ws://127.0.0.1:9222/devtools/browser/xxxx",
        "startedAt": 1710000000000
      }
    ]
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/browser/started' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/browser/started", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/browser/started"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/browser/started"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/started");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/browser/started", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/started");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/browser/started' \
  -H 'X-API-Key: YOUR_API_KEY'

查询环境

分页查询当前账号可见的浏览器环境。

GET /api/v1/profiles

请求参数

字段位置类型必填说明
pageQuerynumber否页码,从 1 开始
pageSizeQuerynumber否每页条数,1–500,默认 50
keywordQuerystring否按名称、备注、序号搜索
groupIdQuerystring否分组 ID
statusQuerystring否idle 或 running
kernelBrandQuerystring否chrome 或 firefox

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
listarray环境列表,字段见下
list[].idstring环境 ID
list[].serialnumber环境序号
list[].shortIdstring短 ID,缓存目录与启动页使用
list[].namestring环境名称
list[].groupIdstring | null分组 ID,未分组为 null
list[].groupNamestring | null分组名称
list[].tagsstring[]标签名
list[].statusstringidle 未打开,running 运行中
list[].kernelBrandstring内核品牌:chrome / firefox
list[].kernelVersionnumber | null内核主版本,null 表示智能匹配
list[].cacheDirNamestring本地缓存目录名
totalnumber符合条件的总数
pagenumber当前页
pageSizenumber每页条数

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "list": [
      {
        "id": "cmxxxxxxxx",
        "serial": 1,
        "shortId": "kabcd123",
        "name": "店铺A",
        "groupId": null,
        "groupName": null,
        "tags": [
          "常用"
        ],
        "status": "idle",
        "kernelBrand": "chrome",
        "kernelVersion": 120,
        "cacheDirName": "kabcd123_tenant"
      }
    ],
    "total": 1,
    "page": 1,
    "pageSize": 20
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles?page=1&pageSize=20' \
  -H 'X-API-Key: YOUR_API_KEY'

新建浏览器

新建一个或多个环境。未传指纹时按内核与操作系统自动生成。

POST /api/v1/profiles

请求参数

字段位置类型必填说明
nameBodystring否环境名称
groupIdBodystring | null否分组 ID
tagsBodystring[]否标签名,不存在的会自动写入标签字典
remarkBodystring否备注
kernelBrandBodystring否chrome 或 firefox,默认 chrome
kernelVersionBodynumber | null否内核主版本,null 为智能匹配
fingerprintBodyobject否指纹补丁,可只传需要覆盖的字段,例如 os
proxyBodyobject否代理。type 可为 http / https / socks5 / ssh,host、port、username、password
cookiesBodystring否Cookie,JSON 数组或 Netscape 文本
startUrlsBodystring[]否启动时打开的网址
countBodynumber否一次创建的数量,1–100,默认 1

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring新建环境 ID。count>1 时 data 为环境数组
namestring名称
serialnumber序号
kernelBrandstring内核品牌

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "cmxxxxxxxx",
    "name": "店铺A",
    "serial": 12,
    "kernelBrand": "chrome"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/profiles' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "店铺A",  "kernelBrand": "chrome",  "kernelVersion": 120,  "fingerprint": {    "os": "Windows"  },  "proxy": {    "type": "http",    "host": "127.0.0.1",    "port": 7890  },  "count": 1}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"name\": \"店铺A\",  \"kernelBrand\": \"chrome\",  \"kernelVersion\": 120,  \"fingerprint\": {    \"os\": \"Windows\"  },  \"proxy\": {    \"type\": \"http\",    \"host\": \"127.0.0.1\",    \"port\": 7890  },  \"count\": 1}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"店铺A","kernelBrand":"chrome","kernelVersion":120,"fingerprint":{"os":"Windows"},"proxy":{"type":"http","host":"127.0.0.1","port":7890},"count":1}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"name\": \"店铺A\",  \"kernelBrand\": \"chrome\",  \"kernelVersion\": 120,  \"fingerprint\": {    \"os\": \"Windows\"  },  \"proxy\": {    \"type\": \"http\",    \"host\": \"127.0.0.1\",    \"port\": 7890  },  \"count\": 1}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"name\": \"店铺A\",  \"kernelBrand\": \"chrome\",  \"kernelVersion\": 120,  \"fingerprint\": {    \"os\": \"Windows\"  },  \"proxy\": {    \"type\": \"http\",    \"host\": \"127.0.0.1\",    \"port\": 7890  },  \"count\": 1}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name":"店铺A","kernelBrand":"chrome","kernelVersion":120,"fingerprint":{"os":"Windows"},"proxy":{"type":"http","host":"127.0.0.1","port":7890},"count":1}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"name\": \"店铺A\",  \"kernelBrand\": \"chrome\",  \"kernelVersion\": 120,  \"fingerprint\": {    \"os\": \"Windows\"  },  \"proxy\": {    \"type\": \"http\",    \"host\": \"127.0.0.1\",    \"port\": 7890  },  \"count\": 1}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "店铺A",  "kernelBrand": "chrome",  "kernelVersion": 120,  "fingerprint": {    "os": "Windows"  },  "proxy": {    "type": "http",    "host": "127.0.0.1",    "port": 7890  },  "count": 1}'

更新环境

按环境 ID 更新名称、备注、代理、指纹、标签、Cookie、启动页等。只传需要修改的字段。

POST /api/v1/profiles/update

请求参数

字段位置类型必填说明
profileIdBodystring是环境 ID
nameBodystring否名称
remarkBodystring否备注
groupIdBodystring | null否分组,null 表示移出分组
tagsBodystring[]否标签,整体替换
kernelBrandBodystring否内核品牌
kernelVersionBodynumber | null否内核主版本
proxyBodyobject否与现有代理合并
fingerprintBodyobject否与现有指纹合并
cookiesBodystring否Cookie
startUrlsBodystring[]否启动网址

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring环境 ID
namestring更新后的名称
updatedAtstring更新时间

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "cmxxxxxxxx",
    "name": "店铺A-已改",
    "updatedAt": "2026-09-22T08:00:00.000Z"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx",  "name": "店铺A-已改",  "remark": "备注"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileId\": \"cmxxxxxxxx\",  \"name\": \"店铺A-已改\",  \"remark\": \"备注\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/update", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx","name":"店铺A-已改","remark":"备注"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/update"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileId\": \"cmxxxxxxxx\",  \"name\": \"店铺A-已改\",  \"remark\": \"备注\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/update");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\",  \"name\": \"店铺A-已改\",  \"remark\": \"备注\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/update", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileId":"cmxxxxxxxx","name":"店铺A-已改","remark":"备注"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\",  \"name\": \"店铺A-已改\",  \"remark\": \"备注\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx",  "name": "店铺A-已改",  "remark": "备注"}'

删除环境

把环境移入回收站。若账号开启了删除环境的双重验证,需要额外带验证码。

POST /api/v1/profiles/delete

请求参数

字段位置类型必填说明
profileIdsBodystring[]是环境 ID 列表
channelBodystring否双重验证通道:email 或 sms,按需
sensitiveCodeBodystring否邮箱或短信验证码,按需
twoFactorCodeBodystring否身份验证器动态码,按需

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
countnumber实际删除数量

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "count": 1
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/delete' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileIds": [    "cmxxxxxxxx"  ]}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileIds\": [    \"cmxxxxxxxx\"  ]}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/delete", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/delete"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileIds":["cmxxxxxxxx"]}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/delete"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileIds\": [    \"cmxxxxxxxx\"  ]}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/delete");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileIds\": [    \"cmxxxxxxxx\"  ]}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/delete", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileIds":["cmxxxxxxxx"]}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileIds\": [    \"cmxxxxxxxx\"  ]}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/delete' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileIds": [    "cmxxxxxxxx"  ]}'

移动环境

把环境移动到指定分组。groupId 传 null 表示移出分组。

POST /api/v1/profiles/move

请求参数

字段位置类型必填说明
profileIdsBodystring[]是环境 ID 列表
groupIdBodystring | null是目标分组 ID,null 为未分组

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
countnumber移动数量

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "count": 1
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/move' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileIds": [    "cmxxxxxxxx"  ],  "groupId": "grpxxxxxxxx"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileIds\": [    \"cmxxxxxxxx\"  ],  \"groupId\": \"grpxxxxxxxx\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/move", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/move"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileIds":["cmxxxxxxxx"],"groupId":"grpxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/move"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileIds\": [    \"cmxxxxxxxx\"  ],  \"groupId\": \"grpxxxxxxxx\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/move");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileIds\": [    \"cmxxxxxxxx\"  ],  \"groupId\": \"grpxxxxxxxx\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/move", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileIds":["cmxxxxxxxx"],"groupId":"grpxxxxxxxx"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/move");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileIds\": [    \"cmxxxxxxxx\"  ],  \"groupId\": \"grpxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/move' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileIds": [    "cmxxxxxxxx"  ],  "groupId": "grpxxxxxxxx"}'

清除缓存

删除该环境在本机的缓存目录。环境正在运行时会拒绝。

POST /api/v1/profiles/clear-cache

请求参数

字段位置类型必填说明
profileIdBodystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
cacheDirNamestring被删除的缓存目录名
clearedboolean是否已清除

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "cacheDirName": "kabcd123_tenant",
    "cleared": true
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/clear-cache' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileId\": \"cmxxxxxxxx\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/clear-cache", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/clear-cache"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/clear-cache"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileId\": \"cmxxxxxxxx\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/clear-cache");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/clear-cache", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/clear-cache");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/clear-cache' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'

分享环境

把环境复制给另一个账号。跨团队时不带分组;同一团队会保留原分组。

POST /api/v1/profiles/share

请求参数

字段位置类型必填说明
profileIdBodystring是环境 ID
usernameBodystring是对方登录用户名

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring对方账号下新建的环境 ID
namestring名称
serialnumber对方团队内的序号

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "cmyyyyyyyy",
    "name": "店铺A",
    "serial": 3
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/share' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx",  "username": "demo"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileId\": \"cmxxxxxxxx\",  \"username\": \"demo\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/share", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/share"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx","username":"demo"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/share"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileId\": \"cmxxxxxxxx\",  \"username\": \"demo\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/share");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\",  \"username\": \"demo\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/share", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileId":"cmxxxxxxxx","username":"demo"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/share");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\",  \"username\": \"demo\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/share' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx",  "username": "demo"}'

查询环境 cookies

读取云端保存的 Cookie 文本。

GET /api/v1/profiles/cookies

请求参数

字段位置类型必填说明
profileIdQuerystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
cookiesstringCookie 原文,可能为空字符串

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "cookies": "[]"
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/cookies?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'

查询环境 User-Agent

读取该环境指纹里的 User-Agent。

GET /api/v1/profiles/user-agent

请求参数

字段位置类型必填说明
profileIdQuerystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
userAgentstringUser-Agent

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36"
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/profiles/user-agent?profileId=cmxxxxxxxx' \
  -H 'X-API-Key: YOUR_API_KEY'

关闭所有环境

关闭本机当前账号拉起的全部浏览器,并同步云端状态。

POST /api/v1/browser/stop-all

请求参数

字段位置类型必填说明
无

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
countnumber关闭的环境数量
profileIdsstring[]被关闭的环境 ID

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "count": 1,
    "profileIds": [
      "cmxxxxxxxx"
    ]
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop-all' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/browser/stop-all", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/browser/stop-all"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/browser/stop-all"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop-all");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/browser/stop-all", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/browser/stop-all");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/browser/stop-all' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{}'

生成新指纹

按当前内核与操作系统重新生成指纹并写回该环境。

POST /api/v1/profiles/fingerprint

请求参数

字段位置类型必填说明
profileIdBodystring是环境 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
profileIdstring环境 ID
userAgentstring新的 User-Agent
osstring操作系统

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "profileId": "cmxxxxxxxx",
    "userAgent": "Mozilla/5.0 ...",
    "os": "Windows"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/fingerprint' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"profileId\": \"cmxxxxxxxx\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/profiles/fingerprint", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/profiles/fingerprint"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"profileId":"cmxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/profiles/fingerprint"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"profileId\": \"cmxxxxxxxx\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/fingerprint");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/profiles/fingerprint", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"profileId":"cmxxxxxxxx"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/profiles/fingerprint");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"profileId\": \"cmxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/profiles/fingerprint' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "profileId": "cmxxxxxxxx"}'

内核列表

查询云端可下载的内核,并标记本机是否已安装。platform 默认跟随当前系统。

GET /api/v1/kernels

请求参数

字段位置类型必填说明
platformQuerystring否win32 / darwin / linux,默认当前系统
archQuerystring否架构,默认 x64
brandQuerystring否只看某个品牌:chrome 或 firefox

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
platformstring查询使用的平台
archstring架构
listarray按品牌分组
list[].brandstring品牌
list[].versionsarray版本
list[].versions[].majorVersionnumber主版本
list[].versions[].installedboolean本机是否已安装
list[].versions[].recommendedboolean是否推荐版本
list[].versions[].fullVersionstring完整版本号

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "platform": "win32",
    "arch": "x64",
    "list": [
      {
        "brand": "chrome",
        "versions": [
          {
            "majorVersion": 120,
            "installed": true,
            "recommended": true,
            "fullVersion": "120.0.6099.71"
          }
        ]
      }
    ]
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/kernels?platform=win32&arch=x64' \
  -H 'X-API-Key: YOUR_API_KEY'

下载内核

把指定内核下载并解压到本机。文件较大时请求会一直保持到完成。

POST /api/v1/kernels/download

请求参数

字段位置类型必填说明
brandBodystring是chrome 或 firefox
majorVersionBodynumber是主版本
platformBodystring否win32 / darwin / linux,默认当前系统
archBodystring否默认 x64

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
brandstring品牌
majorVersionnumber主版本
dirNamestring安装目录名
installedboolean完成后为 true

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "brand": "chrome",
    "majorVersion": 120,
    "dirName": "chrome_120",
    "installed": true
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/kernels/download' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "brand": "chrome",  "majorVersion": 120}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"brand\": \"chrome\",  \"majorVersion\": 120}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/kernels/download", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/kernels/download"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"brand":"chrome","majorVersion":120}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/kernels/download"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"brand\": \"chrome\",  \"majorVersion\": 120}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels/download");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"brand\": \"chrome\",  \"majorVersion\": 120}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/kernels/download", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"brand":"chrome","majorVersion":120}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/kernels/download");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"brand\": \"chrome\",  \"majorVersion\": 120}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/kernels/download' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "brand": "chrome",  "majorVersion": 120}'

创建标签

新建标签。同名标签已存在时直接返回已有记录。

POST /api/v1/tags

请求参数

字段位置类型必填说明
nameBodystring是标签名,1–50 字
colorBodystring否颜色,默认 #409eff

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring标签 ID
namestring名称
colorstring颜色

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "tagxxxxxxxx",
    "name": "常用",
    "color": "#409eff"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/tags' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "常用",  "color": "#409eff"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"name\": \"常用\",  \"color\": \"#409eff\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/tags", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/tags"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"常用","color":"#409eff"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/tags"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"name\": \"常用\",  \"color\": \"#409eff\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"name\": \"常用\",  \"color\": \"#409eff\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/tags", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name":"常用","color":"#409eff"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"name\": \"常用\",  \"color\": \"#409eff\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/tags' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "常用",  "color": "#409eff"}'

更新标签

修改标签名称或颜色。

POST /api/v1/tags/update

请求参数

字段位置类型必填说明
idBodystring是标签 ID
nameBodystring否新名称
colorBodystring否新颜色

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring标签 ID
namestring名称
colorstring颜色

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "tagxxxxxxxx",
    "name": "重点",
    "color": "#f56c6c"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/tags/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "tagxxxxxxxx",  "name": "重点",  "color": "#f56c6c"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"id\": \"tagxxxxxxxx\",  \"name\": \"重点\",  \"color\": \"#f56c6c\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/tags/update", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/tags/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"tagxxxxxxxx","name":"重点","color":"#f56c6c"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/tags/update"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"id\": \"tagxxxxxxxx\",  \"name\": \"重点\",  \"color\": \"#f56c6c\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/update");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"id\": \"tagxxxxxxxx\",  \"name\": \"重点\",  \"color\": \"#f56c6c\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/tags/update", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id":"tagxxxxxxxx","name":"重点","color":"#f56c6c"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"id\": \"tagxxxxxxxx\",  \"name\": \"重点\",  \"color\": \"#f56c6c\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/tags/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "tagxxxxxxxx",  "name": "重点",  "color": "#f56c6c"}'

删除标签

删除标签字典中的一项。仅主账号可删除。不会自动改掉环境上已写的标签名。

POST /api/v1/tags/delete

请求参数

字段位置类型必填说明
idBodystring是标签 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring已删除的标签 ID

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "tagxxxxxxxx"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/tags/delete' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "tagxxxxxxxx"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"id\": \"tagxxxxxxxx\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/tags/delete", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/tags/delete"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"tagxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/tags/delete"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"id\": \"tagxxxxxxxx\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/delete");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"id\": \"tagxxxxxxxx\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/tags/delete", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id":"tagxxxxxxxx"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"id\": \"tagxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/tags/delete' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "tagxxxxxxxx"}'

查询标签

查询当前团队的标签字典。

GET /api/v1/tags

请求参数

字段位置类型必填说明
无

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
listarray标签列表
list[].idstring标签 ID
list[].namestring名称
list[].colorstring颜色

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "list": [
      {
        "id": "tagxxxxxxxx",
        "name": "常用",
        "color": "#409eff"
      }
    ]
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/tags' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/tags", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/tags"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/tags"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/tags", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/tags");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/tags' \
  -H 'X-API-Key: YOUR_API_KEY'

查询分组

查询当前账号可见的环境分组。

GET /api/v1/groups

请求参数

字段位置类型必填说明
无

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
groupsarray分组
groups[].idstring分组 ID
groups[].namestring名称
groups[].remarkstring备注
groups[].sortnumber排序
groups[].profileCountnumber组内环境数
ungroupedCountnumber未分组环境数

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "groups": [
      {
        "id": "grpxxxxxxxx",
        "name": "默认",
        "remark": "",
        "sort": 0,
        "profileCount": 2
      }
    ],
    "ungroupedCount": 1
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/groups' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/groups", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/groups"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/groups"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/groups", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/groups' \
  -H 'X-API-Key: YOUR_API_KEY'

创建分组

新建环境分组。需要主账号或团队管理员权限。

POST /api/v1/groups

请求参数

字段位置类型必填说明
nameBodystring是分组名称,1–30 字
remarkBodystring否备注
sortBodynumber否排序,默认 0

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring分组 ID
namestring名称
remarkstring备注
sortnumber排序

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "grpxxxxxxxx",
    "name": "美国站",
    "remark": "",
    "sort": 0
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/groups' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "美国站",  "remark": "",  "sort": 0}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"name\": \"美国站\",  \"remark\": \"\",  \"sort\": 0}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/groups", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/groups"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"美国站","remark":"","sort":0}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/groups"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"name\": \"美国站\",  \"remark\": \"\",  \"sort\": 0}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"name\": \"美国站\",  \"remark\": \"\",  \"sort\": 0}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/groups", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name":"美国站","remark":"","sort":0}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"name\": \"美国站\",  \"remark\": \"\",  \"sort\": 0}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/groups' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "美国站",  "remark": "",  "sort": 0}'

修改分组

修改分组名称、备注或排序。需要主账号或团队管理员权限。

POST /api/v1/groups/update

请求参数

字段位置类型必填说明
idBodystring是分组 ID
nameBodystring否名称
remarkBodystring否备注
sortBodynumber否排序

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring分组 ID
namestring名称

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "grpxxxxxxxx",
    "name": "欧洲站"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/groups/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "grpxxxxxxxx",  "name": "欧洲站"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"id\": \"grpxxxxxxxx\",  \"name\": \"欧洲站\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/groups/update", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/groups/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"grpxxxxxxxx","name":"欧洲站"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/groups/update"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"id\": \"grpxxxxxxxx\",  \"name\": \"欧洲站\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups/update");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"id\": \"grpxxxxxxxx\",  \"name\": \"欧洲站\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/groups/update", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id":"grpxxxxxxxx","name":"欧洲站"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/groups/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"id\": \"grpxxxxxxxx\",  \"name\": \"欧洲站\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/groups/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "grpxxxxxxxx",  "name": "欧洲站"}'

创建代理

在代理库中新增一条代理。

POST /api/v1/proxies

请求参数

字段位置类型必填说明
nameBodystring否备注名
typeBodystring是http / https / socks5 / ssh
hostBodystring是主机
portBodynumber是端口 1–65535
usernameBodystring否用户名
passwordBodystring否密码
refreshUrlBodystring否刷新 IP 的 URL
ipChannelBodystring否IP 查询渠道 key,可空
remarkBodystring否备注

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring代理 ID
typestring类型
hoststring主机
portnumber端口

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "pxyxxxxxxxx",
    "type": "http",
    "host": "127.0.0.1",
    "port": 7890
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/proxies' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "本地",  "type": "http",  "host": "127.0.0.1",  "port": 7890,  "username": "",  "password": ""}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"name\": \"本地\",  \"type\": \"http\",  \"host\": \"127.0.0.1\",  \"port\": 7890,  \"username\": \"\",  \"password\": \"\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/proxies", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/proxies"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"name":"本地","type":"http","host":"127.0.0.1","port":7890,"username":"","password":""}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/proxies"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"name\": \"本地\",  \"type\": \"http\",  \"host\": \"127.0.0.1\",  \"port\": 7890,  \"username\": \"\",  \"password\": \"\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"name\": \"本地\",  \"type\": \"http\",  \"host\": \"127.0.0.1\",  \"port\": 7890,  \"username\": \"\",  \"password\": \"\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/proxies", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name":"本地","type":"http","host":"127.0.0.1","port":7890,"username":"","password":""}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"name\": \"本地\",  \"type\": \"http\",  \"host\": \"127.0.0.1\",  \"port\": 7890,  \"username\": \"\",  \"password\": \"\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "name": "本地",  "type": "http",  "host": "127.0.0.1",  "port": 7890,  "username": "",  "password": ""}'

更新代理

更新代理库中的一条记录。只传需要修改的字段。

POST /api/v1/proxies/update

请求参数

字段位置类型必填说明
idBodystring是代理 ID
nameBodystring否备注名
typeBodystring否类型
hostBodystring否主机
portBodynumber否端口
usernameBodystring否用户名
passwordBodystring否密码
refreshUrlBodystring否刷新 URL
remarkBodystring否备注

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring代理 ID
hoststring主机
portnumber端口

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "pxyxxxxxxxx",
    "host": "127.0.0.1",
    "port": 7891
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "pxyxxxxxxxx",  "port": 7891}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"id\": \"pxyxxxxxxxx\",  \"port\": 7891}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/proxies/update", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/proxies/update"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"pxyxxxxxxxx","port":7891}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/proxies/update"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"id\": \"pxyxxxxxxxx\",  \"port\": 7891}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/update");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"id\": \"pxyxxxxxxxx\",  \"port\": 7891}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/proxies/update", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id":"pxyxxxxxxxx","port":7891}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"id\": \"pxyxxxxxxxx\",  \"port\": 7891}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/update' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "pxyxxxxxxxx",  "port": 7891}'

查询代理

查询当前团队的代理库。

GET /api/v1/proxies

请求参数

字段位置类型必填说明
无

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
listarray代理列表
list[].idstring代理 ID
list[].namestring备注名
list[].typestring类型
list[].hoststring主机
list[].portnumber端口

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "list": [
      {
        "id": "pxyxxxxxxxx",
        "name": "本地",
        "type": "http",
        "host": "127.0.0.1",
        "port": 7890
      }
    ]
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/proxies' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/proxies", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/proxies"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/proxies"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/proxies", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/proxies' \
  -H 'X-API-Key: YOUR_API_KEY'

删除代理

从代理库删除一条代理。已引用它的环境不会自动改代理配置。

POST /api/v1/proxies/delete

请求参数

字段位置类型必填说明
idBodystring是代理 ID

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
idstring已删除的代理 ID

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "id": "pxyxxxxxxxx"
  }
}

请求示例

curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/delete' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "pxyxxxxxxxx"}'
package main
import (
  "fmt"
  "io"
  "net/http"
  "strings"
)
func main() {
  body := strings.NewReader("{  \"id\": \"pxyxxxxxxxx\"}")
  req, _ := http.NewRequest(http.MethodPost, "http://127.0.0.1:52702/api/v1/proxies/delete", body)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/proxies/delete"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
resp = requests.post(url, headers=headers, json={"id":"pxyxxxxxxxx"}, timeout=120)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/proxies/delete"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString("{  \"id\": \"pxyxxxxxxxx\"}"))
        .build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/delete");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{  \"id\": \"pxyxxxxxxxx\"}");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/proxies/delete", {
  method: "POST",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id":"pxyxxxxxxxx"}),
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/proxies/delete");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$headers = [
  "X-API-Key: YOUR_API_KEY",
  'Content-Type: application/json',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{  \"id\": \"pxyxxxxxxxx\"}");
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X POST 'http://127.0.0.1:52702/api/v1/proxies/delete' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{  "id": "pxyxxxxxxxx"}'

应用分类列表

查询应用中心推荐应用的分类,顺序与客户端一致。

GET /api/v1/extensions/categories

请求参数

字段位置类型必填说明
无

响应 data 字段

HTTP 状态一般为 200。业务是否成功看 JSON 里的 code:0 为成功。

字段类型说明
listarray分类
list[].idstring分类 ID
list[].namestring名称
list[].sortnumber排序,小的在前

响应示例

{
  "code": 0,
  "msg": "Success",
  "data": {
    "list": [
      {
        "id": "catxxxxxxxx",
        "name": "工具",
        "sort": 0
      }
    ]
  }
}

请求示例

curl -X GET 'http://127.0.0.1:52702/api/v1/extensions/categories' \
  -H 'X-API-Key: YOUR_API_KEY'
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  req, _ := http.NewRequest(http.MethodGet, "http://127.0.0.1:52702/api/v1/extensions/categories", nil)
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  raw, _ := io.ReadAll(resp.Body)
  fmt.Println(resp.StatusCode, string(raw))
}
import requests

url = "http://127.0.0.1:52702/api/v1/extensions/categories"
headers = {"X-API-Key": "YOUR_API_KEY"
resp = requests.get(url, headers=headers, timeout=60)
print(resp.status_code)
print(resp.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class LocalApiDemo {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest.Builder builder = HttpRequest.newBuilder()
        .uri(URI.create("http://127.0.0.1:52702/api/v1/extensions/categories"))
        .header("X-API-Key", "YOUR_API_KEY");
    HttpRequest request = builder.GET().build();
    HttpResponse<String> resp = client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
  CURL *curl = curl_easy_init();
  if (!curl) return 1;
  curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/extensions/categories");
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  CURLcode rc = curl_easy_perform(curl);
  if (rc != CURLE_OK) fprintf(stderr, "%s\n", curl_easy_strerror(rc));
  curl_slist_free_all(headers);
  curl_easy_cleanup(curl);
  return rc == CURLE_OK ? 0 : 1;
}
const res = await fetch("http://127.0.0.1:52702/api/v1/extensions/categories", {
  method: "GET",
  headers: {
    'X-API-Key': "YOUR_API_KEY",
  },
});
console.log(res.status, await res.text());
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:52702/api/v1/extensions/categories");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = [
  "X-API-Key: YOUR_API_KEY",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $raw;
curl_close($ch);
#!/bin/sh
set -eu
curl -X GET 'http://127.0.0.1:52702/api/v1/extensions/categories' \
  -H 'X-API-Key: YOUR_API_KEY'