开发者

分销商 API

通过程序为你的客户开通代理——创建子账户、分配流量、生成凭据、读取用量。

本页内容

分销商 API

概览

如何获取权限. 分销商 API 会在你的分销商账户激活后开通。随后你创建 API 密钥并调用下方端点。

流量池
你的预付余额。分配给子账户会从中扣除;回收则返还。
子账户
你的每位客户都是一个子账户,拥有各自的流量、代理凭据和用量。
https://socksnode.com/api/v1/reseller

产品

你可以销售三种产品。每种都有各自的资源池、批发价和每个子账户上的独立余额,一种产品的 GB 绝不会被当作另一种消耗。在 allocate、proxies、usage 和 locations 中用 product 字段选择。

product产品定位Sticky IP
residential轮换住宅国家、州、城市、ASN1–1440 min
datacenter轮换数据中心国家、城市、ASN1–1440 min
mobile_rotating轮换移动(4G/5G 运营商 IP)国家;州、城市和 ASN 流量按双倍计算1–120 min

不传 product 时,每个调用都按住宅处理,与之前完全一致。数据中心和轮换移动在你的账户开通后可用;开通前这些调用返回 403 product_not_enabled。

# Allocate 10 GB of DATACENTER to a sub-account
curl -X POST "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/allocate" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"gb": 10, "product": "datacenter"}'

# Generate a ROTATING MOBILE proxy for it
curl -X POST "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/proxies" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"product": "mobile_rotating", "country": "us",
       "protocol": "http", "sessionMode": "rotating"}'

# No "product" = residential, exactly as before

Pools

住宅流量可在全部三个代理池使用,价格相同。在 POST /proxies 中传入 pool 选择代理池;不传即为 Pool 1,与以前一样。Mix 把请求平均分配到 mixPools 中的各个代理池。无法满足目标的代理池会被跳过,只有一个代理池能满足的目标在 Pool 1 上运行:每行的 pool、mixPools 和 poolNote 说明它实际运行在哪里。

pool定位Sticky
1Pool 1国家、州、城市和运营商(ASN),可自由组合1–1440 min
2Pool 2国家,再加以下之一:州、城市或运营商1–60 min
3Pool 3国家、州和城市;不支持 ISP1–1440 min
mixMixPool 1 的地点;Mix 中每个代理池各自服务能满足的部分含 Pools 1 + 3 时为 1–1440 分钟(超过 60 分钟 Pool 2 会被跳过);其他情况 1–60 分钟

Pool 2 和 Pool 3 的地点:GET /locations?pool=2(或 3)。名称和代码都可以:"Los Angeles"、"losangeles" 和 "los_angeles" 是同一个城市。

# Pool 3, Los Angeles, the same IP for 30 minutes
curl -X POST "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/proxies" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"pool": "3", "protocol": "http", "country": "us",
       "state": "california", "city": "losangeles",
       "sessionMode": "sticky", "stickyDurationMinutes": 30}'

# A Mix of all three pools, a new IP on every request
curl -X POST "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/proxies" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"pool": "mix", "mixPools": "123", "protocol": "http",
       "country": "gb", "sessionMode": "rotating", "count": 5}'

# Pool 2's own states, cities and ISPs in one country
curl "https://socksnode.com/api/v1/reseller/locations/GB?pool=2" \
  -H "Authorization: Bearer sk_live_xxx"

鉴权

每个请求都以你的 API 密钥作为 Bearer 令牌进行鉴权。请妥善保密——它可以从你的流量池分配流量。

速率限制:每个密钥每分钟 120 次请求(代理生成会被进一步限流)。请对密钥保密并保存在服务器端。

GET /api/v1/reseller/pool HTTP/1.1
Host: socksnode.com
Authorization: Bearer sk_live_xxx

错误

错误会返回 JSON 主体 { "error": { "code", "message" } },并附带相应的 HTTP 状态码:

状态含义
400请求主体或参数无效
401API 密钥缺失、无效或已撤销
402带宽余额不足,无法生成代理
403API 密钥缺少所需的作用域
404未找到,或不属于你。
422已达到子账户数量上限。
429超出速率限制——参见 Retry-After 响应头
503产品维护中。请稍后重试。
HTTP/1.1 402 Payment Required
Content-Type: application/json

{
  "error": {
    "code": "insufficient_pool",
    "message": "…"
  }
}

自助生成 Session ID

每个凭据的 username 只是一串 token,而 password 在子账户的整个生命周期内保持不变。只要生成过一次,你就可以在本地自行拼接任意数量的 rotating 或 sticky 会话——无需额外调用 API,也不受每次请求 20 个的限制。

