APIAPI 与集成ShardX APIResidential Proxies

Residential Proxies

住宅代理的操作

购买额外流量(住宅)

POSThttps://user-api.shardx.com/user/api/orders/{id}/add-bandwidth
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
idintegerrequired
Header parameters
Idempotency-Keystring· max length: 128· pattern: ^[A-Za-z0-9_.:-]+$optional

可选。逻辑操作的唯一标识符(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:操作仍在进行,或该键已用于不同的数据。

不带此标头时,请求照常执行,但没有上述保障。

Body
application/json
amountintegerrequired

容量(GB,1 GB = 1 073 741 824 字节),最多 100 000

promo_codestring· nullableoptional
Responses
200成功的application/json
successbooleanrequired
messagestringrequired
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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

409使用此 Idempotency-Key 的请求仍在执行(idempotency_state: in_progress),或未完成且需要人工核实结果(idempotency_state: unknown)application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

422该 Idempotency-Key 已用于另一个请求application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502付款后未能添加流量;order_id 和 refunded 表明款项是否已退回application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

POST/user/api/orders/1/add-bandwidth
POST /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
}

账户所有者流量

GEThttps://user-api.shardx.com/user/api/proxies/profile

返回给定代理类型的父账户自己的总数据和剩余数据,在父订单中聚合。与子用户端点不同,这反映了帐户所有者的数据,而不是子用户的数据。

Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Responses
200成功application/json
successbooleanrequired
dataintegerrequired

分配的数据总量(以字节为单位)

data_remainintegerrequired

剩余数据(以字节为单位)

data_spentintegerrequired

消耗的数据(以字节为单位)

proxy_passwordstringrequired

父帐户的代理密码

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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502代理提供商不可用或返回错误(Upstream error: <status>)application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/profile?proxy_type=text
GET /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
}

账户统计

GEThttps://user-api.shardx.com/user/api/proxies/analytics/{kind}

账户本身的流量统计。

kind:

  • overall:按时间区间统计该时段内的流量和请求数;
  • domains:按目标主机统计该时段内的流量和请求数;
  • connections:当前打开的连接(无时间段)。

默认只统计账户自身的流量。传入 include_sub_users=true 可加上该账户的所有子用户。

Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
kindstring · enumrequired

overall | domains | connections

Possible values:overalldomainsconnections
Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

startstringoptional

时间窗开始(含),格式为 ISO 8601、YYYY-MM-DD HH:MM:SS 或 Unix 时间戳。connections 忽略此参数。

endstringoptional

时间窗结束(不含),默认为当前时间。connections 忽略此参数。

timezonestringoptional

区间边界使用的 IANA 时区,默认 UTC

include_sub_usersbooleanoptional

统计账户及其所有子用户(默认 false)

limitintegeroptional

每页数量

offsetintegeroptional

跳过的结果数

Responses
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)。

countintegeroptional

结果总数(overall)

nextstring· nullableoptional

下一页链接

previousstring· nullableoptional

上一页链接

timezonestringoptional
startstring · date-timeoptional
endstring · date-timeoptional
resultsobject[]optional
Show propertiesHide properties
timestampstring · date-timeoptional

区间开始时间(overall)

hostnamestringoptional

目标主机(domains)

datainteger · int64optional

字节数(overall、domains)

requestsintegeroptional

请求数(overall、domains)

user_idstringoptional

账户或子用户 ID(connections)

package_idstringoptional

套餐 ID(connections)

server_ipstringoptional

持有这些连接的网关 IP(connections)

connectionsintegeroptional

打开的连接数(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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502代理提供商不可用或返回错误(Upstream error: <status>)application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/analytics/overall?proxy_type=text
GET /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
}

子用户统计

GEThttps://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/analytics/{kind}

账户下单个子用户的同类统计。访问权限由提供商校验:请求以账户身份发出,而账户只能读取自己的子用户。

Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
user_idstringrequired

子用户在提供商处的 ID

