ข้ามไปยังเนื้อหา
starproxy

StarProxy API

ฟังก์ชันส่วนใหญ่ในแดชบอร์ดใช้ผ่านโค้ดได้ เช็กยอดเงิน ดูราคา สั่งซื้อจากยอดเงิน และดึงชื่อผู้ใช้พร็อกซี่พร้อมตัวเลือก ทั้งหมดผ่าน REST API เดียว

เริ่มต้นจากตรงไหน?

  1. 1สมัครด้วยชื่อผู้ใช้และเข้าสู่แดชบอร์ด
  2. 2สร้างคีย์ API ในแท็บ Connect คีย์เต็มจะแสดงเพียงครั้งเดียวตอนสร้าง จึงควรเก็บไว้ในที่ปลอดภัยทันที
  3. 3ส่งคีย์ในเฮดเดอร์ Authorization กับทุกคำขอที่ต้องใช้
  4. 4เรียก /account ก่อนเพื่อตรวจว่าคีย์ใช้ได้ แล้วสั่งซื้อด้วย /orders

การยืนยันตัวตน

คำขอเกี่ยวกับบัญชีของคุณ (account, orders, proxy-user) ต้องใช้คีย์ API ส่งในเฮดเดอร์เป็น Authorization: Bearer spk_... ราคา ประเทศ และใบเสนอราคาเป็นข้อมูลสาธารณะและใช้ได้โดยไม่ต้องมีคีย์

StarProxy เก็บเพียงค่าแฮชของแต่ละคีย์ ไม่ได้เก็บตัวคีย์ หากคีย์หาย ให้สร้างคีย์ใหม่ในแดชบอร์ด คีย์เดิมจะใช้ไม่ได้ทันที เก็บคีย์ไว้ในโค้ดฝั่งเซิร์ฟเวอร์เท่านั้น ห้ามใส่ในโค้ดที่ทำงานบนเบราว์เซอร์หรือใน repository สาธารณะ

HTTP header
Authorization: Bearer spk_your_api_key

Base URL และรูปแบบข้อมูล

Base URL
https://starproxy.shop/api/v1
เนื้อหาคำขอและการตอบกลับ
application/json
จำนวนเงิน
USD เป็นตัวเลข เช่น 1047.70
เวลา
ISO 8601 (UTC)

มีการจำกัดจำนวนการเรียกไหม?

คีย์ API หนึ่งคีย์เรียกได้สูงสุด 60 ครั้งต่อนาที เอนด์พอยต์สาธารณะที่ไม่ใช้คีย์ได้ 60 ครั้งต่อนาทีต่อ IP หากเกินจะได้ HTTP 429 ให้รอ 1 นาทีแล้วส่งใหม่

ข้อผิดพลาดมีลักษณะอย่างไร?

รหัสสถานะ 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ส่งคำขอมากเกินไปภายใน 1 นาที
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), GB สำหรับ residential (5~5,000), จำนวน IP สำหรับ isp (1~1,000) หรือ datacenter (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 รหัสประเทศ 2 ตัวอักษร เช่น 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), GB สำหรับ residential (5~5,000), จำนวน IP สำหรับ isp (1~1,000) หรือ datacenter (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 รหัสประเทศ 2 ตัวอักษร เช่น 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

แสดงชื่อผู้ใช้พร็อกซี่ที่รวมตัวเลือกของคุณไว้ พร้อม URL แบบ HTTP และ SOCKS5 ที่วางใช้ได้ทันที หากไม่ส่ง session แต่ละคำขอจะได้ IP ใหม่

ฟิลด์ความหมาย
productไม่บังคับหนึ่งใน unlimited, residential, isp, datacenter ค่าเริ่มต้นคือ unlimited
countryไม่บังคับรหัสประเทศ 2 ตัวอักษร เช่น 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