UNLOCK API
getSpendingStats

getSpendingStats

Returns your spending for one UTC day, hour by hour: number of tasks and money spent. Failed and refunded tasks are not counted.
POSThttps://unlock-api.com/getSpendingStats
date is any Unix time inside the day you want. Without it, today (UTC) is used.

Request parameters

clientKey
StringRequired
Your API key, 32 characters, from the account page.
date
IntegerOptional
Unix time inside the day to report. Default: today in UTC.

Request

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

Response

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

Response fields

errorId
Integer
0 when the request worked, 1 when it did not.
data
Array
24 rows, one per hour: dateFrom, dateTill, volume (tasks) and money (US dollars).

Code samples

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

Errors this method can return

  • The key is wrong. Copy it again from the account page. (in.php and res.php: ERROR_WRONG_USER_KEY)