快速开始 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_你的密钥"
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 | 推荐,所有语言均可用 |
| Bearer | Authorization: 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_type | int | 0 非会员 / 1 普通会员 / 2 高级会员 / 3 企业会员 |
member_name | string | 会员名称 |
member_expire_time | int|null | 到期时间戳(秒) |
member_expire_date | string|null | 到期时间,格式 Y-m-d H:i:s |
days_left | int | 剩余天数(向上取整) |
is_expired | bool | 是否已过期 |
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
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 是 | 分组名称,最长 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 所属账号的配置。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
page | int | 否 | 页码,默认 1 |
limit | int | 否 | 每页数量,默认 20,最大 100 |
group_id | int | 否 | 按分组过滤 |
keyword | string | 否 | 按名称 / 账号 / 备注模糊搜索 |
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
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 是 | 配置名称,最长 100 字 |
group_id | int | 否 | 分组 ID;不传则使用默认分组(无分组时自动创建) |
account | string | 否 | 账号备注 |
remark | string | 否 | 备注 |
os_type | string | 否 | windows / macos / android / ios,默认 windows |
browser_config | object|string | 否 | 指纹配置,未传字段会用对应系统的默认值补齐 |
proxy_config | object|string | 否 | 代理配置,默认直连 |
other_config | object|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 的客户端。仅传需要修改的字段。
| 参数 | 类型 | 说明 |
|---|---|---|
name | string | 配置名称 |
group_id | int | 移动到的分组 |
account / remark | string | 账号 / 备注 |
browser_config | object | 与已有配置合并 |
proxy_config | object | 整体替换 |
other_config | object | 整体替换 |
status | int | 0 停用 / 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_你的密钥"
常用字段
| 字段 | 类型 | 说明 |
|---|---|---|
deviceMode | string | desktop / android / ios,移动端启用移动指纹内核 |
userAgent | string | 完整 UA,需与设备类型、系统版本一致 |
platform | string | Windows 10 / Windows 11 |
systemVersion | string | 系统版本,影响 Client Hints Sec-CH-UA-Platform-Version |
phoneBrand / deviceModel | string | 移动端品牌 / 机型 |
mobileOsVersion | string | 移动系统版本 |
screenResolution | string | 分辨率 宽x高,如 1920x1080 |
timezoneMode / timezone | string | ip 跟随代理 IP;custom 使用自定义时区 |
languageMode / language | string | ip 跟随 IP 国家;custom 自定义语言 |
webglInfoMode / webglVendor / webglRenderer | string | WebGL 厂商与渲染器 |
canvas / font / webrtc / mediaDevices | string | noise / off 等噪声开关 |
touchScreen | string | enabled / disabled;移动端自动开启 |
deviceMemory / hardwareConcurrency | int | 内存(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,便于隔离权限、统计调用量,并在泄露时单独禁用。