Nhà phát triển

API Reseller

Cấp proxy cho khách của bạn bằng lập trình — tạo sub-account, cấp băng thông, tạo thông tin đăng nhập và đọc usage.

Trong trang này

API Reseller

Tổng quan

Cách nhận quyền truy cập. API Reseller được bật sau khi tài khoản reseller của bạn được kích hoạt. Sau đó bạn tạo API key và gọi các endpoint bên dưới.

Kho băng thông
Số dư trả trước của bạn. Cấp cho sub-account sẽ trừ kho; thu hồi sẽ trả lại kho.
Sub-account
Mỗi khách của bạn là một sub-account với băng thông, thông tin proxy và usage riêng.
https://socksnode.com/api/v1/reseller

Sản phẩm

Bạn có thể bán ba sản phẩm. Mỗi sản phẩm có pool riêng, giá sỉ riêng và số dư riêng trên từng sub-account, nên GB của loại này không bao giờ bị tiêu như loại khác. Chọn sản phẩm bằng trường product khi cấp dung lượng, tạo proxy, xem usage và locations.

productSản phẩmNhắm vị tríIP sticky
residentialResidential xoay vòngQuốc gia, bang, thành phố, ASN1–1440 min
datacenterDatacenter xoay vòngQuốc gia, thành phố, ASN1–1440 min
mobile_rotatingMobile xoay vòng (IP nhà mạng 4G/5G)Quốc gia; bang, thành phố và ASN tính lưu lượng ×21–120 min

Không truyền product thì mọi lệnh đều hiểu là residential, đúng như trước. Datacenter và mobile xoay vòng dùng được khi đã bật cho tài khoản của bạn — trước đó các lệnh này trả về 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

Dung lượng dân cư dùng được trên cả ba pool, cùng một mức giá. Gửi pool trong POST /proxies để chọn; bỏ trống là Pool 1, như trước đây. Mix chia đều các yêu cầu qua những pool trong mixPools. Pool nào không phục vụ được mục tiêu sẽ được bỏ qua, và mục tiêu chỉ một pool đáp ứng sẽ chạy trên Pool 1: các trường pool, mixPools và poolNote của từng dòng cho biết dòng đó chạy trên pool nào.

poolNhắm mục tiêuSticky
1Pool 1Quốc gia, bang, thành phố và nhà mạng (ASN), kết hợp tuỳ ý1–1440 min
2Pool 2Quốc gia, rồi một trong: bang, thành phố hoặc nhà mạng1–60 min
3Pool 3Quốc gia, bang và thành phố; không chọn nhà mạng1–1440 min
mixMixĐịa điểm của Pool 1; mỗi pool trong Mix phục vụ phần nó đáp ứng được1–1440 phút khi có Pool 1 + 3 (quá 60 phút thì Pool 2 được bỏ qua); các trường hợp khác 1–60 phút

Địa điểm của Pool 2 và Pool 3: GET /locations?pool=2 (hoặc 3). Gửi tên hay mã đều được: "Los Angeles", "losangeles" và "los_angeles" là cùng một thành phố.

# 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"

Xác thực

Mọi request xác thực bằng API key dạng Bearer token. Giữ bí mật — nó có thể cấp băng thông từ kho của bạn.

Giới hạn tần suất: 120 request mỗi phút cho mỗi key (việc tạo proxy còn bị giới hạn chặt hơn). Giữ key bí mật và chỉ dùng phía máy chủ.

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

Lỗi

Lỗi trả về một body JSON { "error": { "code", "message" } } kèm mã trạng thái HTTP tương ứng:

Trạng tháiÝ nghĩa
400Body hoặc tham số request không hợp lệ
401API key thiếu, không hợp lệ hoặc đã bị thu hồi
402Số dư băng thông không đủ để tạo proxy
403API key thiếu phạm vi bắt buộc
404Không tìm thấy, hoặc không phải của bạn.
422Đã đạt giới hạn số tài khoản con.
429Vượt giới hạn tần suất — xem header Retry-After
503Sản phẩm đang bảo trì. Thử lại sau ít phút.
HTTP/1.1 402 Payment Required
Content-Type: application/json

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

Tự tạo session ID

Username của mỗi thông tin proxy chỉ là một chuỗi token, còn password thì giữ nguyên suốt vòng đời sub-account. Sau khi đã tạo được 1 lần, bạn có thể tự ghép bao nhiêu session rotating hoặc sticky tùy ý ở phía mình — không cần gọi thêm API, không bị giới hạn 20 proxy/lần.