以这种方式构造的会话不会被记录为独立凭据——不会出现在子账户的代理列表中,也无法单独吊销。流量仍会按你的分配额度正确限制,汇总用量仍可通过 usage 接口查看。

# Base credential, from any POST …/proxies call
username: acme-country-us
password: 3f9c2a1b-7e4d-4a2c-9f1a-8b6c5d4e3f2a

# Rotating: no session token, a fresh IP every request
acme-country-us

# Sticky: append your own session id + lifetime (1-1440 minutes).
# Build as many as you want locally, no API call needed:
acme-country-us-session-req0001-lifetime-30
acme-country-us-session-req0002-lifetime-30
acme-country-us-session-req0003-lifetime-30

# State and city targeting work the same way (see /locations):
acme-country-us-state-california-session-req0004-lifetime-30

为你的网关打上自有品牌

让代理流量走你自己的域名,而不是我们的。gatewayId 用于选择入口区域(fr/us/sg)——不影响出口国家,出口国家由 country 字段单独设置。

RegiongatewayIdCNAME target
Nearest (default)autoglobal.socksnode.com
Francefrfr.socksnode.com
United Statesusus.socksnode.com
Singaporesgsg.socksnode.com
  1. 1

    Add a DNS record.

    For each region you want branded, create a CNAME from your own subdomain (e.g. us.yourbrand.com) to that region's target above. Only set up the regions you'll use; anything left blank falls back to your default host. If your DNS provider can't do a CNAME there, use an A record and ask us for the current IPs. A CNAME follows automatically if they change; an A record won't.

  2. 2

    Wait for DNS to propagate.

    Usually a few minutes, sometimes a few hours, depending on your provider and TTL.

  3. 3

    Set it in your dashboard.

    Go to Reseller → White-label gateway. With more than one region you'll see a field per region plus a Default field. Enter the domain you set up and save.

  4. 4

    Verify.

    Generate a test proxy for that region, check that the host in the response is your domain, then connect through it once.

gatewayId picks your customer's entry point, not their exit country; the exit country is the country field. A DNS lookup on your CNAME still shows it resolves to socksnode.com. To hide that from your own customers, run your own relay (nginx or HAProxy stream) in front instead of a plain CNAME, and ask us if you need help.

; One CNAME per region you brand
proxy.yourbrand.com.   CNAME   global.socksnode.com.
fr.yourbrand.com.      CNAME   fr.socksnode.com.
us.yourbrand.com.      CNAME   us.socksnode.com.
sg.yourbrand.com.      CNAME   sg.socksnode.com.

端点

获取你的流量池余额

GET/pool

作用域: reseller:read

无参数。

curl "https://socksnode.com/api/v1/reseller/pool" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "poolGb": 812.5,
  "allocatedGb": 187.5,
  "subAccounts": 42,
  "products": {
    "residential": { "poolGb": 812.5, "allocatedGb": 187.5, "ratePerGb": 0.54, "pricing": "wholesale" },
    "datacenter": { "poolGb": 300, "allocatedGb": 23.2, "ratePerGb": null, "pricing": "site" }
  }
}

为某位客户创建子账户

POST/subaccounts

作用域: reseller:manage

请求体参数

  • labelstring可选

    你给该客户的命名,最多 80 个字符。

curl -X POST "https://socksnode.com/api/v1/reseller/subaccounts" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "customer-acme"
  }'
响应201
{
  "id": "sub_9f2a…",
  "label": "customer-acme",
  "balanceGb": 0,
  "usedGb": 0,
  "status": "active",
  "createdAt": "2026-09-30T08:12:44.000Z",
  "products": {
    "residential": { "balanceGb": 8.4, "usedGb": 1.6 },
    "datacenter": { "balanceGb": 20, "usedGb": 3.2 },
    "mobile_rotating": { "balanceGb": 0, "usedGb": 0 }
  }
}

列出子账户及其余额和用量

GET/subaccounts

作用域: reseller:read

无参数。

curl "https://socksnode.com/api/v1/reseller/subaccounts" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "data": [
    {
      "id": "sub_9f2a…",
      "label": "customer-acme",
      "balanceGb": 8.4,
      "usedGb": 1.6,
      "status": "active",
      "createdAt": "2026-09-30T08:12:44.000Z",
      "products": {
        "residential": { "balanceGb": 8.4, "usedGb": 1.6 },
        "datacenter": { "balanceGb": 20, "usedGb": 3.2 },
        "mobile_rotating": { "balanceGb": 0, "usedGb": 0 }
      }
    }
  ]
}

