概述

TooServer 允许通过 API 集成到你程序中,进行查询产品、订单、服务器信息、余额与流水,以及产品下单与续费。

基础地址: https://my.tooserver.net/v1

频率限流:查询类接口 60 次/分钟,下单/续费接口 10 次/分钟。

每日额度:默认每天 20 笔新购订单(续费不计入)。如需提升请联系客服。

创建条件:邮箱已激活 且 有过一次消费记录。 前往申请 API

下单与续费: 仅支持余额扣款 请提前在网站充值。

注意:令牌拥有查询、下单、续费的完整权限,凡涉及下单、续费的接口都会从账户余额扣款。

格式与代码说明

请求头(每个请求需携带令牌)
Header
AuthorizationBearer ts_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Typeapplication/json(POST 请求需要)
响应结构(所有接口返回均为 JSON,UTF-8)
{
  "code": 0,
  "message": "ok",
  "data": { ... }
}
字段类型说明
codeint0 表示成功,非 0 表示错误
messagestring结果描述
dataobject/null返回数据,错误时可能为 null
错误码(HTTP 状态码与 code 对应)
codeHTTP说明
0200成功
4000400参数错误
4001400金额/价格异常
4002400余额不足(订单已创建待付款)
4011–4015401令牌缺失/无效/已吊销/已过期/账户异常
4031403无操作权限
4041404资源不存在
4092409库存不足
4290429请求过于频繁
4291429已达每日下单上限
5001500服务器错误
限流 / 额度超限返回示例
{
  "code": 4291,
  "message": "已达到每日下单上限,如需提升请联系客服",
  "data": { "daily_limit": 20, "today_count": 20 }
}

接口

GET/v1/regions
说明获取地区列表
返回示例
{
  "code": 0,
  "message": "ok",
  "data": {
    "regions": [
      { "id": 19, "name": "香港", "sort": 1 },
      { "id": 20, "name": "美国", "sort": 2 }
    ]
  }
}
GET/v1/products
说明获取产品列表;代理账户返回中额外包含 agent_price
参数类型说明(均可选)
regionint地区 ID
catint线路/分类 ID
typestring产品类型
filterstring标签过滤
示例GET /v1/products?region=19&cat=61
返回示例
{
  "code": 0,
  "message": "ok",
  "data": {
    "products": [
      {
        "pricing_id": 2681,
        "name": "香港 CN2 独立服务器",
        "region_id": 19,
        "region_name": "香港",
        "sale_price": 320.00,
        "agent_price": 288.00,
        "stock": 5
      }
    ]
  }
}
POST/v1/orders 会扣余额
说明创建订单并用余额支付,价格由服务端计算
参数类型说明
pricing_idint定价 ID(必填)
billing_cyclestring周期,必填:month / quarter / half_year / year / two_year
user_remarkstring备注(可选)
计价普通用户按 sale_price 打折;代理按 agent_price 不打折
返回示例
{
  "code": 0,
  "message": "下单成功",
  "data": {
    "order_no": "SO20260705093012345",
    "region_name": "香港",
    "billing_cycle": "month",
    "months": 1,
    "unit_price": 320.00,
    "final_amount": 320.00,
    "paid_amount": 320.00,
    "balance_after": 7880.00,
    "status": "paid"
  }
}
余额不足返回 4002,订单以待付款保留,可在网站充值后支付:
{
  "code": 4002,
  "message": "余额不足",
  "data": {
    "order_no": "SO20260705093012345",
    "final_amount": 320.00,
    "balance": 100.00,
    "status": "pending"
  }
}
GET/v1/orders
说明获取订单列表
参数类型说明(均可选)
statusstringpending / paid / processing / active / cancelled / refunded / upgraded
pageint页码,默认 1
limitint每页数量,默认 20,最大 100
返回示例
{
  "code": 0,
  "message": "ok",
  "data": {
    "orders": [
      {
        "order_no": "SO20260705093012345",
        "status": "paid",
        "final_amount": 320.00,
        "created_at": "2026-07-05 09:30:12"
      }
    ],
    "total": 1,
    "page": 1,
    "limit": 20,
    "total_page": 1
  }
}
GET/v1/orders/{order_no}
说明获取订单详情,仅可查询本人订单
返回订单完整字段;不存在或非本人返回 4041
GET/v1/servers
说明获取服务器列表,按到期时间升序(临期靠前)
参数类型说明(均可选)
statusint1 正常 / 0 到期
pageint页码
limitint每页数量
GET/v1/servers/{id}
说明获取服务器详情
返回示例
{
  "code": 0,
  "message": "ok",
  "data": {
    "id": 156,
    "server_ip": "1.2.3.4",
    "cpu": "E5-2680v4 *2",
    "memory": "64G",
    "disk": "1TB SSD",
    "bandwidth": "100Mbps",
    "datacenter": "香港",
    "default_price": 320.00,
    "status": 1,
    "end_time": "2026-08-05 00:00:00",
    "days_left": 31
  }
}
安全不返回登录密码、IPMI 等任何登录凭证,凭证只能在网站内查看
POST/v1/servers/{id}/renew 会扣余额
说明服务器续费,按挂牌价计算,代理不享受周期折扣,成功后自动延长到期时间
参数类型说明
billing_cyclestring周期(必填)
返回示例
{
  "code": 0,
  "message": "续费成功",
  "data": {
    "order_no": "SO20260705094500678",
    "final_amount": 3456.00,
    "balance_after": 4424.00,
    "old_end_time": "2026-08-05 00:00:00",
    "new_end_time": "2027-08-05 00:00:00",
    "status": "paid"
  }
}
GET/v1/account/balance
说明查询当前余额
返回示例
{
  "code": 0,
  "message": "ok",
  "data": { "balance": 8200.00, "currency": "CNY" }
}
GET/v1/account/balance/logs
说明查询余额变动记录
参数类型说明(均可选)
typestringincome / expense
pageint页码
limitint每页数量
返回每条含金额、类型、来源、变动前后余额、备注、时间

