UNLOCK API
getSpendingStats

getSpendingStats

按小时返回某个 UTC 日的消费:任务数和花费金额。失败和已退款的任务不计入。
POSThttps://unlock-api.com/getSpendingStats
date 是所需日期内的任意 Unix 时间。不传则使用今天(UTC)。

请求参数

clientKey
String必填
你的 API 密钥,32 个字符,在账户页面上。
date
Integer可选
要统计的那一天内的 Unix 时间。默认:UTC 今天。

请求

POST /getSpendingStats
{
  "clientKey": "YOUR_API_KEY",
  "date": 1791590400
}

响应

成功
{
  "errorId": 0,
  "data": [
    {
      "dateFrom": 1791590400,
      "dateTill": 1791593999,
      "volume": 120,
      "money": 0.066
    },
    {
      "dateFrom": 1791594000,
      "dateTill": 1791597599,
      "volume": 0,
      "money": 0
    }
  ]
}

响应字段

errorId
Integer
请求成功为 0,失败为 1。
data
Array
24 行,每小时一行:dateFrom、dateTill、volume(任务数)和 money(美元)。

代码示例

curl -s https://unlock-api.com/getSpendingStats \
  -H "Content-Type: application/json" \
  -d '{"clientKey":"YOUR_API_KEY","date":1791590400}'

此方法可能返回的错误