获取一个子账户

GET/subaccounts/{id}

作用域: reseller:read

路径参数

  • idstring必填

    子账户的 id。

curl "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "id": "sub_9f2a…",
  "label": "customer-acme",
  "balanceGb": 8.4,
  "usedGb": 1.6,
  "status": "active",
  "createdAt": "2026-09-30T08:12:44.000Z",
  "products": {
    "residential": { "balanceGb": 8.4, "usedGb": 1.6 },
    "datacenter": { "balanceGb": 20, "usedGb": 3.2 },
    "mobile_rotating": { "balanceGb": 0, "usedGb": 0 }
  }
}

重命名或重新激活子账户

PATCH/subaccounts/{id}

作用域: reseller:manage

路径参数

  • idstring必填

    子账户的 id。

请求体参数

  • labelstring | null可选

    你给该客户的命名,最多 80 个字符。

  • reactivateboolean可选

    true 会重新启用子账户的代理。流量不会恢复。

curl -X PATCH "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "customer-acme-eu"
  }'
响应200
{
  "id": "sub_9f2a…",
  "label": "customer-acme-eu",
  "balanceGb": 8.4,
  "usedGb": 1.6,
  "status": "active",
  "createdAt": "2026-09-30T08:12:44.000Z",
  "products": {
    "residential": { "balanceGb": 8.4, "usedGb": 1.6 },
    "datacenter": { "balanceGb": 20, "usedGb": 3.2 },
    "mobile_rotating": { "balanceGb": 0, "usedGb": 0 }
  }
}

从流量池为子账户分配流量——或发送负数 gb 将其收回

POST/subaccounts/{id}/allocate

作用域: reseller:manage

路径参数

  • idstring必填

    子账户的 id。

请求体参数

  • gbnumber必填

    从你的流量池转出的 GB。负数则转回,最多为子账户余额。

  • productstring可选

    产品:residential(默认)、datacenter 或 mobile_rotating。每种产品有各自的资源池、批发价和子账户余额,在你的账户开通后可用。

    residentialdatacentermobile_rotating默认值: residential

curl -X POST "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/allocate" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "gb": 10,
    "product": "datacenter"
  }'
响应200
{
  "id": "sub_9f2a…",
  "product": "datacenter",
  "balanceGb": 10,
  "poolGb": 290
}

// With a negative gb:
// { "id": "sub_9f2a…", "product": "datacenter", "reclaimedGb": 4, "balanceGb": 6, "poolGb": 294 }

为子账户生成代理凭据

POST/subaccounts/{id}/proxies

rotating(每次请求更换 IP)或 sticky(通过 stickyDurationMinutes 设置 1–1440 分钟内保持同一 IP)。

作用域: reseller:manage

路径参数

  • idstring必填

    子账户的 id。

请求体参数

  • productstring可选

    产品:residential(默认)、datacenter 或 mobile_rotating。每种产品有各自的资源池、批发价和子账户余额,在你的账户开通后可用。 mobile_rotating 默认按国家定位;按州、城市和 ASN 定位时流量按双倍计算,sticky IP 最长保持 120 分钟。

    residentialdatacentermobile_rotating默认值: residential

  • protocolstring必填

    凭据使用的协议。

    httpsocks5

  • countrystring必填

    两位国家代码,或 ANY 表示全球。

  • statestring可选

    美国州名,全称且不含空格,例如 california。

  • citystring可选

    城市名,不含空格,例如 losangeles。设置 asn 时会被忽略。

  • asninteger可选

    ISP 网络编号,例如 Comcast 为 7922。

  • sessionModestring必填

    rotating 每个请求换新 IP;sticky 在 stickyDurationMinutes 内保持同一 IP。

    rotatingsticky

  • stickyDurationMinutesinteger可选

    sticky IP 保持时长,1–1440 分钟。sessionMode 为 sticky 时必填。

  • countinteger可选

    要创建的凭据数量,1–20。

    默认值: 1

  • labelstring可选

    你的命名,最多 80 个字符。count 大于 1 时每个会加上 #n。

  • gatewayIdstring可选

    入口区域:fr、us 或 sg。决定返回哪个白标主机。

    frussg

  • poolstring可选

    住宅代理池:1(默认)、2、3 或 mix。见 Pools。

    123mix默认值: 1

  • mixPoolsstring可选

    pool 为 mix 时:使用哪些代理池,12、13、23 或 123(默认 123)。

    121323123默认值: 123

  • strictboolean可选

    true:只用指定的州、城市或运营商;false:该处没有空闲 IP 时回退到整个国家。Pool 1 默认 true,Mix 默认 false;严格的 Mix 只在 Pool 1 上运行。

