API v1 · 稳定版

开放 API 文档

通过开放 API,你可以把蛋壳指纹浏览器接入自己的业务系统:批量创建与管理浏览器配置、查询分组与代理、读取会员状态。所有接口使用 API Key 鉴权,数据按账号隔离。

API 地址
http://103.112.185.167:8899/open/v1
鉴权方式
请求头 X-API-Key
默认限流
120 次 / 分钟(按 Key 独立计数)

快速开始 3 步接入

1. 创建 API Key

在客户端进入「开放 API」页面,点击「生成密钥」。密钥形如 dk_live_xxxxxxxx...,仅在生成时完整显示一次,请妥善保存。

2. 发起第一个请求

curl -X GET "http://103.112.185.167:8899/open/v1/ping" \
  -H "X-API-Key: dk_live_你的密钥"
const res = await fetch('http://103.112.185.167:8899/open/v1/ping', {
  headers: { 'X-API-Key': 'dk_live_你的密钥' }
});
const data = await res.json();
console.log(data); // { code: 0, msg: 'pong', data: { api_version: 'v1', ... } }
import requests

res = requests.get(
    'http://103.112.185.167:8899/open/v1/ping',
    headers={'X-API-Key': 'dk_live_你的密钥'},
    timeout=10,
)
print(res.json())

3. 创建浏览器配置

curl -X POST "http://103.112.185.167:8899/open/v1/profiles" \
  -H "X-API-Key: dk_live_你的密钥" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "亚马逊店铺-01",
    "group_id": 1,
    "os_type": "windows",
    "remark": "美国站"
  }'
所有请求与响应均为 JSON(UTF-8)。成功时 HTTP 状态码为 200 且 code 为 0。

鉴权与错误码

支持以下三种传入方式,优先级从高到低:

方式示例说明
请求头X-API-Key: dk_live_xxx推荐,所有语言均可用
BearerAuthorization: Bearer dk_live_xxx兼容 OAuth 风格客户端
查询参数?api_key=dk_live_xxx仅用于调试,勿在生产使用

统一响应结构

{
  "code": 0,                 // 0 = 成功;非 0 = 失败(与 HTTP 状态码一致)
  "msg": "ok",
  "data": { ... },           // 业务数据,失败时可能为 null
  "request_id": "a1b2c3d4e5f6a7b8"   // 排查问题时提供此 ID
}

错误码

HTTP含义常见原因
401未授权缺少 API Key 或 Key 无效
403禁止访问Key 被禁用、账号被禁用/锁定、未绑定手机号
404资源不存在配置 ID 不存在或不属于当前账号
400参数错误缺少必填字段、JSON 格式错误、名称超长
429限流超出每分钟请求上限,查看 Retry-After 头
API Key 与账号绑定。Key 被禁用或账号到期后,所有接口将返回 403。请勿在客户端代码中硬编码密钥。

基础接口

GET/open/v1/ping

检测 Key 是否有效与网络是否连通,返回服务器时间与当前限流额度。

{
  "code": 0,
  "msg": "pong",
  "data": {
    "server_time": "2026-11-06T12:00:00+08:00",
    "api_version": "v1",
    "user_id": 1,
    "rate_limit": 120
  }
}
GET/open/v1/member

读取当前 Key 所属账号的会员信息。会员等级与客户端、CDK 兑换、在线支付完全一致。

字段类型说明
member_typeint0 非会员 / 1 普通会员 / 2 高级会员 / 3 企业会员
member_namestring会员名称
member_expire_timeint|null到期时间戳(秒)
member_expire_datestring|null到期时间,格式 Y-m-d H:i:s
days_leftint剩余天数(向上取整)
is_expiredbool是否已过期
GET/open/v1/stats

当前账号的资源统计:配置数量、分组数量、可用代理数量。

{
  "code": 0,
  "msg": "ok",
  "data": {
    "profiles": 12,
    "groups": 3,
    "proxies": 5,
    "running_profiles": 2
  }
}

分组管理

GET/open/v1/groups

列出当前账号的全部分组,并返回每组下的配置数量。

{
  "code": 0,
  "data": {
    "list": [
      { "id": 1, "name": "默认分组", "profile_count": 8 },
      { "id": 2, "name": "美国站", "profile_count": 4 }
    ],
    "total": 2
  }
}
POST/open/v1/groups
参数类型必填说明
namestring是分组名称,最长 50 字
curl -X POST "http://103.112.185.167:8899/open/v1/groups" \
  -H "X-API-Key: dk_live_你的密钥" \
  -H "Content-Type: application/json" \
  -d '{"name":"美国站"}'

浏览器配置

GET/open/v1/profiles

分页查询配置列表。数据仅包含当前 Key 所属账号的配置。

参数类型必填说明
pageint否页码,默认 1
limitint否每页数量,默认 20,最大 100
group_idint否按分组过滤
keywordstring否按名称 / 账号 / 备注模糊搜索
curl "http://103.112.185.167:8899/open/v1/profiles?page=1&limit=20&group_id=1" \
  -H "X-API-Key: dk_live_你的密钥"
