跳至內容
starproxy
開始使用

StarProxy API

控制台大部分功能都可透過程式使用。查看餘額、查詢價格、用餘額下單及取得帶選項的代理用戶名稱,全部經同一套 REST API。

從哪裏開始?

  1. 1以用戶名稱註冊並登入控制台。
  2. 2在「連線」分頁建立 API 金鑰。完整金鑰只會在建立時顯示一次,請即時妥善保存。
  3. 3在每個需要的請求中,以 Authorization 標頭發送金鑰。
  4. 4先呼叫 /account 確認金鑰有效,再用 /orders 下單。

驗證

與你自己帳戶相關的請求(account、orders、proxy-user)需要 API 金鑰,以 Authorization: Bearer spk_... 放在標頭中發送。價格、國家及報價是公開的,毋須金鑰。

StarProxy 只保存每條金鑰的雜湊值,不保存金鑰本身。如遺失金鑰,請在控制台建立新金鑰,舊金鑰會即時失效。金鑰只應放在伺服器程式碼中,切勿放在瀏覽器執行的程式碼或公開的程式碼庫。

HTTP header
Authorization: Bearer spk_your_api_key

基本 URL 及資料格式

基本 URL
https://starproxy.shop/api/v1
請求及回應內容
application/json
金額
以數字表示的美元,例如 1047.70
時間戳記
ISO 8601 (UTC)

有呼叫次數限制嗎?

每條 API 金鑰每分鐘最多可呼叫 60 次。毋須金鑰的公開端點,每個 IP 每分鐘可呼叫 60 次。超出限制會收到 HTTP 429,請等候一分鐘再發送。

錯誤是怎樣的?

一個 HTTP 狀態碼,加上包含簡短錯誤代碼及訊息的 JSON 內容。

例子
{
  "error": {
    "code": "insufficient_balance",
    "message": "Your balance is too low for this order. Top up in the dashboard."
  }
}
code
bad_requestHTTP 400缺少必填值,或該值不適用於此產品。
unauthorizedHTTP 401缺少 API 金鑰或金鑰不符。
insufficient_balanceHTTP 402餘額低於訂單總額,未有扣款。
not_foundHTTP 404你的帳戶沒有此 id 的訂單。
rate_limitedHTTP 429一分鐘內請求次數過多。
server_errorHTTP 500伺服器未能完成請求,未有扣款。

端點

取得帳戶

GET/api/v1/account需要 API 金鑰

返回你的餘額、代理主機及端口、代理用戶名稱和密碼,以及白名單 IP。

請求
curl https://starproxy.shop/api/v1/account \
  -H "Authorization: Bearer spk_your_api_key"
回應
{
  "username": "star_user01",
  "balance_usd": 1300,
  "proxy": {
    "host": "gate.starproxy.shop",
    "http_port": 6100,
    "socks5_port": 6200,
    "username": "spexample1",
    "password": "your_password"
  },
  "allowed_ips": [
    "203.0.113.10"
  ]
}

取得產品及價格

GET/api/v1/products毋須金鑰

返回每種產品的訂購範圍、各數量級距的價格及使用期折扣,與價格頁使用同一價目表。

請求
curl https://starproxy.shop/api/v1/products
回應
{
  "currency": "USD",
  "prices_as_of": "2026-10-31",
  "products": [
    {
      "id": "unlimited",
      "unit": "day",
      "quantity": {
        "meaning": "days",
        "min": 1,
        "max": 365
      },
      "...": "..."
    },
    {
      "id": "residential",
      "unit": "gb",
      "...": "..."
    }
  ]
}

列出國家及城市

GET/api/v1/countries毋須金鑰

返回每種產品支援的國家,以及 -city- 用戶名稱選項所用的城市值。

