Get aggregated credit usage
curl --request GET \
--url https://api.rask.ai/v3/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.rask.ai/v3/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.rask.ai/v3/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.rask.ai/v3/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.rask.ai/v3/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.rask.ai/v3/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rask.ai/v3/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"object": "usage_bucket",
"key": {
"day": null,
"month": null,
"feature": "dub",
"project_id": null,
"project_name": null,
"project_deleted": null,
"credential_id": null,
"credential_name": null,
"member_user_id": null,
"member_email": null
},
"credit_type": "minutes",
"charged_minutes": 42,
"refunded_minutes": 2,
"net_minutes": 40,
"operations": 17
},
{
"object": "usage_bucket",
"key": {
"day": null,
"month": null,
"feature": "lipsync_enhanced",
"project_id": null,
"project_name": null,
"project_deleted": null,
"credential_id": null,
"credential_name": null,
"member_user_id": null,
"member_email": null
},
"credit_type": "minutes",
"charged_minutes": 9,
"refunded_minutes": 0,
"net_minutes": 9,
"operations": 3
},
{
"object": "usage_bucket",
"key": {
"day": null,
"month": null,
"feature": "project_creation",
"project_id": null,
"project_name": null,
"project_deleted": null,
"credential_id": null,
"credential_name": null,
"member_user_id": null,
"member_email": null
},
"credit_type": "projects",
"charged_projects": 0,
"refunded_projects": 0,
"net_projects": 0,
"operations": 12
}
],
"next_cursor": null,
"has_more": false
}Usage
Get aggregated credit usage
Aggregates the workspace’s charges and refunds into buckets grouped by up to two dimensions (day, month, feature, project, token, member).
GET
/
usage
Get aggregated credit usage
curl --request GET \
--url https://api.rask.ai/v3/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.rask.ai/v3/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.rask.ai/v3/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.rask.ai/v3/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.rask.ai/v3/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.rask.ai/v3/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rask.ai/v3/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"object": "usage_bucket",
"key": {
"day": null,
"month": null,
"feature": "dub",
"project_id": null,
"project_name": null,
"project_deleted": null,
"credential_id": null,
"credential_name": null,
"member_user_id": null,
"member_email": null
},
"credit_type": "minutes",
"charged_minutes": 42,
"refunded_minutes": 2,
"net_minutes": 40,
"operations": 17
},
{
"object": "usage_bucket",
"key": {
"day": null,
"month": null,
"feature": "lipsync_enhanced",
"project_id": null,
"project_name": null,
"project_deleted": null,
"credential_id": null,
"credential_name": null,
"member_user_id": null,
"member_email": null
},
"credit_type": "minutes",
"charged_minutes": 9,
"refunded_minutes": 0,
"net_minutes": 9,
"operations": 3
},
{
"object": "usage_bucket",
"key": {
"day": null,
"month": null,
"feature": "project_creation",
"project_id": null,
"project_name": null,
"project_deleted": null,
"credential_id": null,
"credential_name": null,
"member_user_id": null,
"member_email": null
},
"credit_type": "projects",
"charged_projects": 0,
"refunded_projects": 0,
"net_projects": 0,
"operations": 12
}
],
"next_cursor": null,
"has_more": false
}Refunds count in the bucket of the charge they reverse. Without
group_by there is one bucket per credit type. Deleted projects are included and named. Usage across the payer’s other workspaces is only in the web app.
When to use: to answer what a key, project or member spent over a period (period=previous for the last billing period). Key, member and channel come from v3 jobs; charges without one (web, API v2) report channel unknown and no key or member.
Side effects: None.
Cost: Free.
Idempotency: safe and pure (never writes); retry freely.
Pagination: limit (default 20, max 100) and cursor; follow next_cursor until has_more is false.
Required scopes: account:read
Errors: invalid_date_range (422)Authorizations
Query Parameters
Up to two dimensions, comma-separated (e.g. day,feature).
Maximum array length:
2A usage grouping dimension.
day: UTC daymonth: UTC calendar monthfeature: usage featureproject: projecttoken: credential (API key or OAuth grant)member: acting workspace member
Available options:
day, month, feature, project, token, member A billing period instead of from/to; explicit from or to replace it.
A billing-period shortcut for from and to (explicit from or to replace it).
current: the payer's current billing period (without a subscription: the last 30 days)previous: the billing period before it (without a subscription: the 30 days before those)
Available options:
current, previous Only this feature. Usage vocabulary for charges, cost lines and usage reports.
project_creation: creating a project (project credit)project_copy: copying a project (project credit)dub: a full dubredub: a dub of changed segmentssegment_generation: paid voicing of chosen segmentslipsync_legacy: a Legacy lip-sync runlipsync_enhanced: an Enhanced lip-sync runlipsync_free: the free lip-sync runonscreen: on-screen text translationother: anything else (manual adjustments by Rask, other products)lipsync_unknown_model: a lip-sync run not started through v3 (its model is not recorded)
A charge without a v3 job reports the feature of what it paid for: project_creation, project_copy, dub, redub, onscreen, lipsync_unknown_model or lipsync_free (by pool), else other. Refunds follow their charge.
Available options:
project_creation, project_copy, dub, redub, segment_generation, lipsync_legacy, lipsync_enhanced, lipsync_free, onscreen, other, lipsync_unknown_model Response
OK: UsageBucketList.
A page of UsageBucket (the list envelope shared by every list).