開始使用
- 1建立帳號並登入控制台。
- 2在「連線」中建立 API 金鑰。完整金鑰只會顯示一次,請立刻保存。
- 3在每個需要金鑰的請求的 Authorization 標頭中放入金鑰。
- 4呼叫 /account 確認金鑰可以使用,再用 /orders 購買。
驗證
與您帳號相關的端點(account、orders、proxy-user)需要 API 金鑰,以 Bearer 權杖放在 Authorization 標頭中送出。價格、國家和試算是公開的,不需要金鑰。
系統只保存金鑰的雜湊值。如果遺失,請在控制台建立新的金鑰,舊金鑰會立即失效。請勿把金鑰放在瀏覽器端程式碼或公開的儲存庫中。
Authorization: Bearer rpk_your_api_key
基本網址與資料格式
- 基本 URL
- https://royalproxy.online/api/v1
- 請求與回應內容
- application/json
- 金額
- 金額以 USD 數字表示,例如 807.90
- 時間
- 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."
}
}| HTTP | code | 說明 |
|---|---|---|
| bad_requestHTTP 400缺少必要的值,或某個值不適用於此產品。 | 缺少必要的值,或某個值不適用於此產品。 | |
| unauthorizedHTTP 401沒有送出 API 金鑰,或金鑰無效。 | 沒有送出 API 金鑰,或金鑰無效。 | |
| insufficient_balanceHTTP 402訂單金額超過您的餘額。沒有扣款。 | 訂單金額超過您的餘額。沒有扣款。 | |
| not_foundHTTP 404您的帳號中沒有此 id 的訂單。 | 您的帳號中沒有此 id 的訂單。 | |
| rate_limitedHTTP 429已達每分鐘請求上限。 | 已達每分鐘請求上限。 | |
| server_errorHTTP 500我們這邊發生錯誤。沒有扣款。 | 我們這邊發生錯誤。沒有扣款。 |
端點
帳號資訊
GET/api/v1/accountAPI 金鑰
您的餘額、代理主機與埠、代理使用者名稱與密碼,以及允許的 IP。
curl https://royalproxy.online/api/v1/account \ -H "Authorization: Bearer rpk_your_api_key"
{
"username": "royal_user",
"balance_usd": 1300,
"proxy": {
"host": "gate.royalproxy.online",
"http_port": 6100,
"socks5_port": 6200,
"username": "rpexample1",
"password": "your_password"
},
"allowed_ips": [
"203.0.113.10"
]
}產品與價格
GET/api/v1/products不需金鑰
所有產品及其限制、價格級距和折扣,讀取自與價格頁面相同的價目表。
curl https://royalproxy.online/api/v1/products
{
"currency": "USD",
"prices_as_of": "2026-11-28",
"products": [
{
"id": "unlimited",
"unit": "day",
"quantity": {
"meaning": "days",
"min": 1,
"max": 365
},
"...": "..."
},
{
"id": "residential",
"unit": "gb",
"...": "..."
}
]
}國家與城市
GET/api/v1/countries不需金鑰
某個產品可用的國家,以及要填入代理使用者名稱的城市值。
| 欄位 | 類型 | 說明 |
|---|---|---|
product選填 | string | residential、unlimited、isp、datacenter 其中之一。預設為 residential。 |
curl "https://royalproxy.online/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必填 | string | residential、unlimited、isp、datacenter 其中之一。 |
quantity必填 | integer | residential 為 GB 數(5~5,000),unlimited 為天數(1~365),isp 為 IP 數(1~1,000),datacenter 為 IP 數(5~5,000)。 |
concurrency選填 | integer | 僅限 unlimited:200、500、1000 或 2000。 |
bandwidth選填 | integer | 僅限 unlimited,單位 Mbps:100、200、500 或 1000。 |
months選填 | integer | 僅限 isp 和 datacenter:1、3、6 或 12。 |
country選填 | string | 僅限 isp 和 datacenter:兩個字母的代碼,例如 jp。有效代碼請從 /countries 取得。 |
curl -X POST https://royalproxy.online/api/v1/quote \
-H "Content-Type: application/json" \
-d '{"product":"unlimited","quantity":30,"concurrency":1000,"bandwidth":200}'{
"product": "unlimited",
"quantity": 30,
"unit_price_usd": 6.97,
"unit": "day",
"total_usd": 209.1
}建立訂單
POST/api/v1/ordersAPI 金鑰
從您的餘額扣除總額並建立訂單。訂單一開始為 pending(開通中),準備好後變為 active。如果開通失敗,會變為 refunded,全部金額退回餘額。餘額不足時回傳 402。
| 欄位 | 類型 | 說明 |
|---|---|---|
product必填 | string | residential、unlimited、isp、datacenter 其中之一。 |
quantity必填 | integer | residential 為 GB 數(5~5,000),unlimited 為天數(1~365),isp 為 IP 數(1~1,000),datacenter 為 IP 數(5~5,000)。 |
concurrency選填 | integer | 僅限 unlimited:200、500、1000 或 2000。 |
bandwidth選填 | integer | 僅限 unlimited,單位 Mbps:100、200、500 或 1000。 |
months選填 | integer | 僅限 isp 和 datacenter:1、3、6 或 12。 |
country選填 | string | 僅限 isp 和 datacenter:兩個字母的代碼,例如 jp。有效代碼請從 /countries 取得。 |
curl -X POST https://royalproxy.online/api/v1/orders \
-H "Authorization: Bearer rpk_your_api_key" \
-H "Content-Type: application/json" \
-d '{"product":"unlimited","quantity":30,"concurrency":1000,"bandwidth":200}'{
"order": {
"id": "RP-7KQ2M-X4HTD",
"product": "unlimited",
"quantity": 30,
"months": null,
"concurrency": 1000,
"bandwidth_mbps": 200,
"country": null,
"unit_price_usd": 6.97,
"total_usd": 209.1,
"status": "pending",
"created_at": "2026-10-31T09:12:44.120Z",
"updated_at": "2026-10-31T09:12:44.120Z"
},
"balance_usd": 1090.9
}您的訂單
GET/api/v1/ordersAPI 金鑰
您帳號中最近的 100 筆訂單,新的在前。
| 欄位 | 類型 | 說明 |
|---|---|---|
status選填 | string | pending、active 或 refunded。省略時列出全部。 |
curl "https://royalproxy.online/api/v1/orders?status=pending" \ -H "Authorization: Bearer rpk_your_api_key"
{
"orders": [
{
"id": "RP-7KQ2M-X4HTD",
"product": "unlimited",
"quantity": 30,
"months": null,
"concurrency": 1000,
"bandwidth_mbps": 200,
"country": null,
"unit_price_usd": 6.97,
"total_usd": 209.1,
"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必填 | string | 訂單 id,例如 RP-7KQ2M-X4HTD。 |
curl https://royalproxy.online/api/v1/orders/RP-7KQ2M-X4HTD \ -H "Authorization: Bearer rpk_your_api_key"
{
"order": {
"id": "RP-7KQ2M-X4HTD",
"product": "unlimited",
"quantity": 30,
"months": null,
"concurrency": 1000,
"bandwidth_mbps": 200,
"country": null,
"unit_price_usd": 6.97,
"total_usd": 209.1,
"status": "active",
"created_at": "2026-10-31T09:12:44.120Z",
"updated_at": "2026-10-31T09:40:02.511Z"
}
}代理使用者名稱產生器
GET/api/v1/proxy-userAPI 金鑰
依您的選項產生代理使用者名稱,並回傳可直接使用的 HTTP 和 SOCKS5 代理網址。session 留空時,每個請求都會輪換 IP。
| 欄位 | 類型 | 說明 |
|---|---|---|
product選填 | string | residential、unlimited、isp、datacenter 其中之一。預設為 unlimited。 |
country選填 | string | 兩個字母的國家代碼,例如 jp。 |
city選填 | string | /countries 中的城市值,例如 tokyo。需要同時指定 country。 |
session選填 | string | 1~32 個英文字母或數字。共用同一個 session 的請求會保持同一個 IP。 |
ttl選填 | integer | 工作階段保持 IP 的分鐘數,1~60。預設為 30。 |
curl "https://royalproxy.online/api/v1/proxy-user?product=residential&country=jp&city=tokyo&session=job42&ttl=30" \ -H "Authorization: Bearer rpk_your_api_key"
{
"username": "rpexample1-zone-res-cc-jp-city-tokyo-sid-job42-ttl-30",
"password": "your_password",
"http": "http://rpexample1-zone-res-cc-jp-city-tokyo-sid-job42-ttl-30:your_password@gate.royalproxy.online:6100",
"socks5": "socks5h://rpexample1-zone-res-cc-jp-city-tokyo-sid-job42-ttl-30:your_password@gate.royalproxy.online:6200"
}完整範例
試算價格、從餘額購買,再透過日本 IP 送出請求。
import requests
API = "https://royalproxy.online/api/v1"
HEAD = {"Authorization": "Bearer rpk_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())const API = "https://royalproxy.online/api/v1";
const HEAD = { Authorization: "Bearer rpk_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 下的訂單和控制台訂單相同,也會顯示在「紀錄」中。請把 rpk_your_api_key 換成您的實際金鑰。