curl -X POST "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/proxies" \
  -H "Authorization: Bearer sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "country": "us",
    "protocol": "http",
    "sessionMode": "rotating",
    "gatewayId": "us"
  }'
响应201
{
  "data": [
    {
      "id": "clx…",
      "host": "gw.your-brand.com",
      "port": 9000,
      "username": "acme-country-us",
      "password": "…",
      "protocol": "http",
      "country": "us",
      "state": null,
      "city": null,
      "sessionMode": "rotating",
      "stickyDurationMinutes": null,
      "label": "customer-acme",
      "product": "residential",
      "pool": "1",
      "mixPools": null,
      "poolNote": null
    }
  ]
}

列出子账户的代理凭据,包含密码

GET/subaccounts/{id}/proxies

作用域: reseller:read

路径参数

  • idstring必填

    子账户的 id。

curl "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/proxies" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "data": [
    {
      "id": "clx…",
      "host": "gw.your-brand.com",
      "port": 9000,
      "username": "acme-country-us",
      "password": "…",
      "protocol": "http",
      "country": "us",
      "state": null,
      "city": null,
      "sessionMode": "rotating",
      "stickyDurationMinutes": null,
      "label": "customer-acme",
      "status": "active",
      "createdAt": "2026-09-30T08:12:44.000Z",
      "lastUsedAt": null,
      "product": "residential",
      "pool": "1",
      "mixPools": null,
      "poolNote": null
    }
  ]
}

获取子账户在某时间段的用量

GET/subaccounts/{id}/usage

作用域: reseller:read

路径参数

  • idstring必填

    子账户的 id。

查询参数

  • rangestring可选

    时间范围。未知值按 24h 处理。

    1h24h7d30d90dtodaymonth12mall默认值: 24h

  • productstring可选

    产品:residential(默认)、datacenter 或 mobile_rotating。每种产品有各自的资源池、批发价和子账户余额,在你的账户开通后可用。

    residentialdatacentermobile_rotating默认值: residential

curl "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/usage?range=30d" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "product": "residential",
  "range": "30d",
  "totalGb": 6.8,
  "totalRequests": 91240,
  "successRate": 98.7,
  "series": [{ "period": "2026-09-01", "gb": 0.4 }],
  "requestSeries": [ … ]
}

停用子账户并回收其剩余流量

DELETE/subaccounts/{id}

作用域: reseller:manage

路径参数

  • idstring必填

    子账户的 id。

curl -X DELETE "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "id": "sub_9f2a…",
  "status": "deactivated",
  "reclaimedGb": 8.4,
  "reclaimed": { "residential": 8.4, "datacenter": 20, "mobile_rotating": 0 }
}

列出所有可定位的国家

GET/locations

作用域: reseller:read

查询参数

  • productstring可选

    产品:residential(默认)、datacenter 或 mobile_rotating。每种产品有各自的资源池、批发价和子账户余额,在你的账户开通后可用。

    residentialdatacentermobile_rotating默认值: residential

  • poolstring可选

    要列出地点的住宅代理池:1(默认)、2 或 3。Mix 使用 Pool 1 的列表。

    123默认值: 1

curl "https://socksnode.com/api/v1/reseller/locations" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "product": "residential",
  "data": [
    { "code": "US", "name": "United States" },
    { "code": "GB", "name": "United Kingdom" }
  ]
}

获取某个国家的州/省、城市和 ISP/ASN

GET/locations/{country}

作用域: reseller:read

路径参数

  • countrystring必填

    两位国家代码。

查询参数

  • productstring可选

    产品:residential(默认)、datacenter 或 mobile_rotating。每种产品有各自的资源池、批发价和子账户余额,在你的账户开通后可用。

    residentialdatacentermobile_rotating默认值: residential

  • poolstring可选

    要列出地点的住宅代理池:1(默认)、2 或 3。Mix 使用 Pool 1 的列表。

    123默认值: 1

curl "https://socksnode.com/api/v1/reseller/locations/US" \
  -H "Authorization: Bearer sk_live_xxx"
响应200
{
  "product": "residential",
  "data": {
    "states": [
      {
        "code": "california",
        "name": "California",
        "cities": [{ "code": "losangeles", "name": "Los Angeles" }]
      }
    ],
    "asns": [{ "code": "7922", "name": "Comcast Cable Communications, LLC" }]
  }
}

以你自己的品牌销售住宅代理

分销商 API 权限正随计划陆续开放。