Những session tự ghép theo cách này sẽ không được theo dõi như từng thông tin proxy riêng lẻ — sẽ không hiện trong danh sách proxy của sub-account và không thể thu hồi từng cái. Băng thông vẫn được kiểm soát đúng theo mức đã cấp, và usage tổng vẫn xem được qua endpoint 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

Gắn thương hiệu riêng cho gateway

Cho proxy chạy qua domain riêng của bạn thay vì domain của mình. gatewayId chọn vùng điểm vào (fr/us/sg) — không ảnh hưởng tới quốc gia exit, quốc gia exit chọn riêng qua field 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.

Endpoint

Lấy số dư kho băng thông của bạn

GET/pool

Phạm vi: reseller:read

Không có tham số.

curl "https://socksnode.com/api/v1/reseller/pool" \
  -H "Authorization: Bearer sk_live_xxx"
Phản hồi200
{
  "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" }
  }
}

Tạo một sub-account cho khách của bạn

POST/subaccounts

Phạm vi: reseller:manage

Tham số body

  • labelstringTùy chọn

    Tên bạn đặt cho khách này, tối đa 80 ký tự.

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"
  }'
Phản hồi201
{
  "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 }
  }
}

Liệt kê các sub-account kèm số dư và usage

GET/subaccounts

Phạm vi: reseller:read

Không có tham số.

curl "https://socksnode.com/api/v1/reseller/subaccounts" \
  -H "Authorization: Bearer sk_live_xxx"
Phản hồi200
{
  "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 }
      }
    }
  ]
}

Xem một tài khoản con

GET/subaccounts/{id}

Phạm vi: reseller:read

Tham số đường dẫn

  • idstringBắt buộc

    Id của tài khoản con.

curl "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID" \
  -H "Authorization: Bearer sk_live_xxx"
Phản hồi200
{
  "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 }
  }
}

Đổi tên hoặc kích hoạt lại tài khoản con

PATCH/subaccounts/{id}

Phạm vi: reseller:manage

Tham số đường dẫn

  • idstringBắt buộc

    Id của tài khoản con.

Tham số body

  • labelstring | nullTùy chọn

    Tên bạn đặt cho khách này, tối đa 80 ký tự.

  • reactivatebooleanTùy chọn

    true bật lại các proxy của tài khoản con. Băng thông không được hoàn lại.

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"
  }'
Phản hồi200
{
  "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 }
  }
}

Cấp băng thông cho sub-account từ kho

POST/subaccounts/{id}/allocate

hoặc gửi gb âm để thu hồi lại.

Phạm vi: reseller:manage

Tham số đường dẫn

  • idstringBắt buộc

    Id của tài khoản con.

Tham số body

  • gbnumberBắt buộc

    Số GB chuyển từ kho của bạn. Số âm chuyển GB về lại, tối đa bằng số dư của tài khoản con.

  • productstringTùy chọn

    Sản phẩm: residential (mặc định), datacenter hoặc mobile_rotating. Mỗi loại có pool, giá sỉ và số dư sub-account riêng, dùng được khi đã bật cho tài khoản của bạn.

    residentialdatacentermobile_rotatingMặc định: 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"
  }'
Phản hồi200
{
  "id": "sub_9f2a…",
  "product": "datacenter",
  "balanceGb": 10,
  "poolGb": 290
}

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

Tạo thông tin proxy cho một sub-account

POST/subaccounts/{id}/proxies

rotating (đổi IP mỗi request) hoặc sticky (giữ nguyên IP 1–1440 phút qua stickyDurationMinutes).

Phạm vi: reseller:manage

Tham số đường dẫn

  • idstringBắt buộc

    Id của tài khoản con.