kindstring · enumrequired

overall | domains | connections

Possible values:overalldomainsconnections
Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

startstringoptional

时间窗开始(含),格式为 ISO 8601、YYYY-MM-DD HH:MM:SS 或 Unix 时间戳。connections 忽略此参数。

endstringoptional

时间窗结束(不含),默认为当前时间。connections 忽略此参数。

timezonestringoptional

区间边界使用的 IANA 时区,默认 UTC

limitintegeroptional

每页数量

offsetintegeroptional

跳过的结果数

Responses
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)。

countintegeroptional

结果总数(overall)

nextstring· nullableoptional

下一页链接

previousstring· nullableoptional

上一页链接

timezonestringoptional
startstring · date-timeoptional
endstring · date-timeoptional
resultsobject[]optional
Show propertiesHide properties
timestampstring · date-timeoptional

区间开始时间(overall)

hostnamestringoptional

目标主机(domains)

datainteger · int64optional

字节数(overall、domains)

requestsintegeroptional

请求数(overall、domains)

user_idstringoptional

账户或子用户 ID(connections)

package_idstringoptional

套餐 ID(connections)

server_ipstringoptional

持有这些连接的网关 IP(connections)

connectionsintegeroptional

打开的连接数(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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502代理提供商不可用或返回错误(Upstream error: <status>)application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/sub-user/text/analytics/overall?proxy_type=text
GET /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
}

子用户列表

GEThttps://user-api.shardx.com/user/api/proxies/sub-users
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

offsetintegeroptional
limitintegeroptional
searchstringoptional

在提供商侧按子用户名称或登录名搜索

Responses
200成功的application/json
successbooleanoptional
countintegeroptional

分页前子用户总数

dataobject[]optional
Show propertiesHide properties
user_idstringrequired
first_namestringrequired
proxy_passwordstringrequired
dataintegerrequired
data_spentintegerrequired
data_remainintegerrequired
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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502代理提供商不可用或返回错误(Upstream error: <status>)application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/sub-users?proxy_type=text
GET /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获取子用户

GEThttps://user-api.shardx.com/user/api/proxies/sub-user/{user_id}
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
user_idstringrequired
Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Responses
200成功的application/json
successbooleanoptional
dataobject[]optional

子用户不存在时为空

Show propertiesHide properties
user_idstringrequired
first_namestringrequired
proxy_passwordstringrequired
dataintegerrequired
data_spentintegerrequired
data_remainintegerrequired
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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502提供商错误(子用户可能仍然存在,请重试)application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/sub-user/text?proxy_type=text
GET /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
}

删除子用户

DELhttps://user-api.shardx.com/user/api/proxies/sub-user/{user_id}
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
user_idstringrequired
Responses
200成功的application/json
successbooleanrequired
messagestringrequired
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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502提供商未删除该子用户(仍然存在)。删除已删除的子用户视为成功。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

DEL/user/api/proxies/sub-user/text
DELETE /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
}

编辑子用户(名称/包)

PATCHhttps://user-api.shardx.com/user/api/proxies/sub-user/{user_id}
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
user_idstringrequired
Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Body
application/json
namestringrequired
Responses
200成功的application/json
successbooleanrequired
messagestringrequired
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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

PATCH/user/api/proxies/sub-user/text?proxy_type=text
PATCH /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
}

创建子用户

POSThttps://user-api.shardx.com/user/api/proxies/sub-user

配额是在账户共享流量池之上的虚拟上限:分配配额不会从流量池扣除,只有子用户实际使用代理时才消耗流量。

Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Header parameters
Idempotency-Keystring· max length: 128· pattern: ^[A-Za-z0-9_.:-]+$optional

