Get Daily Spend
curl --request GET \
--url https://api.example.com/api/analytics/spend/dailyimport requests
url = "https://api.example.com/api/analytics/spend/daily"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/analytics/spend/daily', 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.example.com/api/analytics/spend/daily",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/analytics/spend/daily"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/analytics/spend/daily")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/analytics/spend/daily")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"period": {},
"granularity": "<string>",
"daily": [
{
"date": "<string>",
"credits_used": 123,
"credits_added": 123
}
]
}
}Analytics
Get Daily Spend
Track credit usage and additions over time.
GET
/
api
/
analytics
/
spend
/
daily
Get Daily Spend
curl --request GET \
--url https://api.example.com/api/analytics/spend/dailyimport requests
url = "https://api.example.com/api/analytics/spend/daily"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/analytics/spend/daily', 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.example.com/api/analytics/spend/daily",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/analytics/spend/daily"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/analytics/spend/daily")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/analytics/spend/daily")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"period": {},
"granularity": "<string>",
"daily": [
{
"date": "<string>",
"credits_used": 123,
"credits_added": 123
}
]
}
}Provides a time-series array of your credit transactions. You can use this to chart daily costs against account top-ups.
Query Parameters
string
Start date in
YYYY-MM-DD format. Defaults to 30 days ago.string
End date in
YYYY-MM-DD format. Defaults to today.string
Start exact time in ISO 8601 format (e.g.
2024-03-01T14:30:00Z). Changes the granularity of the time-series points to minute.string
End exact time in ISO 8601 format.
Response
boolean
Indicates whether the request was successful.
object
Show properties
Show properties
object
The start and end boundaries of the query.
string
The time grouping used for the data points. Either
day or minute.⌘I