Tham số body

  • productstringTùy chọn

    Sản phẩm: residential (mặc định), datacenter hoặc mobile_rotating. Mỗi loại có pool, giá sỉ và số dư sub-account riêng, dùng được khi đã bật cho tài khoản của bạn. Với mobile_rotating, mặc định chọn theo quốc gia; chọn bang, thành phố và ASN tính lưu lượng gấp đôi, IP sticky giữ tối đa 120 phút.

    residentialdatacentermobile_rotatingMặc định: residential

  • protocolstringBắt buộc

    Giao thức của thông tin đăng nhập.

    httpsocks5

  • countrystringBắt buộc

    Mã quốc gia 2 chữ, hoặc ANY cho toàn cầu.

  • statestringTùy chọn

    Bang của Mỹ, tên đầy đủ viết liền, vd california.

  • citystringTùy chọn

    Tên thành phố viết liền, vd losangeles. Bị bỏ qua khi có asn.

  • asnintegerTùy chọn

    Số mạng của ISP, vd 7922 là Comcast.

  • sessionModestringBắt buộc

    rotating đổi IP mỗi request; sticky giữ một IP trong stickyDurationMinutes.

    rotatingsticky

  • stickyDurationMinutesintegerTùy chọn

    Thời gian giữ IP sticky, 1–1440 phút. Bắt buộc khi sessionMode là sticky.

  • countintegerTùy chọn

    Số thông tin đăng nhập cần tạo, 1–20.

    Mặc định: 1

  • labelstringTùy chọn

    Tên bạn đặt, tối đa 80 ký tự. Khi count lớn hơn 1, mỗi cái có thêm #n.

  • gatewayIdstringTùy chọn

    Vùng cửa vào: fr, us hoặc sg. Quyết định host white-label nào được trả về.

    frussg

  • poolstringTùy chọn

    Pool dân cư: 1 (mặc định), 2, 3 hoặc mix. Xem mục Pools.

    123mixMặc định: 1

  • mixPoolsstringTùy chọn

    Khi pool là mix: các pool được dùng, 12, 13, 23 hoặc 123 (mặc định 123).

    121323123Mặc định: 123

  • strictbooleanTùy chọn

    true: chỉ đúng bang, thành phố hoặc nhà mạng đã chọn; false: chuyển về cả quốc gia khi ở đó hết IP. Mặc định true với Pool 1 và false với Mix; Mix dùng strict sẽ chạy trên 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"
  }'
Phản hồi201
{
  "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
    }
  ]
}

Liệt kê thông tin đăng nhập proxy của tài khoản con, kèm mật khẩu

GET/subaccounts/{id}/proxies

Phạm vi: reseller:read

Tham số đường dẫn

  • idstringBắt buộc

    Id của tài khoản con.

curl "https://socksnode.com/api/v1/reseller/subaccounts/SUB_ID/proxies" \
  -H "Authorization: Bearer sk_live_xxx"
Phản hồi200
{
  "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
    }
  ]
}

Lấy usage của một sub-account trong khoảng thời gian

GET/subaccounts/{id}/usage

Phạm vi: reseller:read

Tham số đường dẫn

  • idstringBắt buộc

    Id của tài khoản con.

Tham số query

  • rangestringTùy chọn

    Khoảng thời gian. Giá trị không hợp lệ sẽ dùng 24h.

    1h24h7d30d90dtodaymonth12mallMặc định: 24h

  • productstringTùy chọn

    Sản phẩm: residential (mặc định), datacenter hoặc mobile_rotating. Mỗi loại có pool, giá sỉ và số dư sub-account riêng, dùng được khi đã bật cho tài khoản của bạn.

    residentialdatacentermobile_rotatingMặc định: residential

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

Vô hiệu hóa sub-account và thu hồi băng thông còn lại

DELETE/subaccounts/{id}

Phạm vi: reseller:manage

Tham số đường dẫn

  • idstringBắt buộc

    Id của tài khoản con.

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

Liệt kê tất cả quốc gia có thể định vị

GET/locations

Phạm vi: reseller:read

Tham số query

  • productstringTùy chọn

    Sản phẩm: residential (mặc định), datacenter hoặc mobile_rotating. Mỗi loại có pool, giá sỉ và số dư sub-account riêng, dùng được khi đã bật cho tài khoản của bạn.

    residentialdatacentermobile_rotatingMặc định: residential

  • poolstringTùy chọn

    Pool dân cư cần liệt kê địa điểm: 1 (mặc định), 2 hoặc 3. Mix dùng danh sách của Pool 1.

    123Mặc định: 1

curl "https://socksnode.com/api/v1/reseller/locations" \
  -H "Authorization: Bearer sk_live_xxx"
Phản hồi200
{
  "product": "residential",
  "data": [
    { "code": "US", "name": "United States" },
    { "code": "GB", "name": "United Kingdom" }
  ]
}

Lấy bang, thành phố và ISP/ASN của một quốc gia

GET/locations/{country}

Phạm vi: reseller:read

Tham số đường dẫn

  • countrystringBắt buộc

    Mã quốc gia 2 chữ.

Tham số query

  • productstringTùy chọn

    Sản phẩm: residential (mặc định), datacenter hoặc mobile_rotating. Mỗi loại có pool, giá sỉ và số dư sub-account riêng, dùng được khi đã bật cho tài khoản của bạn.

    residentialdatacentermobile_rotatingMặc định: residential

  • poolstringTùy chọn

    Pool dân cư cần liệt kê địa điểm: 1 (mặc định), 2 hoặc 3. Mix dùng danh sách của Pool 1.

    123Mặc định: 1

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

Bán proxy dân cư dưới thương hiệu của riêng bạn

Quyền truy cập API Reseller đang được triển khai cùng chương trình.