可选。逻辑操作的唯一标识符(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:操作仍在进行,或该键已用于不同的数据。

不带此标头时,请求照常执行,但没有上述保障。

Body
application/json
namestringrequired
dataintegeroptional

容量(GB,1 GB = 1 073 741 824 字节),最多 100 000

data_bytesinteger · int64optional

容量(字节,精确值;优先于 data),最多 100 000 GB

Responses
200成功的application/json
successbooleanoptional
dataobject[]optional
Show propertiesHide properties
user_idstringrequired
first_namestringrequired
proxy_passwordstringrequired
dataintegerrequired
data_spentintegerrequired
data_remainintegeroptional
400校验错误,或提供商拒绝了请求(rejected: true);未创建任何内容application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

409使用此 Idempotency-Key 的请求仍在执行,或该键已用于不同的数据application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502提供商不可达:结果未知;请使用同一个 Idempotency-Key 重试application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

POST/user/api/proxies/sub-user?proxy_type=text
POST /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
}

给子用户添加流量

POSThttps://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/data/add
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
user_idstringrequired
Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Header parameters
Idempotency-Keystring· max length: 128· pattern: ^[A-Za-z0-9_.:-]+$optional

可选。逻辑操作的唯一标识符(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:操作仍在进行,或该键已用于不同的数据。

不带此标头时,请求照常执行,但没有上述保障。

Body
application/json
dataintegeroptional

容量(GB,1 GB = 1 073 741 824 字节),最多 100 000

data_bytesinteger · int64optional

容量(字节,精确值;优先于 data),最多 100 000 GB

Responses
200成功的application/json
successbooleanrequired
messagestringrequired
orderobject · SubUserOrderState· nullableoptional

操作之后的子用户配额状态(提供商未返回订单对象时为 null)

Show propertiesHide properties
proxy_passwordstringoptional
datainteger · int64optional

已分配的配额(字节)

data_spentinteger · int64optional

已用字节数

data_remaininteger · int64optional

剩余字节数(超额使用时可能为负)

400校验错误,或提供商拒绝了操作(rejected: true);配额未改变application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

409使用此 Idempotency-Key 的请求仍在执行,或该键已用于不同的数据application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502提供商不可达:结果未知;请使用同一个 Idempotency-Key 重试application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

POST/user/api/proxies/sub-user/text/data/add?proxy_type=text
POST /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
}

扣除子用户流量

POSThttps://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/data/subtract
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
user_idstringrequired
Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Header parameters
Idempotency-Keystring· max length: 128· pattern: ^[A-Za-z0-9_.:-]+$optional

可选。逻辑操作的唯一标识符(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:操作仍在进行,或该键已用于不同的数据。

不带此标头时,请求照常执行,但没有上述保障。

Body
application/json
dataintegeroptional

容量(GB,1 GB = 1 073 741 824 字节),最多 100 000

data_bytesinteger · int64optional

容量(字节,精确值;优先于 data),最多 100 000 GB

Responses
200成功的application/json
successbooleanrequired
messagestringrequired
orderobject · SubUserOrderState· nullableoptional

操作之后的子用户配额状态(提供商未返回订单对象时为 null)

Show propertiesHide properties
proxy_passwordstringoptional
datainteger · int64optional

已分配的配额(字节)

data_spentinteger · int64optional

已用字节数

data_remaininteger · int64optional

剩余字节数(超额使用时可能为负)

400校验错误,或提供商拒绝了操作(rejected: true);配额未改变application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

409使用此 Idempotency-Key 的请求仍在执行,或该键已用于不同的数据application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502提供商不可达:结果未知;请使用同一个 Idempotency-Key 重试application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

POST/user/api/proxies/sub-user/text/data/subtract?proxy_type=text
POST /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
}

修改子用户密码

POSThttps://user-api.shardx.com/user/api/proxies/sub-user/{user_id}/password
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Path parameters
user_idstringrequired
Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Responses
200成功的application/json
successbooleanrequired
messagestringrequired
proxy_passwordstring· nullableoptional

新的代理密码

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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

502提供商未更换密码(旧密码仍然有效)application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

POST/user/api/proxies/sub-user/text/password?proxy_type=text
POST /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
}

国家列表