欄位意思
product選填unlimited、residential、isp、datacenter 其中之一。預設為 residential。
請求
curl "https://starproxy.shop/api/v1/countries?product=datacenter"
回應
{
  "product": "datacenter",
  "countries": [
    {
      "code": "us",
      "name": "United States",
      "region": "americas",
      "datacenter": true,
      "cities": [
        {
          "name": "New York",
          "value": "new_york"
        },
        {
          "name": "Los Angeles",
          "value": "los_angeles"
        }
      ]
    }
  ]
}

取得報價

POST/api/v1/quote毋須金鑰

計算訂單總額,不會動用你的餘額。請發送與下單時相同的內容。

欄位意思
product必填unlimited、residential、isp、datacenter 其中之一。
quantity必填unlimited 為日數(1~365),residential 為 GB(5~5,000),isp 為 IP 數量(1~1,000),datacenter 為 IP 數量(5~5,000)。
concurrency選填只適用於 unlimited。200、500、1000、2000 其中之一。
bandwidth選填只適用於 unlimited,單位為 Mbps。100、200、500、1000 其中之一。
months選填只適用於 isp 及 datacenter。1、3、6、12 其中之一。
country選填只適用於 isp 及 datacenter。兩個字母的國家代碼,例如 jp。有效值見 /countries。
請求
curl -X POST https://starproxy.shop/api/v1/quote \
  -H "Content-Type: application/json" \
  -d '{"product":"unlimited","quantity":30,"concurrency":1000,"bandwidth":200}'
回應
{
  "product": "unlimited",
  "quantity": 30,
  "unit_price_usd": 8.41,
  "unit": "day",
  "total_usd": 252.3
}

建立訂單

POST/api/v1/orders需要 API 金鑰

從餘額扣除總額並建立訂單。狀態初時為 pending(啟用中),訂單準備好後轉為 active。如無法啟用,會變為 refunded,全數金額退回你的餘額。餘額不足會返回 402。

欄位意思
product必填unlimited、residential、isp、datacenter 其中之一。
quantity必填unlimited 為日數(1~365),residential 為 GB(5~5,000),isp 為 IP 數量(1~1,000),datacenter 為 IP 數量(5~5,000)。
concurrency選填只適用於 unlimited。200、500、1000、2000 其中之一。
bandwidth選填只適用於 unlimited,單位為 Mbps。100、200、500、1000 其中之一。
months選填只適用於 isp 及 datacenter。1、3、6、12 其中之一。
country選填只適用於 isp 及 datacenter。兩個字母的國家代碼,例如 jp。有效值見 /countries。
請求
curl -X POST https://starproxy.shop/api/v1/orders \
  -H "Authorization: Bearer spk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"product":"unlimited","quantity":30,"concurrency":1000,"bandwidth":200}'
回應
{
  "order": {
    "id": "SP-7KQ2M-X4HTD",
    "product": "unlimited",
    "quantity": 30,
    "months": null,
    "concurrency": 1000,
    "bandwidth_mbps": 200,
    "country": null,
    "unit_price_usd": 8.41,
    "total_usd": 252.3,
    "status": "pending",
    "created_at": "2026-10-31T09:12:44.120Z",
    "updated_at": "2026-10-31T09:12:44.120Z"
  },
  "balance_usd": 1047.7
}

列出訂單

GET/api/v1/orders需要 API 金鑰

返回最多 100 張訂單,最新的排先。

欄位意思
status選填pending、active、refunded 其中之一。留空則返回所有狀態。
請求
curl "https://starproxy.shop/api/v1/orders?status=pending" \
  -H "Authorization: Bearer spk_your_api_key"
回應
{
  "orders": [
    {
      "id": "SP-7KQ2M-X4HTD",
      "product": "unlimited",
      "quantity": 30,
      "months": null,
      "concurrency": 1000,
      "bandwidth_mbps": 200,
      "country": null,
      "unit_price_usd": 8.41,
      "total_usd": 252.3,
      "status": "pending",
      "created_at": "2026-10-31T09:12:44.120Z",
      "updated_at": "2026-10-31T09:12:44.120Z"
    }
  ]
}

取得訂單

GET/api/v1/orders/{id}需要 API 金鑰

