Usage
List API credit charges and refunds by task ID or posting time
GET /api/v2/usage
Use a live API key in Authorization: Bearer <api_key>. You can view recorded API usage for your account after rotating keys.
The endpoint reads posted charges and refunds. A task can have multiple transactions, and a completed task can still be awaiting settlement. Usage includes ledger entries that can be reliably linked to a public API task. Where older entries cannot be linked, coverage begins when the endpoint rolls out.
Query parameters
| Parameter | Description |
|---|---|
task_id | Optional. Use the task ID returned by the API when you submitted the task. |
from and to | Optional pair of Unix-second timestamps. Filter by posting time in [from, to), including from and excluding to. Provide both with from < to. Without a task ID or a date range, the endpoint defaults to the last 30 days. A task ID by itself searches all available history for that task. |
limit | Optional page size. Defaults to 50, with a maximum of 100. |
cursor | Optional. Pass the previous response's next_cursor with the same filters. Treat the cursor as an opaque string. |
Query by task ID
curl -G 'https://api.aiclonevoicefree.com/api/v2/usage' \
-H 'Authorization: Bearer sk_your_api_key' \
--data-urlencode 'task_id=b28f0341-3045-42e5-ad63-a5ccf4a1088e'Query by time range
curl -G 'https://api.aiclonevoicefree.com/api/v2/usage' \
-H 'Authorization: Bearer sk_your_api_key' \
--data-urlencode 'from=1780704000' \
--data-urlencode 'to=1780790400' \
--data-urlencode 'limit=50'Response
items contains the transactions, newest first. next_cursor is null on the last page. A query without matching transactions returns an empty items array.
{
"items": [
{
"task_id": "b28f0341-3045-42e5-ad63-a5ccf4a1088e",
"transaction_no": "7b976d51-0918-41ba-8561-04382fb94a78",
"type": "charge",
"credit_type": "voice",
"credits": 120,
"created_at": 1780704355
}
],
"next_cursor": null
}| Field | Meaning |
|---|---|
task_id | Public API task ID. |
transaction_no | Original ledger transaction number. |
type | charge or refund. |
credit_type | Credit balance used, either voice or creation. |
credits | Positive number of credits posted in this transaction. |
created_at | Transaction posting time in Unix seconds. |
For example, if a charge of 120 credits is fully refunded, the ledger shows two transactions with 120 credits each. The task's settled net usage is then 0. Posted transactions remain visible after the credits expire.
Errors
| HTTP | Meaning |
|---|---|
400 | Invalid parameter, date range, or cursor. |
401 | Missing or invalid API key. |
403 usage_unavailable | A live key linked to a billing account is required. |
404 | The requested task does not exist in the caller's API usage scope. |