Skip to content

REST API 参考

Base URL: https://api.sybilslayer.com/api/v1

所有请求需在 Header 中携带认证令牌(除 /system/health 外):

Authorization: Bearer <token>

System

GET /system/health

健康检查(无需认证)。

Response:

json
{ "status": "ok", "timestamp": "2026-02-11T10:00:00.000Z" }

GET /system/countries

获取可用国家/地区列表及资源统计。

Response:

json
{
  "countries": [
    {
      "code": "JP",
      "fingerprints": 150,
      "proxies_available": 45
    }
  ],
  "proxies_available": 320
}

GET /system/version

获取各客户端版本信息(Desktop、Chrome)。

Response:

json
{
  "versions": {
    "client": {
      "version": "1.0.46",
      "download_url": "...",
      "release_notes": "...",
      "released_at": "..."
    },
    "chrome": {
      "version": "1.0.28",
      "download_url": "..."
    }
  }
}

Auth

POST /auth/login

用户名密码登录。

Request Body:

json
{
  "username": "alice",
  "password": "secret123"
}

Response:

json
{
  "token": "64位hex",
  "user": {
    "id": 1,
    "username": "alice",
    "email": "alice@example.com",
    "status": "active"
  },
  "quota": {
    "total": 100,
    "used": 5,
    "remaining": 95
  }
}

User

GET /user/profile

获取当前用户信息和配额。

Response:

json
{
  "user": {
    "id": 1,
    "username": "alice",
    "email": "alice@example.com",
    "status": "active"
  },
  "quota": {
    "total": 100,
    "used": 5,
    "remaining": 95
  },
  "stats": {
    "environments": 5,
    "tokens": 2
  }
}

Environment

POST /env/create

创建新的浏览器环境。

Request Body:

json
{
  "country": "JP",
  "name": "my-environment",
  "platform": "windows",
  "note": "测试环境"
}
参数类型必填说明
countrystring国家代码 (JP, US, KR 等)
namestring环境名称
platformstring平台类型
notestring备注

Response:

json
{
  "env_id": "env_abc123",
  "country": "JP",
  "proxy": "socks5://user:pass@ip:port",
  "quota_remaining": 94,
  "profile": { "profileId": "...", "envId": "...", "base": { ... } }
}

GET /env/list

分页获取环境列表。

Query Parameters: page (default: 1), limit (default: 20)

Response:

json
{
  "environments": [
    {
      "env_id": "env_abc123",
      "name": "my-env",
      "country": "JP",
      "proxy": "...",
      "note": "测试环境",
      "status": "active",
      "created_at": "..."
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 50,
    "pages": 3
  }
}

GET /env/:env_id

获取单个环境详情(包含完整 profile)。

PATCH /env/:env_id

更新环境备注或名称。

Request Body:

json
{
  "note": "新备注",
  "name": "新名称"
}
参数类型必填说明
notestring环境备注
namestring环境名称

至少传一个字段。

Response:

json
{
  "env_id": "env_abc123",
  "updated": ["note", "name"]
}

DELETE /env/:env_id

删除指定环境。

Response:

json
{ "message": "Environment deleted" }

POST /env/:env_id/refresh-proxy

刷新环境代理。

Request Body (可选):

json
{ "reason": "proxy_failed" }

Response:

json
{
  "env_id": "env_abc123",
  "country": "JP",
  "proxy": "socks5://new-proxy:port"
}

POST /env/:env_id/report-proxy-dead

上报代理失效。

Request Body:

json
{
  "consecutive_failures": 3,
  "reason": "timeout"
}

POST /env/admin/proxy/release-stale

释放过期的 MySQL 代理绑定(需管理员权限)。默认 dry_run=true,仅预览不执行。

Request Body:

json
{
  "countries": ["JP", "US"],
  "max_age_minutes": 180,
  "only_online": true,
  "dry_run": true
}
参数类型必填说明
countriesstring[]国家代码列表(不传则全部)
max_age_minutesnumber绑定最大存活分钟数(默认 180)
only_onlineboolean仅释放在线代理的绑定(默认 true
dry_runboolean仅预览不执行(默认 true

Response (dry_run=true):

json
{
  "trace_id": "proxy-abc12345",
  "dry_run": true,
  "max_age_minutes": 180,
  "only_online": true,
  "countries": ["JP", "US"],
  "matched": 25,
  "preview": [
    { "country": "JP", "locked_count": 15 },
    { "country": "US", "locked_count": 10 }
  ],
  "threshold_utc": "2026-03-13T07:00:00"
}

Response (dry_run=false):

json
{
  "trace_id": "proxy-abc12345",
  "dry_run": false,
  "max_age_minutes": 180,
  "only_online": true,
  "countries": ["JP", "US"],
  "matched": 25,
  "released": 25,
  "preview": [
    { "country": "JP", "locked_count": 15 },
    { "country": "US", "locked_count": 10 }
  ],
  "threshold_utc": "2026-03-13T07:00:00"
}

POST /env/admin/proxy/migrate-bindings

将旧 proxy_servers.env_id 迁移到 proxy_bindings 表(分批执行,需管理员权限)。默认 dry_run=true

Request Body:

json
{
  "dry_run": true,
  "offset": 0,
  "batch_size": 200
}
参数类型必填说明
dry_runboolean仅预览不执行(默认 true
offsetnumber分页偏移量(默认 0)
batch_sizenumber每批数量(1-500,默认 200)

Response (dry_run=true):

json
{
  "trace_id": "proxy-abc12345",
  "dry_run": true,
  "total": 846,
  "offset": 0,
  "batch_size": 200,
  "to_insert": 195,
  "skipped": 5,
  "has_more": true
}

Response (dry_run=false):

json
{
  "trace_id": "proxy-abc12345",
  "dry_run": false,
  "total": 846,
  "offset": 0,
  "batch_size": 200,
  "inserted": 195,
  "skipped": 5,
  "has_more": true,
  "next_offset": 200
}

Download

GET /download/client

下载 Desktop 客户端(自动检测最新版本)。

GET /download/chrome

下载 Chrome 内核(自动检测最新版本)。

GET /download/chrome/info

获取 Chrome 内核版本信息(不下载)。


Admin

WARNING

以下接口需要管理员权限的 Token。

GET /admin/users

分页获取用户列表。

Query Parameters: page, limit

POST /admin/users

创建新用户。

Request Body:

json
{
  "username": "alice",
  "email": "alice@example.com",
  "password": "optional-password",
  "quota_total": 20
}

PUT /admin/users/:id

更新用户信息(配额、密码、状态、邮箱)。至少传一个字段。

Request Body:

json
{
  "quota_total": 50,
  "password": "new-password",
  "status": "active",
  "email": "new@example.com"
}
参数类型必填说明
quota_totalnumber配额总量(>= 0)
passwordstring新密码
statusstringactivesuspended
emailstring新邮箱

Response:

json
{
  "id": 1,
  "username": "alice",
  "email": "new@example.com",
  "quota_total": 50,
  "quota_used": 5,
  "status": "active"
}

DELETE /admin/users/:id

删除用户及其关联数据(Token、环境、日志等级联删除)。

Response:

json
{
  "id": 1,
  "username": "alice",
  "deleted": true
}

POST /admin/users/batch-generate

批量生成测试账户(用于迁移/运维)。

Request Body:

json
{
  "high_quota_count": 2,
  "high_quota_value": 200,
  "normal_count": 10,
  "normal_quota_value": 2,
  "username_prefix": "test",
  "email_domain": "example.com",
  "password": "optional-shared-password"
}
参数类型必填说明
high_quota_countnumber高配额用户数量(默认 2)
high_quota_valuenumber高配额值(默认 200)
normal_countnumber普通用户数量(10-20,默认 10)
normal_quota_valuenumber普通配额值(默认 2)
username_prefixstring用户名前缀
email_domainstring邮箱域名
passwordstring共享密码(不传则无密码)

Response:

json
{
  "trace_id": "admin-batch-users-abc12345",
  "requested": {
    "high_quota_count": 2,
    "high_quota_value": 200,
    "normal_count": 10,
    "normal_quota_value": 2
  },
  "summary": {
    "requested": 12,
    "created": 12,
    "failed": 0
  },
  "users": [
    {
      "id": 101,
      "username": "test_87654321_1",
      "email": "test_87654321_1@example.com",
      "quota_total": 200,
      "quota_used": 0,
      "status": "active",
      "has_password": true,
      "tier": "high"
    }
  ],
  "failures": []
}

GET /admin/users/uuid-ip-map

导出环境 UUID 与代理 IP 的映射表,支持 JSON 和 CSV 格式。

Query Parameters:

参数类型必填说明
formatstringjson(默认)或 csv
include_inactivestring是否包含非活跃环境(true/false,默认 false
limitnumber最大条数(默认 5000,上限 20000)

Response (format=json):

json
{
  "trace_id": "admin-uuid-ip-abc12345",
  "total": 100,
  "mapped": 95,
  "unresolved": 5,
  "items": [
    {
      "env_id": "env_abc123",
      "uuid": "abc123",
      "ip": "1.2.3.4",
      "user_id": 1,
      "username": "alice",
      "email": "alice@example.com",
      "country": "JP",
      "status": "active",
      "proxy": "socks5://user:pass@1.2.3.4:1080",
      "updated_at": "2026-03-01T00:00:00.000Z"
    }
  ]
}

Response (format=csv): 返回 CSV 文件下载(Content-Disposition: attachment)。

GET /admin/tokens

分页获取 Token 列表。

POST /admin/tokens

创建新 Token。

Request Body:

json
{
  "user_id": 1,
  "name": "ci-key",
  "expires_in_days": 90
}

DELETE /admin/tokens/:id

撤销指定 Token。

GET /admin/proxies

获取代理列表。

Query Parameters: country, status, limit

GET /admin/proxies/stats

获取代理统计信息(总量、可用、按国家分组、补货建议)。

POST /admin/proxies/recheck

批量重新检查代理健康状态。

Request Body:

json
{
  "country": "JP",
  "limit": 50
}

POST /admin/proxies/import-csv

CSV 格式批量导入代理。

Request Body:

json
{
  "csv": "JP,socks5://1.2.3.4:1080\nUS,http://5.6.7.8:8080",
  "default_country": "US"
}

POST /admin/proxies/import

JSON 格式批量导入代理。

Request Body:

json
{
  "items": [
    { "country": "JP", "proxy_url": "socks5://1.2.3.4:1080" }
  ]
}

POST /admin/templates/import

批量导入指纹模板。

POST /admin/fingerprints/import

批量导入指纹数据。

GET /admin/fingerprints/stats

获取指纹统计信息。

GET /admin/country-matrix

获取国家就绪矩阵(模板 + 代理可用性)。

Response:

json
{
  "min_templates_per_country": 100,
  "templates_total": 5000,
  "proxies_total": 150,
  "countries": [
    {
      "code": "JP",
      "fingerprints": 500,
      "proxies_available": 45,
      "ok_templates": true,
      "ok_proxies": true,
      "ok": true
    }
  ]
}

Linege Anti-Browser Documentation