按 id 返回一張訂單,可用於查看是否已完成啟用。

欄位意思
id必填訂單 id,例如 SP-7KQ2M-X4HTD。
請求
curl https://starproxy.shop/api/v1/orders/SP-7KQ2M-X4HTD \
  -H "Authorization: Bearer spk_your_api_key"
回應
{
  "order": {
    "id": "SP-7KQ2M-X4HTD",
    "product": "unlimited",
    "quantity": 30,
    "months": null,
    "concurrency": 1000,
    "bandwidth_mbps": 200,
    "country": null,
    "unit_price_usd": 8.41,
    "total_usd": 252.3,
    "status": "active",
    "created_at": "2026-10-31T09:12:44.120Z",
    "updated_at": "2026-10-31T09:40:02.511Z"
  }
}

產生代理用戶名稱

GET/api/v1/proxy-user需要 API 金鑰

返回已加入你所選選項的代理用戶名稱,以及可直接貼上使用的 HTTP 和 SOCKS5 URL。不發送 session 時,每個請求都會取得新 IP。

欄位意思
product選填unlimited、residential、isp、datacenter 其中之一。預設為 unlimited。
country選填兩個字母的國家代碼,例如 jp。
city選填/countries 中的城市值,例如 tokyo。須同時提供 country。
session選填1~32 個英文字母或數字。相同 session 的請求共用同一 IP。
ttl選填連線階段保持 IP 的分鐘數,1~60。預設為 30。
請求
curl "https://starproxy.shop/api/v1/proxy-user?product=residential&country=jp&city=tokyo&session=job42&ttl=30" \
  -H "Authorization: Bearer spk_your_api_key"
回應
{
  "username": "spexample1-zone-res-cc-jp-city-tokyo-sid-job42-ttl-30",
  "password": "your_password",
  "http": "http://spexample1-zone-res-cc-jp-city-tokyo-sid-job42-ttl-30:your_password@gate.starproxy.shop:6100",
  "socks5": "socks5h://spexample1-zone-res-cc-jp-city-tokyo-sid-job42-ttl-30:your_password@gate.starproxy.shop:6200"
}

完整例子

一個腳本完成取得報價、用餘額下單,再經日本 IP 連線。

Python (requests)
import requests

API = "https://starproxy.shop/api/v1"
HEAD = {"Authorization": "Bearer spk_your_api_key"}

# 1) Check the price first
plan = {"product": "residential", "quantity": 100}
print(requests.post(f"{API}/quote", json=plan).json())

# 2) Order from your balance
r = requests.post(f"{API}/orders", json=plan, headers=HEAD)
order = r.json()["order"]
print(order["id"], order["status"])

# 3) Get a username for Japanese IPs
u = requests.get(f"{API}/proxy-user", headers=HEAD,
                 params={"product": "residential", "country": "jp"}).json()
proxies = {"http": u["http"], "https": u["http"]}
print(requests.get("https://ipinfo.io/json", proxies=proxies, timeout=30).json())
Node.js 18+
const API = "https://starproxy.shop/api/v1";
const HEAD = { Authorization: "Bearer spk_your_api_key", "Content-Type": "application/json" };

// Check the balance
const acc = await fetch(`${API}/account`, { headers: HEAD }).then((r) => r.json());
console.log(acc.balance_usd);

// Order 7 days of unlimited
const res = await fetch(`${API}/orders`, {
  method: "POST",
  headers: HEAD,
  body: JSON.stringify({ product: "unlimited", quantity: 7, concurrency: 500, bandwidth: 100 }),
});
if (res.status === 402) console.log("Top up first");
else console.log((await res.json()).order.id);

API 訂單與控制台訂單的處理方式相同,並會顯示在「記錄」分頁。請把例子中的 spk_your_api_key 換成你自己的金鑰。

在你的程式中直接使用 StarProxy

以用戶名稱註冊,在控制台建立 API 金鑰,即可開始呼叫 API。