GEThttps://user-api.shardx.com/user/api/proxies/countries
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

Responses
200成功的application/json
countintegerrequired
resultsobject · Country[]required
Show propertiesHide properties
codestring· max length: 10required

ISO国家代码

namestring· max length: 255required

国家名称

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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/countries?proxy_type=text
GET /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
}

地区列表

GEThttps://user-api.shardx.com/user/api/proxies/regions
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

country_codestringrequired

ISO国家代码

Responses
200成功的application/json
countintegerrequired
resultsobject · Region[]required
Show propertiesHide properties
codestring· max length: 10required

地区代码(州/省代码)

namestring· max length: 255required

地区名称(州/省名称)

countryobject · Countryrequired
Show propertiesHide properties
codestring· max length: 10required

ISO国家代码

namestring· max length: 255required

国家名称

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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/regions?proxy_type=text&country_code=text
GET /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
}

城市列表

GEThttps://user-api.shardx.com/user/api/proxies/cities
Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Query parameters
proxy_typestringrequired

代理类型(standart | premium | unlimited)

country_codestringrequired

ISO国家代码

region_codestringrequired

地区代码(州/省)

Responses
200成功的application/json
countintegerrequired
resultsobject · City[]required
Show propertiesHide properties
codestring· max length: 50required

城市代码(通常为 slug 格式)

namestring· max length: 255required

城市名称

countryobject · Countryrequired
Show propertiesHide properties
codestring· max length: 10required

ISO国家代码

namestring· max length: 255required

国家名称

regionobject· nullableoptional
Show propertiesHide properties
codestring· max length: 10required

地区代码

namestring· max length: 255required

地区名称

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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/cities?proxy_type=text&country_code=text&region_code=text
GET /user/api/proxies/cities?proxy_type=text&country_code=text&region_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&region_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&region_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&region_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&region_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&region_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&region_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

GEThttps://user-api.shardx.com/user/api/proxies/isps

城市内可用的互联网提供商;继国家、地区、城市之后的第四个目标级别。与其他位置端点不同,这个端点需要完整的链:country_code、region_code 和 city_code 都是必需的,因为上游 ISP 与城市绑定。仅高级套餐:不为标准套餐和无限制套餐维护 ISP 目录,任何其他 proxy_type 都会被拒绝并返回 400。仅列出主要城市的 ISP,因此对于较小的城市,带有 count: 0 的空 results 是正常答案。

Authorizations
bearerAuth
Authorizationstringrequired

Bearer authentication header of the form Bearer <token>.

Query parameters
proxy_typestring · enumrequired

必须为 premium;ISP 定向仅适用于 premium 套餐。

Possible values:premium
country_codestringrequired

ISO国家代码

region_codestringrequired

地区或州代码

city_codestringrequired

来自 GET /user/api/proxies/cities 的城市代码

Responses
200成功application/json
countintegerrequired
resultsobject · Isp[]required
Show propertiesHide properties
codestringrequired

ISP 代码,通常是一个 slug

namestringrequired

互联网服务提供商名称

countryobject · Countryrequired
Show propertiesHide properties
codestring· max length: 10required

ISO国家代码

namestring· max length: 255required

国家名称

regionobject· nullableoptional
Show propertiesHide properties
codestringrequired

地区代码

namestringrequired

地区名称

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
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
successbooleanrequired
messagestringrequired
rejectedbooleanoptional

子用户操作:提供商拒绝了该操作且未发生任何更改时为 true

idempotency_statestring · enumoptional

仅出现在 Idempotency-Key 校验返回的 409 中

Possible values:in_progressunknown
order_idintegeroptional

仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单

refundedbooleanoptional

仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持

GET/user/api/proxies/isps?proxy_type=premium&country_code=text&region_code=text&city_code=text
GET /user/api/proxies/isps?proxy_type=premium&country_code=text&region_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&region_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&region_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&region_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&region_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&region_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&region_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
}

最后更新

本页内容