Residential Proxies
住宅代理的操作
购买额外流量(住宅)
https://user-api.shardx.com/user/api/orders/{id}/add-bandwidthBearer authentication header of the form Bearer <token>.
可选。逻辑操作的唯一标识符(1–128 个 [A-Za-z0-9_.:-] 字符),例如 UUID。
重试结果未知的请求(超时、连接中断)时,请发送相同的键:已完成的请求不会再次执行,而是返回其原始响应。
本 API 的所有修改类端点(POST/PUT/PATCH/DELETE)都接受此标头:购买、续订、追加流量、组件以及今后新增的端点;涉及扣款的端点会明确列出。
除子用户操作外的所有端点:保存的响应会在 7 天内带 `Idempotency-Replayed: true` 标头重放。`409`:使用此键的请求仍在执行(`idempotency_state: in_progress`),或未完成且需要人工核实结果(`idempotency_state: unknown`;不会再次执行)。`422`:该键已用于另一个请求。限流返回的 `429` 不会消耗该键,请使用同一个键重试。
子用户端点(创建、data/add、data/subtract):该键会转发给代理提供商,24 小时内重试不会两次修改配额。409:操作仍在进行,或该键已用于不同的数据。
不带此标头时,请求照常执行,但没有上述保障。
容量(GB,1 GB = 1 073 741 824 字节),最多 100 000
200成功的application/json
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
409使用此 Idempotency-Key 的请求仍在执行(idempotency_state: in_progress),或未完成且需要人工核实结果(idempotency_state: unknown)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
422该 Idempotency-Key 已用于另一个请求application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
429同一账户 3 秒内超过 1 次请求。响应体为纯文本(Too many requests, retry in <N>s),x-ratelimit-after 标头给出需要等待的秒数。Idempotency-Key 不会被消耗:请使用同一个键重试。text/plain
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502付款后未能添加流量;order_id 和 refunded 表明款项是否已退回application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/orders/1/add-bandwidthPOST /user/api/orders/1/add-bandwidth HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Idempotency-Key: text
Content-Type: application/json
Accept: */*
{
"amount": 1,
"promo_code": "text"
}curl -X POST 'https://user-api.shardx.com/user/api/orders/1/add-bandwidth' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Idempotency-Key: text' \
-H 'Content-Type: application/json' \
-d '{"amount":1,"promo_code":"text"}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/add-bandwidth"
headers = {
"Authorization": f"Bearer {token}",
"Idempotency-Key": "text",
}
payload = {
"amount": 1,
"promo_code": "text",
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/orders/1/add-bandwidth";
const payload = {
"amount": 1,
"promo_code": "text"
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Idempotency-Key": "text",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/orders/1/add-bandwidth"
body := bytes.NewBufferString(`{
"amount": 1,
"promo_code": "text"
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "text")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/orders/1/add-bandwidth")
.header("Authorization", format!("Bearer {token}"))
.header("Idempotency-Key", "text")
.json(&serde_json::json!({
"amount": 1,
"promo_code": "text"
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/orders/1/add-bandwidth");
request.Headers.Add("Idempotency-Key", "text");
request.Content = new StringContent("""
{
"amount": 1,
"promo_code": "text"
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Idempotency-Key: text");
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"amount": 1,
"promo_code": "text"
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/add-bandwidth");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "Order paid successfully"
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}"Too many requests, retry in 2s"{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}账户所有者流量
https://user-api.shardx.com/user/api/proxies/profile返回给定代理类型的父账户自己的总数据和剩余数据,在父订单中聚合。与子用户端点不同,这反映了帐户所有者的数据,而不是子用户的数据。
Bearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
200成功application/json
分配的数据总量(以字节为单位)
剩余数据(以字节为单位)
消耗的数据(以字节为单位)
父帐户的代理密码
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502代理提供商不可用或返回错误(Upstream error: <status>)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/profile?proxy_type=textGET /user/api/proxies/profile?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/profile?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/profile"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/profile?proxy_type=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/profile?proxy_type=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/profile?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/profile?proxy_type=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/profile?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"data": 1,
"data_remain": 1,
"data_spent": 1,
"proxy_password": "text"
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}账户统计
https://user-api.shardx.com/user/api/proxies/analytics/{kind}账户本身的流量统计。
kind:
overall:按时间区间统计该时段内的流量和请求数;domains:按目标主机统计该时段内的流量和请求数;connections:当前打开的连接(无时间段)。
默认只统计账户自身的流量。传入 include_sub_users=true 可加上该账户的所有子用户。
Bearer authentication header of the form Bearer <token>.
overall | domains | connections
overalldomainsconnections代理类型(standart | premium | unlimited)
时间窗开始(含),格式为 ISO 8601、YYYY-MM-DD HH:MM:SS 或 Unix 时间戳。connections 忽略此参数。
时间窗结束(不含),默认为当前时间。connections 忽略此参数。
区间边界使用的 IANA 时区,默认 UTC
统计账户及其所有子用户(默认 false)
每页数量
跳过的结果数
200成功application/json
提供商的原始响应,不做修改。其结构取决于 kind:
`overall`:`results` 为时间区间 `{timestamp, data, requests}`,空区间以 0 返回;短时间窗按小时,长时间窗按天;
domains:results 为主机 {hostname, data, requests},按 data 降序排列;没有 count;
* connections:results 为当前打开的连接 {user_id, package_id, server_ip, connections};没有时间段(timezone、start、end)。
结果总数(overall)
下一页链接
上一页链接
resultsobject[]optionalShow propertiesHide properties
区间开始时间(overall)
目标主机(domains)
字节数(overall、domains)
请求数(overall、domains)
账户或子用户 ID(connections)
套餐 ID(connections)
持有这些连接的网关 IP(connections)
打开的连接数(connections)
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502代理提供商不可用或返回错误(Upstream error: <status>)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/analytics/overall?proxy_type=textGET /user/api/proxies/analytics/overall?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/analytics/overall?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/analytics/overall"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/analytics/overall?proxy_type=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/analytics/overall?proxy_type=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/analytics/overall?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/analytics/overall?proxy_type=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/analytics/overall?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"count": 1,
"next": "text",
"previous": "text",
"timezone": "text",
"start": "2026-01-01T00:00:00Z",
"end": "2026-01-01T00:00:00Z",
"results": [
{
"timestamp": "2026-01-01T00:00:00Z",
"hostname": "text",
"data": 1,
"requests": 1,
"user_id": "text",
"package_id": "text",
"server_ip": "text",
"connections": 1
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}子用户统计
https://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/analytics/{kind}账户下单个子用户的同类统计。访问权限由提供商校验:请求以账户身份发出,而账户只能读取自己的子用户。
Bearer authentication header of the form Bearer <token>.
子用户在提供商处的 ID
overall | domains | connections
overalldomainsconnections代理类型(standart | premium | unlimited)
时间窗开始(含),格式为 ISO 8601、YYYY-MM-DD HH:MM:SS 或 Unix 时间戳。connections 忽略此参数。
时间窗结束(不含),默认为当前时间。connections 忽略此参数。
区间边界使用的 IANA 时区,默认 UTC
每页数量
跳过的结果数
200成功application/json
提供商的原始响应,不做修改。其结构取决于 kind:
`overall`:`results` 为时间区间 `{timestamp, data, requests}`,空区间以 0 返回;短时间窗按小时,长时间窗按天;
domains:results 为主机 {hostname, data, requests},按 data 降序排列;没有 count;
* connections:results 为当前打开的连接 {user_id, package_id, server_ip, connections};没有时间段(timezone、start、end)。
结果总数(overall)
下一页链接
上一页链接
resultsobject[]optionalShow propertiesHide properties
区间开始时间(overall)
目标主机(domains)
字节数(overall、domains)
请求数(overall、domains)
账户或子用户 ID(connections)
套餐 ID(connections)
持有这些连接的网关 IP(connections)
打开的连接数(connections)
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502代理提供商不可用或返回错误(Upstream error: <status>)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user/text/analytics/overall?proxy_type=textGET /user/api/proxies/sub-user/text/analytics/overall?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/sub-user/text/analytics/overall?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/analytics/overall"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/analytics/overall?proxy_type=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user/text/analytics/overall?proxy_type=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/sub-user/text/analytics/overall?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/sub-user/text/analytics/overall?proxy_type=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user/text/analytics/overall?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"count": 1,
"next": "text",
"previous": "text",
"timezone": "text",
"start": "2026-01-01T00:00:00Z",
"end": "2026-01-01T00:00:00Z",
"results": [
{
"timestamp": "2026-01-01T00:00:00Z",
"hostname": "text",
"data": 1,
"requests": 1,
"user_id": "text",
"package_id": "text",
"server_ip": "text",
"connections": 1
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}子用户列表
https://user-api.shardx.com/user/api/proxies/sub-usersBearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
在提供商侧按子用户名称或登录名搜索
200成功的application/json
分页前子用户总数
dataobject[]optionalShow propertiesHide properties
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502代理提供商不可用或返回错误(Upstream error: <status>)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-users?proxy_type=textGET /user/api/proxies/sub-users?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/sub-users?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-users"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-users?proxy_type=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-users?proxy_type=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/sub-users?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/sub-users?proxy_type=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-users?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"count": 1,
"data": [
{
"user_id": "text",
"first_name": "text",
"proxy_password": "text",
"data": 1,
"data_spent": 1,
"data_remain": 1
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}通过ID获取子用户
https://user-api.shardx.com/user/api/proxies/sub-user/{user_id}Bearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
200成功的application/json
dataobject[]optional子用户不存在时为空
Show propertiesHide properties
子用户不存在时为空
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502提供商错误(子用户可能仍然存在,请重试)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user/text?proxy_type=textGET /user/api/proxies/sub-user/text?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user/text"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"data": [
{
"user_id": "text",
"first_name": "text",
"proxy_password": "text",
"data": 1,
"data_spent": 1,
"data_remain": 1
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}删除子用户
https://user-api.shardx.com/user/api/proxies/sub-user/{user_id}Bearer authentication header of the form Bearer <token>.
200成功的application/json
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502提供商未删除该子用户(仍然存在)。删除已删除的子用户视为成功。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user/textDELETE /user/api/proxies/sub-user/text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X DELETE 'https://user-api.shardx.com/user/api/proxies/sub-user/text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user/text"
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.delete(url, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user/text";
const response = await fetch(url, {
method: "DELETE",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user/text"
req, err := http.NewRequest("DELETE", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.delete("https://user-api.shardx.com/user/api/proxies/sub-user/text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Delete, "https://user-api.shardx.com/user/api/proxies/sub-user/text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user/text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "Sub user deleted successfully"
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}编辑子用户(名称/包)
https://user-api.shardx.com/user/api/proxies/sub-user/{user_id}Bearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
200成功的application/json
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user/text?proxy_type=textPATCH /user/api/proxies/sub-user/text?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"name": "text"
}curl -X PATCH 'https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"name":"text"}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user/text"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"name": "text",
}
response = requests.patch(url, params=params, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text";
const payload = {
"name": "text"
};
const response = await fetch(url, {
method: "PATCH",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text"
body := bytes.NewBufferString(`{
"name": "text"
}`)
req, err := http.NewRequest("PATCH", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.patch("https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"name": "text"
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Patch, "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text");
request.Content = new StringContent("""
{
"name": "text"
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"name": "text"
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user/text?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "Sub user edited successfully"
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}创建子用户
https://user-api.shardx.com/user/api/proxies/sub-user配额是在账户共享流量池之上的虚拟上限:分配配额不会从流量池扣除,只有子用户实际使用代理时才消耗流量。
Bearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
可选。逻辑操作的唯一标识符(1–128 个 [A-Za-z0-9_.:-] 字符),例如 UUID。
重试结果未知的请求(超时、连接中断)时,请发送相同的键:已完成的请求不会再次执行,而是返回其原始响应。
本 API 的所有修改类端点(POST/PUT/PATCH/DELETE)都接受此标头:购买、续订、追加流量、组件以及今后新增的端点;涉及扣款的端点会明确列出。
除子用户操作外的所有端点:保存的响应会在 7 天内带 `Idempotency-Replayed: true` 标头重放。`409`:使用此键的请求仍在执行(`idempotency_state: in_progress`),或未完成且需要人工核实结果(`idempotency_state: unknown`;不会再次执行)。`422`:该键已用于另一个请求。限流返回的 `429` 不会消耗该键,请使用同一个键重试。
子用户端点(创建、data/add、data/subtract):该键会转发给代理提供商,24 小时内重试不会两次修改配额。409:操作仍在进行,或该键已用于不同的数据。
不带此标头时,请求照常执行,但没有上述保障。
容量(GB,1 GB = 1 073 741 824 字节),最多 100 000
容量(字节,精确值;优先于 data),最多 100 000 GB
200成功的application/json
dataobject[]optionalShow propertiesHide properties
400校验错误,或提供商拒绝了请求(rejected: true);未创建任何内容application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
409使用此 Idempotency-Key 的请求仍在执行,或该键已用于不同的数据application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502提供商不可达:结果未知;请使用同一个 Idempotency-Key 重试application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user?proxy_type=textPOST /user/api/proxies/sub-user?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Idempotency-Key: text
Content-Type: application/json
Accept: */*
{
"name": "text",
"data": 1,
"data_bytes": 1
}curl -X POST 'https://user-api.shardx.com/user/api/proxies/sub-user?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Idempotency-Key: text' \
-H 'Content-Type: application/json' \
-d '{"name":"text","data":1,"data_bytes":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
"Idempotency-Key": "text",
}
payload = {
"name": "text",
"data": 1,
"data_bytes": 1,
}
response = requests.post(url, params=params, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user?proxy_type=text";
const payload = {
"name": "text",
"data": 1,
"data_bytes": 1
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Idempotency-Key": "text",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user?proxy_type=text"
body := bytes.NewBufferString(`{
"name": "text",
"data": 1,
"data_bytes": 1
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "text")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/proxies/sub-user?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.header("Idempotency-Key", "text")
.json(&serde_json::json!({
"name": "text",
"data": 1,
"data_bytes": 1
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/proxies/sub-user?proxy_type=text");
request.Headers.Add("Idempotency-Key", "text");
request.Content = new StringContent("""
{
"name": "text",
"data": 1,
"data_bytes": 1
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Idempotency-Key: text");
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"name": "text",
"data": 1,
"data_bytes": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"data": [
{
"user_id": "text",
"first_name": "text",
"proxy_password": "text",
"data": 1,
"data_spent": 1,
"data_remain": 1
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}给子用户添加流量
https://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/data/addBearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
可选。逻辑操作的唯一标识符(1–128 个 [A-Za-z0-9_.:-] 字符),例如 UUID。
重试结果未知的请求(超时、连接中断)时,请发送相同的键:已完成的请求不会再次执行,而是返回其原始响应。
本 API 的所有修改类端点(POST/PUT/PATCH/DELETE)都接受此标头:购买、续订、追加流量、组件以及今后新增的端点;涉及扣款的端点会明确列出。
除子用户操作外的所有端点:保存的响应会在 7 天内带 `Idempotency-Replayed: true` 标头重放。`409`:使用此键的请求仍在执行(`idempotency_state: in_progress`),或未完成且需要人工核实结果(`idempotency_state: unknown`;不会再次执行)。`422`:该键已用于另一个请求。限流返回的 `429` 不会消耗该键,请使用同一个键重试。
子用户端点(创建、data/add、data/subtract):该键会转发给代理提供商,24 小时内重试不会两次修改配额。409:操作仍在进行,或该键已用于不同的数据。
不带此标头时,请求照常执行,但没有上述保障。
容量(GB,1 GB = 1 073 741 824 字节),最多 100 000
容量(字节,精确值;优先于 data),最多 100 000 GB
200成功的application/json
orderobject · SubUserOrderState· nullableoptional操作之后的子用户配额状态(提供商未返回订单对象时为 null)
Show propertiesHide properties
操作之后的子用户配额状态(提供商未返回订单对象时为 null)
已分配的配额(字节)
已用字节数
剩余字节数(超额使用时可能为负)
400校验错误,或提供商拒绝了操作(rejected: true);配额未改变application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
409使用此 Idempotency-Key 的请求仍在执行,或该键已用于不同的数据application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502提供商不可达:结果未知;请使用同一个 Idempotency-Key 重试application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user/text/data/add?proxy_type=textPOST /user/api/proxies/sub-user/text/data/add?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Idempotency-Key: text
Content-Type: application/json
Accept: */*
{
"data": 1,
"data_bytes": 1
}curl -X POST 'https://user-api.shardx.com/user/api/proxies/sub-user/text/data/add?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Idempotency-Key: text' \
-H 'Content-Type: application/json' \
-d '{"data":1,"data_bytes":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/add"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
"Idempotency-Key": "text",
}
payload = {
"data": 1,
"data_bytes": 1,
}
response = requests.post(url, params=params, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/add?proxy_type=text";
const payload = {
"data": 1,
"data_bytes": 1
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Idempotency-Key": "text",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/add?proxy_type=text"
body := bytes.NewBufferString(`{
"data": 1,
"data_bytes": 1
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "text")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/proxies/sub-user/text/data/add?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.header("Idempotency-Key", "text")
.json(&serde_json::json!({
"data": 1,
"data_bytes": 1
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/add?proxy_type=text");
request.Headers.Add("Idempotency-Key", "text");
request.Content = new StringContent("""
{
"data": 1,
"data_bytes": 1
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Idempotency-Key: text");
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"data": 1,
"data_bytes": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/add?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "Traffic added to sub user successfully",
"order": {
"proxy_password": "text",
"data": 1,
"data_spent": 1,
"data_remain": 1
}
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}扣除子用户流量
https://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/data/subtractBearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
可选。逻辑操作的唯一标识符(1–128 个 [A-Za-z0-9_.:-] 字符),例如 UUID。
重试结果未知的请求(超时、连接中断)时,请发送相同的键:已完成的请求不会再次执行,而是返回其原始响应。
本 API 的所有修改类端点(POST/PUT/PATCH/DELETE)都接受此标头:购买、续订、追加流量、组件以及今后新增的端点;涉及扣款的端点会明确列出。
除子用户操作外的所有端点:保存的响应会在 7 天内带 `Idempotency-Replayed: true` 标头重放。`409`:使用此键的请求仍在执行(`idempotency_state: in_progress`),或未完成且需要人工核实结果(`idempotency_state: unknown`;不会再次执行)。`422`:该键已用于另一个请求。限流返回的 `429` 不会消耗该键,请使用同一个键重试。
子用户端点(创建、data/add、data/subtract):该键会转发给代理提供商,24 小时内重试不会两次修改配额。409:操作仍在进行,或该键已用于不同的数据。
不带此标头时,请求照常执行,但没有上述保障。
容量(GB,1 GB = 1 073 741 824 字节),最多 100 000
容量(字节,精确值;优先于 data),最多 100 000 GB
200成功的application/json
orderobject · SubUserOrderState· nullableoptional操作之后的子用户配额状态(提供商未返回订单对象时为 null)
Show propertiesHide properties
操作之后的子用户配额状态(提供商未返回订单对象时为 null)
已分配的配额(字节)
已用字节数
剩余字节数(超额使用时可能为负)
400校验错误,或提供商拒绝了操作(rejected: true);配额未改变application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
409使用此 Idempotency-Key 的请求仍在执行,或该键已用于不同的数据application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502提供商不可达:结果未知;请使用同一个 Idempotency-Key 重试application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user/text/data/subtract?proxy_type=textPOST /user/api/proxies/sub-user/text/data/subtract?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Idempotency-Key: text
Content-Type: application/json
Accept: */*
{
"data": 1,
"data_bytes": 1
}curl -X POST 'https://user-api.shardx.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Idempotency-Key: text' \
-H 'Content-Type: application/json' \
-d '{"data":1,"data_bytes":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/subtract"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
"Idempotency-Key": "text",
}
payload = {
"data": 1,
"data_bytes": 1,
}
response = requests.post(url, params=params, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text";
const payload = {
"data": 1,
"data_bytes": 1
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Idempotency-Key": "text",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text"
body := bytes.NewBufferString(`{
"data": 1,
"data_bytes": 1
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "text")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.header("Idempotency-Key", "text")
.json(&serde_json::json!({
"data": 1,
"data_bytes": 1
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text");
request.Headers.Add("Idempotency-Key", "text");
request.Content = new StringContent("""
{
"data": 1,
"data_bytes": 1
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Idempotency-Key: text");
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"data": 1,
"data_bytes": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "Traffic subtracted from sub user successfully",
"order": {
"proxy_password": "text",
"data": 1,
"data_spent": 1,
"data_remain": 1
}
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}修改子用户密码
https://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/passwordBearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
200成功的application/json
新的代理密码
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502提供商未更换密码(旧密码仍然有效)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/sub-user/text/password?proxy_type=textPOST /user/api/proxies/sub-user/text/password?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X POST 'https://user-api.shardx.com/user/api/proxies/sub-user/text/password?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/password"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.post(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/sub-user/text/password?proxy_type=text";
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/sub-user/text/password?proxy_type=text"
req, err := http.NewRequest("POST", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/proxies/sub-user/text/password?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/proxies/sub-user/text/password?proxy_type=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/sub-user/text/password?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "Sub user password changed successfully",
"proxy_password": "text"
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}国家列表
https://user-api.shardx.com/user/api/proxies/countriesBearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
200成功的application/json
resultsobject · Country[]requiredShow propertiesHide properties
ISO国家代码
国家名称
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/countries?proxy_type=textGET /user/api/proxies/countries?proxy_type=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/countries?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/countries"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/countries?proxy_type=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/countries?proxy_type=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/countries?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/countries?proxy_type=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/countries?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text"
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}地区列表
https://user-api.shardx.com/user/api/proxies/regionsBearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
ISO国家代码
200成功的application/json
resultsobject · Region[]requiredShow propertiesHide properties
地区代码(州/省代码)
地区名称(州/省名称)
countryobject · CountryrequiredShow propertiesHide properties
ISO国家代码
国家名称
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/regions?proxy_type=text&country_code=textGET /user/api/proxies/regions?proxy_type=text&country_code=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/regions?proxy_type=text&country_code=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/regions"
params = {
"proxy_type": "text",
"country_code": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/regions?proxy_type=text&country_code=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/regions?proxy_type=text&country_code=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/regions?proxy_type=text&country_code=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/regions?proxy_type=text&country_code=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/regions?proxy_type=text&country_code=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text",
"country": {
"code": "text",
"name": "text"
}
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}城市列表
https://user-api.shardx.com/user/api/proxies/citiesBearer authentication header of the form Bearer <token>.
代理类型(standart | premium | unlimited)
ISO国家代码
地区代码(州/省)
200成功的application/json
resultsobject · City[]requiredShow propertiesHide properties
城市代码(通常为 slug 格式)
城市名称
countryobject · CountryrequiredShow propertiesHide properties
ISO国家代码
国家名称
regionobject· nullableoptionalShow propertiesHide properties
地区代码
地区名称
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=textGET /user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/cities"
params = {
"proxy_type": "text",
"country_code": "text",
"region_code": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text",
"country": {
"code": "text",
"name": "text"
},
"region": {
"code": "text",
"name": "text"
}
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}列出 ISP
https://user-api.shardx.com/user/api/proxies/isps城市内可用的互联网提供商;继国家、地区、城市之后的第四个目标级别。与其他位置端点不同,这个端点需要完整的链:country_code、region_code 和 city_code 都是必需的,因为上游 ISP 与城市绑定。仅高级套餐:不为标准套餐和无限制套餐维护 ISP 目录,任何其他 proxy_type 都会被拒绝并返回 400。仅列出主要城市的 ISP,因此对于较小的城市,带有 count: 0 的空 results 是正常答案。
Bearer authentication header of the form Bearer <token>.
必须为 premium;ISP 定向仅适用于 premium 套餐。
premiumISO国家代码
地区或州代码
来自 GET /user/api/proxies/cities 的城市代码
200成功application/json
resultsobject · Isp[]requiredShow propertiesHide properties
ISP 代码,通常是一个 slug
互联网服务提供商名称
countryobject · CountryrequiredShow propertiesHide properties
ISO国家代码
国家名称
regionobject· nullableoptionalShow propertiesHide properties
地区代码
地区名称
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=textGET /user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/isps"
params = {
"proxy_type": "premium",
"country_code": "text",
"region_code": "text",
"city_code": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text",
"country": {
"code": "text",
"name": "text"
},
"region": {
"code": "text",
"name": "text"
}
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}最后更新