使用流程

典型自动化流程:

1. 网站内充值 → 2. GET /v1/products 查产品 → 3. POST /v1/orders 下单扣款 → 4. GET /v1/orders 查订单状态 → 5. 开通后 GET /v1/servers 查服务器 → 6. 临期时 POST /v1/servers/{id}/renew 续费。

调用示例(以下单为例)

curl -X POST "https://my.tooserver.net/v1/orders" \
  -H "Authorization: Bearer 你的令牌" \
  -H "Content-Type: application/json" \
  -d '{"pricing_id": 2681, "billing_cycle": "month"}'
<?php
$ch = curl_init("https://my.tooserver.net/v1/orders");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        "Authorization: Bearer 你的令牌",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "pricing_id"    => 2681,
        "billing_cycle" => "month",
    ]),
]);
$resp = curl_exec($ch);
curl_close($ch);

$data = json_decode($resp, true);
if ($data["code"] === 0) {
    echo "下单成功:" . $data["data"]["order_no"];
} else {
    echo "失败:" . $data["message"];
}
import requests

resp = requests.post(
    "https://my.tooserver.net/v1/orders",
    headers={
        "Authorization": "Bearer 你的令牌",
        "Content-Type": "application/json",
    },
    json={"pricing_id": 2681, "billing_cycle": "month"},
)

data = resp.json()
if data["code"] == 0:
    print("下单成功:", data["data"]["order_no"])
else:
    print("失败:", data["message"])
const res = await fetch("https://my.tooserver.net/v1/orders", {
  method: "POST",
  headers: {
    "Authorization": "Bearer 你的令牌",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ pricing_id: 2681, billing_cycle: "month" }),
});

const data = await res.json();
if (data.code === 0) {
  console.log("下单成功:", data.data.order_no);
} else {
  console.log("失败:", data.message);
}

续费只需把 URL 换成 /v1/servers/{id}/renew,请求体改为 {"billing_cycle": "year"} 即可,其余写法一致。