General
General operations (profile, orders, reference data)
Create and pay for an order
https://user-api.shardx.com/user/api/orders/purchasePurchase by product name, location, and cycle. For Datacenter/ISP, location is required. For Standart Residential Proxy, location is not required.
Send an Idempotency-Key header to make retries safe: without it, a retry after a timeout may charge the wallet and issue proxies twice.
Bearer authentication header of the form Bearer <token>.
Optional. A unique identifier of the logical operation (1-128 characters of [A-Za-z0-9_.:-]), for example a UUID.
Send the SAME key when retrying a request whose outcome you do not know (timeout, dropped connection): a request that already completed is NOT executed again, its original response is returned.
Accepted on EVERY mutating endpoint (POST/PUT/PATCH/DELETE) of this API: purchase, renewal, bandwidth top-up, add-ons and any endpoint added later; it is listed explicitly on the money-moving ones.
All endpoints except sub-user operations: the stored response is replayed with the `Idempotency-Replayed: true` header for 7 days. `409`: a request with this key is still running (`idempotency_state: in_progress`) or never completed and its outcome must be verified manually (`idempotency_state: unknown`; it is never re-executed). `422`: the key was already used with a different request. A `429` from the rate limiter does not consume the key, so retry with the same one.
Sub-user endpoints (create, data/add, data/subtract): the key is forwarded to the proxy provider, and a retry within 24 hours cannot change the quota twice. 409: the operation is still in progress or the key was used with a different payload.
Without the header, requests run as usual, without these guarantees.
200Successapplication/json
400Validation/balance error/insufficient stockapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
401Unauthorizedapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
403This billing cycle is not available for your accountapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
409A request with this Idempotency-Key is still running (idempotency_state: in_progress), or it never completed and its outcome must be checked manually (idempotency_state: unknown)application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
422The Idempotency-Key was already used with a different requestapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
429More than one request per 3 seconds from the account. The body is plain text (Too many requests, retry in <N>s), and the x-ratelimit-after header has the wait in seconds. The Idempotency-Key is not consumed: retry with the same one.text/plain
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
502Stock check failed, or the proxies could not be issued after payment; then order_id and refunded tell whether the payment was returnedapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders/purchasePOST /user/api/orders/purchase HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Idempotency-Key: text
Content-Type: application/json
Accept: */*
{
"product": "Datacenter Proxy",
"location": "text",
"cycle": "text",
"quantity": 1,
"promo_code": "text",
"auto_renewal": false,
"addons": [
{
"addon_key": "p0f_slots",
"qty": 1
}
]
}curl -X POST 'https://user-api.shardx.com/user/api/orders/purchase' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Idempotency-Key: text' \
-H 'Content-Type: application/json' \
-d '{"product":"Datacenter Proxy","location":"text","cycle":"text","quantity":1,"promo_code":"text","auto_renewal":false,"addons":[{"addon_key":"p0f_slots","qty":1}]}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/purchase"
headers = {
"Authorization": f"Bearer {token}",
"Idempotency-Key": "text",
}
payload = {
"product": "Datacenter Proxy",
"location": "text",
"cycle": "text",
"quantity": 1,
"promo_code": "text",
"auto_renewal": False,
"addons": [
{
"addon_key": "p0f_slots",
"qty": 1,
},
],
}
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/purchase";
const payload = {
"product": "Datacenter Proxy",
"location": "text",
"cycle": "text",
"quantity": 1,
"promo_code": "text",
"auto_renewal": false,
"addons": [
{
"addon_key": "p0f_slots",
"qty": 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/orders/purchase"
body := bytes.NewBufferString(`{
"product": "Datacenter Proxy",
"location": "text",
"cycle": "text",
"quantity": 1,
"promo_code": "text",
"auto_renewal": false,
"addons": [
{
"addon_key": "p0f_slots",
"qty": 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/orders/purchase")
.header("Authorization", format!("Bearer {token}"))
.header("Idempotency-Key", "text")
.json(&serde_json::json!({
"product": "Datacenter Proxy",
"location": "text",
"cycle": "text",
"quantity": 1,
"promo_code": "text",
"auto_renewal": false,
"addons": [
{
"addon_key": "p0f_slots",
"qty": 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/orders/purchase");
request.Headers.Add("Idempotency-Key", "text");
request.Content = new StringContent("""
{
"product": "Datacenter Proxy",
"location": "text",
"cycle": "text",
"quantity": 1,
"promo_code": "text",
"auto_renewal": false,
"addons": [
{
"addon_key": "p0f_slots",
"qty": 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({
"product": "Datacenter Proxy",
"location": "text",
"cycle": "text",
"quantity": 1,
"promo_code": "text",
"auto_renewal": false,
"addons": [
{
"addon_key": "p0f_slots",
"qty": 1
}
]
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/purchase");
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": "text",
"order_id": 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
}"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
}Calculate order cost
https://user-api.shardx.com/user/api/orders/calculateCalculates price by product name, cycle name and quantity. Uses the same validation rules as purchase (allowed billing cycles, promo rules).
Bearer authentication header of the form Bearer <token>.
URL-encoded JSON array of add-ons, e.g. [{"addon_key":"p0f_slots","qty":5}]
200Successapplication/json
Add-ons total, minor units
final_price + addons_price
400Validation errorapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
401Unauthorizedapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
403This billing cycle is not available for your accountapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders/calculate?product=textGET /user/api/orders/calculate?product=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/orders/calculate?product=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/orders/calculate"
params = {
"product": "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/orders/calculate?product=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/orders/calculate?product=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/orders/calculate?product=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/orders/calculate?product=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/orders/calculate?product=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;
}{
"original_price": 1,
"final_price": 1,
"discount_percent": 1,
"addons_price": 1,
"total_with_addons": 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
}Change the order billing cycle
https://user-api.shardx.com/user/api/orders/change-billing-cycle/{order_id}Changes the billing cycle by cycle name. Only for Datacenter & ISP proxies. If the promo code is not available for the selected cycle, it will be automatically reset.
Bearer authentication header of the form Bearer <token>.
200Successapplication/json
400Invalid product or cycleapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
401Unauthorizedapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
403Cycle is not available for this userapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders/change-billing-cycle/1POST /user/api/orders/change-billing-cycle/1 HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"cycle": "text"
}curl -X POST 'https://user-api.shardx.com/user/api/orders/change-billing-cycle/1' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"cycle":"text"}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/change-billing-cycle/1"
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"cycle": "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/change-billing-cycle/1";
const payload = {
"cycle": "text"
};
const response = await fetch(url, {
method: "POST",
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/orders/change-billing-cycle/1"
body := bytes.NewBufferString(`{
"cycle": "text"
}`)
req, err := http.NewRequest("POST", 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
.post("https://user-api.shardx.com/user/api/orders/change-billing-cycle/1")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"cycle": "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/change-billing-cycle/1");
request.Content = new StringContent("""
{
"cycle": "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({
"cycle": "text"
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/change-billing-cycle/1");
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": "text",
"order_id": 1,
"original_price": 1,
"final_price": 1,
"discount_percent": 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
}Change order auto-renewal
https://user-api.shardx.com/user/api/orders/edit-auto-renewal/{order_id}Enable/disable auto-renewal. Only for Datacenter & ISP proxies.
Bearer authentication header of the form Bearer <token>.
200Successapplication/json
400Invalid product for this operationapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
401Unauthorizedapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders/edit-auto-renewal/1?auto_renewal=truePOST /user/api/orders/edit-auto-renewal/1?auto_renewal=true HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X POST 'https://user-api.shardx.com/user/api/orders/edit-auto-renewal/1?auto_renewal=true' \
-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/orders/edit-auto-renewal/1"
params = {
"auto_renewal": "true",
}
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/orders/edit-auto-renewal/1?auto_renewal=true";
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/orders/edit-auto-renewal/1?auto_renewal=true"
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/orders/edit-auto-renewal/1?auto_renewal=true")
.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/orders/edit-auto-renewal/1?auto_renewal=true");
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/orders/edit-auto-renewal/1?auto_renewal=true");
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": "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
}Get products and their cycles
https://user-api.shardx.com/user/api/proxies/productsReturns API products with the names of available cycles.
Bearer authentication header of the form Bearer <token>.
200Product listapplication/json
productsobject · ProductWithCycles[]requiredShow propertiesHide properties
401Missing or invalid API key: Missing or invalid Authorization header, Invalid API key, API key mismatchapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/proxies/productsGET /user/api/proxies/products 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/products' \
-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/products"
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(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/products";
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/products"
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/products")
.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/products");
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/products");
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,
"products": [
{
"name": "text",
"description": "text",
"location": "text",
"cycles": [
"text"
]
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}Get available proxy count
https://user-api.shardx.com/user/api/proxies/available-countReturns the total available quantity for all products.
Bearer authentication header of the form Bearer <token>.
200Successapplication/json
401Missing or invalid API key: Missing or invalid Authorization header, Invalid API key, API key mismatchapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
502The proxy provider failed or answered with an error (Upstream error: <status>)application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/proxies/available-countGET /user/api/proxies/available-count 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/available-count' \
-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/available-count"
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(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/available-count";
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/available-count"
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/available-count")
.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/available-count");
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/available-count");
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;
}[
{
"country": "text",
"product": "text",
"amount": 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
}User information
https://user-api.shardx.com/user/api/meBearer authentication header of the form Bearer <token>.
200Profile dataapplication/json
in cents
401Missing or invalid API key: Missing or invalid Authorization header, Invalid API key, API key mismatchapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/meGET /user/api/me HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/me' \
-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/me"
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(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/me";
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/me"
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/me")
.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/me");
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/me");
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;
}{
"email": "text",
"active_orders": 1,
"wallet_balance": 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
}Order list
https://user-api.shardx.com/user/api/ordersBearer authentication header of the form Bearer <token>.
active | on-hold | cancelled | all
Result offset (default 0)
Page size (1..100, default 20)
200Order listapplication/json
ordersobject[]requiredShow propertiesHide properties
ISO8601 expiration time
Number of orders in the current result set
Previous page URI
Next page URI
401Missing or invalid API key: Missing or invalid Authorization header, Invalid API key, API key mismatchapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders?status=textGET /user/api/orders?status=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/orders?status=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/orders"
params = {
"status": "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/orders?status=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/orders?status=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/orders?status=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/orders?status=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/orders?status=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,
"orders": [
{
"order_id": 1,
"product_id": 1,
"product_name": "text",
"cycle_id": 1,
"cycle_name": "text",
"expires_at": "text",
"auto_renewal": true,
"tag": "text"
}
],
"count": 1,
"prev": "text",
"next": "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
}Get order information
https://user-api.shardx.com/user/api/orders/{id}Bearer authentication header of the form Bearer <token>.
200Order informationapplication/json
orderobjectrequiredShow propertiesHide properties
Base subscription price in cents
Total add-on cost in cents
addonsobject · AddonLine[]optionalAdd-on lines attached to this order
Show propertiesHide properties
Add-on lines attached to this order
Units active in the current period
Unit price in cents at purchase time
pendingobject· nullableoptionalChange scheduled for the next renewal, or null
Show propertiesHide properties
Change scheduled for the next renewal, or null
canceldowngradeTarget quantity after downgrade
Active p0f signature slots (from add-ons)
Slots currently occupied by signed proxies
Slots that will be active after the next renewal (capped by renewal_quantity)
Proxies in the next period (less than quantity if some are marked with del-np)
What the next renewal will charge, in cents (renewal_base_price + renewal_addons_price)
Proxies part of the next renewal, in cents (proportional share of price_paid)
Add-ons part of the next renewal, in cents (pending changes applied)
401Missing or invalid API key: Missing or invalid Authorization header, Invalid API key, API key mismatchapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders/1GET /user/api/orders/1 HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/orders/1' \
-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/orders/1"
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(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/orders/1";
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/orders/1"
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/orders/1")
.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/orders/1");
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/orders/1");
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,
"order": {
"order_id": 1,
"product_name": "text",
"cycle_name": "text",
"quantity": 1,
"price_paid": 1,
"addons_price_paid": 1,
"addons": [
{
"addon_key": "text",
"catalog_id": 1,
"qty": 1,
"price_per_unit": 1,
"pending": {
"action": "cancel",
"next_qty": 1
}
}
],
"p0f_slots_available": 1,
"p0f_slots_used": 1,
"p0f_slots_next": 1,
"renewal_quantity": 1,
"renewal_price": 1,
"renewal_base_price": 1,
"renewal_addons_price": 1,
"status": "text",
"created_at": "text",
"expires_at": "text",
"promo_code": "text",
"auto_renewal": true,
"tag": "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
}Renew order
https://user-api.shardx.com/user/api/orders/{id}/renewRenewal is available only when order status is on-hold.
A repeated request for an order that is already renewed answers 200 with Order already renewed.
Send an Idempotency-Key header to make retries safe (the wallet is charged).
Bearer authentication header of the form Bearer <token>.
Optional. A unique identifier of the logical operation (1-128 characters of [A-Za-z0-9_.:-]), for example a UUID.
Send the SAME key when retrying a request whose outcome you do not know (timeout, dropped connection): a request that already completed is NOT executed again, its original response is returned.
Accepted on EVERY mutating endpoint (POST/PUT/PATCH/DELETE) of this API: purchase, renewal, bandwidth top-up, add-ons and any endpoint added later; it is listed explicitly on the money-moving ones.
All endpoints except sub-user operations: the stored response is replayed with the `Idempotency-Replayed: true` header for 7 days. `409`: a request with this key is still running (`idempotency_state: in_progress`) or never completed and its outcome must be verified manually (`idempotency_state: unknown`; it is never re-executed). `422`: the key was already used with a different request. A `429` from the rate limiter does not consume the key, so retry with the same one.
Sub-user endpoints (create, data/add, data/subtract): the key is forwarded to the proxy provider, and a retry within 24 hours cannot change the quota twice. 409: the operation is still in progress or the key was used with a different payload.
Without the header, requests run as usual, without these guarantees.
200Successapplication/json
400Insufficient balance/validationapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
401Missing or invalid API key: Missing or invalid Authorization header, Invalid API key, API key mismatchapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
409The order is already paid for the current period, it changed while renewing (retry), or a request with this Idempotency-Key is in progressapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
422The Idempotency-Key was already used with a different requestapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders/1/renewPOST /user/api/orders/1/renew HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Idempotency-Key: text
Accept: */*curl -X POST 'https://user-api.shardx.com/user/api/orders/1/renew' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Idempotency-Key: text'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/renew"
headers = {
"Authorization": f"Bearer {token}",
"Idempotency-Key": "text",
}
response = requests.post(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/orders/1/renew";
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Idempotency-Key": "text",
},
});
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/orders/1/renew"
req, err := http.NewRequest("POST", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "text")
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/orders/1/renew")
.header("Authorization", format!("Bearer {token}"))
.header("Idempotency-Key", "text")
.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/orders/1/renew");
request.Headers.Add("Idempotency-Key", "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());
headers = curl_slist_append(headers, "Idempotency-Key: text");
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/renew");
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": "Order renewed 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
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}Change order tag
https://user-api.shardx.com/user/api/orders/{id}/tagBearer authentication header of the form Bearer <token>.
200Successapplication/json
401Missing or invalid API key: Missing or invalid Authorization header, Invalid API key, API key mismatchapplication/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
500Internal error. The API also answers 500 when the order (or another record it needs) is not found or does not belong to your account; message names it, for example Order not found.application/json
Sub-user operations: true when the provider rejected the operation and nothing changed
Only in a 409 from the Idempotency-Key check
in_progressunknownOnly in a 502 from purchase and add-bandwidth: the order that was paid for
Only in a 502 from purchase and add-bandwidth: true means the payment was returned to the wallet, false means the refund is pending, contact support
/user/api/orders/1/tagPOST /user/api/orders/1/tag HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"tag": "text"
}curl -X POST 'https://user-api.shardx.com/user/api/orders/1/tag' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"tag":"text"}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/tag"
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"tag": "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/tag";
const payload = {
"tag": "text"
};
const response = await fetch(url, {
method: "POST",
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/orders/1/tag"
body := bytes.NewBufferString(`{
"tag": "text"
}`)
req, err := http.NewRequest("POST", 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
.post("https://user-api.shardx.com/user/api/orders/1/tag")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"tag": "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/tag");
request.Content = new StringContent("""
{
"tag": "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({
"tag": "text"
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/tag");
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 tag updated"
}{
"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
}Last updated on