POST/open/v1/profiles
参数类型必填说明
namestring是配置名称,最长 100 字
group_idint否分组 ID;不传则使用默认分组(无分组时自动创建)
accountstring否账号备注
remarkstring否备注
os_typestring否windows / macos / android / ios,默认 windows
browser_configobject|string否指纹配置,未传字段会用对应系统的默认值补齐
proxy_configobject|string否代理配置,默认直连
other_configobject|string否其他配置,默认开启云同步
移动端指纹:当 os_type 为 android / ios 时,默认配置会自动写入移动端 UA、品牌、机型、系统版本与竖屏分辨率,并开启触摸屏支持。
curl -X POST "http://103.112.185.167:8899/open/v1/profiles" \
  -H "X-API-Key: dk_live_你的密钥" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "安卓-01",
    "group_id": 1,
    "os_type": "android",
    "browser_config": {
      "deviceMode": "android",
      "phoneBrand": "Samsung",
      "deviceModel": "Galaxy S24",
      "mobileOsVersion": "14",
      "screenResolution": "412x915",
      "timezoneMode": "ip"
    }
  }'
GET/open/v1/profiles/{id}

获取单个配置的完整详情,包括解析后的指纹、代理与其他配置。

PUT/open/v1/profiles/{id}

更新配置。也支持 POST /open/v1/profiles/{id},便于不支持 PUT 的客户端。仅传需要修改的字段。

参数类型说明
namestring配置名称
group_idint移动到的分组
account / remarkstring账号 / 备注
browser_configobject与已有配置合并
proxy_configobject整体替换
other_configobject整体替换
statusint0 停用 / 1 启用
DELETE/open/v1/profiles/{id}

删除配置(软删除)。删除后列表中不再显示,但数据保留 30 天。

删除操作不可通过 API 恢复,请谨慎调用。

代理列表

GET/open/v1/proxies

列出当前账号可用的代理(平台代理 + 自定义代理)。返回的 id 可用于配置的 proxy_config.platformProxyId。

{
  "code": 0,
  "data": {
    "list": [
      {
        "id": 1,
        "type": "socks5",
        "ip": "1.2.3.4",
        "port": 1080,
        "username": "user",
        "region": "US",
        "status": "active"
      }
    ],
    "total": 1
  }
}

指纹参数

调用 GET /open/v1/fingerprint/options 可获取当前版本支持的完整字段说明与默认值,建议接入时以接口返回为准,避免硬编码。

curl "http://103.112.185.167:8899/open/v1/fingerprint/options" \
  -H "X-API-Key: dk_live_你的密钥"

常用字段

字段类型说明
deviceModestringdesktop / android / ios,移动端启用移动指纹内核
userAgentstring完整 UA,需与设备类型、系统版本一致
platformstringWindows 10 / Windows 11
systemVersionstring系统版本,影响 Client Hints Sec-CH-UA-Platform-Version
phoneBrand / deviceModelstring移动端品牌 / 机型
mobileOsVersionstring移动系统版本
screenResolutionstring分辨率 宽x高,如 1920x1080
timezoneMode / timezonestringip 跟随代理 IP;custom 使用自定义时区
languageMode / languagestringip 跟随 IP 国家;custom 自定义语言
webglInfoMode / webglVendor / webglRendererstringWebGL 厂商与渲染器
canvas / font / webrtc / mediaDevicesstringnoise / off 等噪声开关
touchScreenstringenabled / disabled;移动端自动开启
deviceMemory / hardwareConcurrencyint内存(GB)/ 逻辑核心数
为保证环境自洽,建议 UA、Client Hints 系统版本、时区、语言、WebGL、屏幕、触控能力互相对应。客户端「环境一致性自检」可自动检测并修正这些矛盾项。

接入示例

批量创建配置(Node.js)

const BASE = 'http://103.112.185.167:8899/open/v1';
const KEY  = 'dk_live_你的密钥';

async function createProfile(name, groupId) {
  const res = await fetch(`${BASE}/profiles`, {
    method: 'POST',
    headers: {
      'X-API-Key': KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ name, group_id: groupId, os_type: 'windows' }),
  });
  const json = await res.json();
  if (json.code !== 0) throw new Error(`${res.status}: ${json.msg}`);
  return json.data;
}

(async () => {
  for (let i = 1; i <= 10; i++) {
    const p = await createProfile(`店铺-${String(i).padStart(2, '0')}`, 1);
    console.log('created', p.id);
  }
})();

错误处理建议

async function api(path, options = {}) {
  const res = await fetch(BASE + path, {
    ...options,
    headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json', ...(options.headers || {}) },
  });

  if (res.status === 429) {
    const retryAfter = Number(res.headers.get('Retry-After') || 60);
    await new Promise(r => setTimeout(r, retryAfter * 1000));
    return api(path, options); // 重试一次
  }

  const json = await res.json();
  if (json.code !== 0) {
    // 记录 request_id 方便排查
    console.error(json.request_id, res.status, json.msg);
    throw new Error(json.msg);
  }
  return json.data;
}
建议:生产环境为每个业务系统单独生成一个 API Key,便于隔离权限、统计调用量,并在泄露时单独禁用。