stats

URL (API endpoint)

Request URL
https://tmproxy.com/api/proxy/stats

Request body

api_key 是您从 TMProxy 购买的 API 密钥

Example Value
{
  "api_key": "API_KEY"
}
Schema
responseStats{
  code*     integer
  message*  string
            chi tiet loi

  data*     {
            id_isp            integer
                              api_key 的默认 id_isp

            id_location       integer
                              id_location的默认api key

            expired_at        string($date-time)
                              到期日

            plan              string
                              API软件包名称

            price_per_day     integer
                              价格每日API

            timeout           integer
                              代理的生存时间

            base_next_request integer
                              代理的最低使用时间

            api_key           string
                              api key

            note              string
                              API 的备注

            max_ip_per_day    integer
                              "每天允许更改的IP总数"

            ip_used_today     integer
                              当天更改的IP地址数量
            }
}


Server response OK

Response body - code 200
{
  "code": 0,
  "message": "string",
  "data": {
    "id_isp": 0,
    "id_location": 0,
    "expired_at": "2025-01-15T07:35:03.473Z",
    "plan": "string",
    "price_per_day": 0,
    "timeout": 0,
    "base_next_request": 0,
    "api_key": "string",
    "note": "string",
    "max_ip_per_day": 0,
    "ip_used_today": 0
  }
}

Example Code

JavaScript (fetch API)
fetch('https://tmproxy.com/api/proxy/stats', {
    method: 'POST',
    headers: {
      'accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "api_key": "API_KEY" 
    })
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));
Python (requests library)
import requests
url = "https://tmproxy.com/api/proxy/stats"
headers = {
  'accept': 'application/json',
  'Content-Type': 'application/json'
}
data = {
  "api_key": "API_KEY"
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://tmproxy.com/api/proxy/stats"
	data := map[string]string{"api_key": "API_KEY"}
	jsonData, err := json.Marshal(data)
	if err != nil {
		panic(err)
	}

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
	if err != nil {
		panic(err)
	}
	req.Header.Set("accept", "application/json")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	fmt.Println("response Status:", resp.Status)

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}

	fmt.Println("Response Body:", string(body))

	var responseData map[string]interface{}
	if err := json.Unmarshal(body, &responseData); err != nil {
		panic(err)
	}

	fmt.Println("Response Data:", responseData)

	if successMsg, ok := responseData["success_message"]; ok {
		fmt.Println("Success Message:", successMsg)
	}
}
Curl
curl -X POST "https://tmproxy.com/api/proxy/stats" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"api_key\":\"API_KEY\"}"
PHP (cURL)
<?php
$url = "https://tmproxy.com/api/proxy/stats";
$data = array("api_key" => "API_KEY");  
$jsonData = json_encode($data);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'accept: application/json',
  'Content-Type: application/json'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class Main {
    public static void main(String[] args) throws IOException {
        try {
            URL url = new URI("https://tmproxy.com/api/proxy/stats").toURL(); 
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);

            String jsonInputString = "{\"api_key\":\"API_KEY\"}"; 
            try (OutputStream os = con.getOutputStream()) {
                byte[] input = jsonInputString.getBytes("utf-8");
                os.write(input, 0, input.length);
            }

            try (BufferedReader br = new BufferedReader(
                    new InputStreamReader(con.getInputStream(), "utf-8"))) {
                StringBuilder response = new StringBuilder();
                String responseLine = null;
                while ((responseLine = br.readLine()) != null) {
                    response.append(responseLine.trim());
                }
                System.out.println(response.toString());
            }
        } catch (URISyntaxException e) {
            System.err.println("Lỗi khi tạo URL: " + e.getMessage());
        }
    }
}
C#
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

public class Example
{
  public static async Task Main(string[] args)
  {
    using (var client = new HttpClient())
    {
      client.DefaultRequestHeaders.Accept.Clear();
      client.DefaultRequestHeaders.Accept.Add(
          new MediaTypeWithQualityHeaderValue("application/json"));

      var content = new StringContent("{\"api_key\":\"API_KEY\"}", Encoding.UTF8, "application/json");

      var response = await client.PostAsync("https://tmproxy.com/api/proxy/stats", content);
      var responseString = await response.Content.ReadAsStringAsync();

      Console.WriteLine(responseString);
    }
  }
}