Get Credit Aggregation
curl --request POST \
--url https://api.explorium.ai/v1/credits/aggregation \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"from_date": "<string>",
"to_date": "<string>",
"request_context": null,
"timezone": "<string>",
"key_name": "<string>"
}
'import requests
url = "https://api.explorium.ai/v1/credits/aggregation"
payload = {
"from_date": "<string>",
"to_date": "<string>",
"request_context": None,
"timezone": "<string>",
"key_name": "<string>"
}
headers = {
"api_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from_date: '<string>',
to_date: '<string>',
request_context: null,
timezone: '<string>',
key_name: '<string>'
})
};
fetch('https://api.explorium.ai/v1/credits/aggregation', 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.explorium.ai/v1/credits/aggregation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from_date' => '<string>',
'to_date' => '<string>',
'request_context' => null,
'timezone' => '<string>',
'key_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.explorium.ai/v1/credits/aggregation"
payload := strings.NewReader("{\n \"from_date\": \"<string>\",\n \"to_date\": \"<string>\",\n \"request_context\": null,\n \"timezone\": \"<string>\",\n \"key_name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.explorium.ai/v1/credits/aggregation")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from_date\": \"<string>\",\n \"to_date\": \"<string>\",\n \"request_context\": null,\n \"timezone\": \"<string>\",\n \"key_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.explorium.ai/v1/credits/aggregation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_date\": \"<string>\",\n \"to_date\": \"<string>\",\n \"request_context\": null,\n \"timezone\": \"<string>\",\n \"key_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"response_context": {
"correlation_id": "5618d686ecb849fda660c3023acf3120",
"request_status": "success",
"time_took_in_seconds": 0.245
},
"from_date": "2025-08-23T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "hour",
"timezone": "UTC",
"total_credits": 1245,
"aggregations": [
{
"timestamp": "2025-08-23T00:00:00Z",
"hour": "00:00",
"date": "2025-08-23",
"credits": 45
},
{
"timestamp": "2025-08-23T01:00:00Z",
"hour": "01:00",
"date": "2025-08-23",
"credits": 52
},
{
"timestamp": "2025-08-23T13:00:00Z",
"hour": "13:00",
"date": "2025-08-23",
"credits": 89
}
]
}
{
"response_context": {
"correlation_id": "a7b8c9d0e1f2g3h4i5j6k7l8m9n0o1p2",
"request_status": "success",
"time_took_in_seconds": 0.189
},
"from_date": "2025-08-17T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "day",
"timezone": "UTC",
"total_credits": 3456,
"aggregations": [
{
"timestamp": "2025-08-17T00:00:00Z",
"date": "2025-08-17",
"day_name": "Saturday",
"day_of_week": 6,
"credits": 234
},
{
"timestamp": "2025-08-18T00:00:00Z",
"date": "2025-08-18",
"day_name": "Sunday",
"day_of_week": 0,
"credits": 0
},
{
"timestamp": "2025-08-19T00:00:00Z",
"date": "2025-08-19",
"day_name": "Monday",
"day_of_week": 1,
"credits": 567
}
]
}
{
"response_context": {
"correlation_id": "q2r3s4t5u6v7w8x9y0z1a2b3c4d5e6f7",
"request_status": "success",
"time_took_in_seconds": 0.312
},
"from_date": "2025-01-01T00:00:00Z",
"to_date": "2025-07-01T00:00:00Z",
"resolution": "month",
"timezone": "UTC",
"total_credits": 15678,
"aggregations": [
{
"timestamp": "2025-01-01T00:00:00Z",
"year": 2025,
"month": 1,
"month_name": "January",
"month_abbr": "JAN",
"credits": 2345
},
{
"timestamp": "2025-02-01T00:00:00Z",
"year": 2025,
"month": 2,
"month_name": "February",
"month_abbr": "FEB",
"credits": 1890
},
{
"timestamp": "2025-03-01T00:00:00Z",
"year": 2025,
"month": 3,
"month_name": "March",
"month_abbr": "MAR",
"credits": 2567
}
]
}
Credits
Get Credit Consumption Aggregation
Retrieve aggregated credit consumption data with configurable time ranges and resolutions
POST
/
v1
/
credits
/
aggregation
Get Credit Aggregation
curl --request POST \
--url https://api.explorium.ai/v1/credits/aggregation \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"from_date": "<string>",
"to_date": "<string>",
"request_context": null,
"timezone": "<string>",
"key_name": "<string>"
}
'import requests
url = "https://api.explorium.ai/v1/credits/aggregation"
payload = {
"from_date": "<string>",
"to_date": "<string>",
"request_context": None,
"timezone": "<string>",
"key_name": "<string>"
}
headers = {
"api_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from_date: '<string>',
to_date: '<string>',
request_context: null,
timezone: '<string>',
key_name: '<string>'
})
};
fetch('https://api.explorium.ai/v1/credits/aggregation', 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.explorium.ai/v1/credits/aggregation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from_date' => '<string>',
'to_date' => '<string>',
'request_context' => null,
'timezone' => '<string>',
'key_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.explorium.ai/v1/credits/aggregation"
payload := strings.NewReader("{\n \"from_date\": \"<string>\",\n \"to_date\": \"<string>\",\n \"request_context\": null,\n \"timezone\": \"<string>\",\n \"key_name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.explorium.ai/v1/credits/aggregation")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from_date\": \"<string>\",\n \"to_date\": \"<string>\",\n \"request_context\": null,\n \"timezone\": \"<string>\",\n \"key_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.explorium.ai/v1/credits/aggregation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_date\": \"<string>\",\n \"to_date\": \"<string>\",\n \"request_context\": null,\n \"timezone\": \"<string>\",\n \"key_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"response_context": {
"correlation_id": "5618d686ecb849fda660c3023acf3120",
"request_status": "success",
"time_took_in_seconds": 0.245
},
"from_date": "2025-08-23T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "hour",
"timezone": "UTC",
"total_credits": 1245,
"aggregations": [
{
"timestamp": "2025-08-23T00:00:00Z",
"hour": "00:00",
"date": "2025-08-23",
"credits": 45
},
{
"timestamp": "2025-08-23T01:00:00Z",
"hour": "01:00",
"date": "2025-08-23",
"credits": 52
},
{
"timestamp": "2025-08-23T13:00:00Z",
"hour": "13:00",
"date": "2025-08-23",
"credits": 89
}
]
}
{
"response_context": {
"correlation_id": "a7b8c9d0e1f2g3h4i5j6k7l8m9n0o1p2",
"request_status": "success",
"time_took_in_seconds": 0.189
},
"from_date": "2025-08-17T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "day",
"timezone": "UTC",
"total_credits": 3456,
"aggregations": [
{
"timestamp": "2025-08-17T00:00:00Z",
"date": "2025-08-17",
"day_name": "Saturday",
"day_of_week": 6,
"credits": 234
},
{
"timestamp": "2025-08-18T00:00:00Z",
"date": "2025-08-18",
"day_name": "Sunday",
"day_of_week": 0,
"credits": 0
},
{
"timestamp": "2025-08-19T00:00:00Z",
"date": "2025-08-19",
"day_name": "Monday",
"day_of_week": 1,
"credits": 567
}
]
}
{
"response_context": {
"correlation_id": "q2r3s4t5u6v7w8x9y0z1a2b3c4d5e6f7",
"request_status": "success",
"time_took_in_seconds": 0.312
},
"from_date": "2025-01-01T00:00:00Z",
"to_date": "2025-07-01T00:00:00Z",
"resolution": "month",
"timezone": "UTC",
"total_credits": 15678,
"aggregations": [
{
"timestamp": "2025-01-01T00:00:00Z",
"year": 2025,
"month": 1,
"month_name": "January",
"month_abbr": "JAN",
"credits": 2345
},
{
"timestamp": "2025-02-01T00:00:00Z",
"year": 2025,
"month": 2,
"month_name": "February",
"month_abbr": "FEB",
"credits": 1890
},
{
"timestamp": "2025-03-01T00:00:00Z",
"year": 2025,
"month": 3,
"month_name": "March",
"month_abbr": "MAR",
"credits": 2567
}
]
}
Overview
The Credit Consumption Aggregation endpoint provides detailed analytics on credit usage across your account. Query consumption data by time periods (hourly, daily, monthly) or by API endpoint to understand usage patterns and optimize your credit allocation.Authentication
Include your account API key in the request header:api_key: YOUR_API_KEY
Request Body
Start date and time for the aggregation period (ISO 8601 format)Example:
"2025-08-23T00:00:00Z"End date and time for the aggregation period (ISO 8601 format)Example:
"2025-08-24T00:00:00Z"Time resolution for aggregating credit dataAllowed values:
hour | day | monthDate range limits:hour: Maximum 7 daysday: Maximum 60 daysmonth: Maximum 2 years
Optional API key name to scope aggregation results to a specific API key. When provided, only credit consumption associated with the named API key is included in the response.Example:
"production-key"Response
Returns a JSON object containing aggregated credit consumption data:Array of aggregated credit consumption data points
Show properties
Show properties
Examples
curl --request POST \
--url https://api.explorium.ai/v1/credits/aggregation \
--header 'Content-Type: application/json' \
--header 'api_key: YOUR_API_KEY' \
--data '{
"from_date": "2025-08-23T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "hour"
}'
curl --request POST \
--url https://api.explorium.ai/v1/credits/aggregation \
--header 'Content-Type: application/json' \
--header 'api_key: YOUR_API_KEY' \
--data '{
"from_date": "2025-08-17T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "day"
}'
curl --request POST \
--url https://api.explorium.ai/v1/credits/aggregation \
--header 'Content-Type: application/json' \
--header 'api_key: YOUR_API_KEY' \
--data '{
"from_date": "2025-01-01T00:00:00Z",
"to_date": "2025-07-01T00:00:00Z",
"resolution": "month"
}'
curl --request POST \
--url https://api.explorium.ai/v1/credits/aggregation \
--header 'Content-Type: application/json' \
--header 'api_key: YOUR_API_KEY' \
--data '{
"from_date": "2025-08-23T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "day",
"timezone": "America/New_York"
}'
curl --request POST \
--url https://api.explorium.ai/v1/credits/aggregation \
--header 'Content-Type: application/json' \
--header 'api_key: YOUR_API_KEY' \
--data '{
"from_date": "2025-08-17T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "day",
"key_name": "production-key"
}'
{
"response_context": {
"correlation_id": "5618d686ecb849fda660c3023acf3120",
"request_status": "success",
"time_took_in_seconds": 0.245
},
"from_date": "2025-08-23T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "hour",
"timezone": "UTC",
"total_credits": 1245,
"aggregations": [
{
"timestamp": "2025-08-23T00:00:00Z",
"hour": "00:00",
"date": "2025-08-23",
"credits": 45
},
{
"timestamp": "2025-08-23T01:00:00Z",
"hour": "01:00",
"date": "2025-08-23",
"credits": 52
},
{
"timestamp": "2025-08-23T13:00:00Z",
"hour": "13:00",
"date": "2025-08-23",
"credits": 89
}
]
}
{
"response_context": {
"correlation_id": "a7b8c9d0e1f2g3h4i5j6k7l8m9n0o1p2",
"request_status": "success",
"time_took_in_seconds": 0.189
},
"from_date": "2025-08-17T00:00:00Z",
"to_date": "2025-08-24T00:00:00Z",
"resolution": "day",
"timezone": "UTC",
"total_credits": 3456,
"aggregations": [
{
"timestamp": "2025-08-17T00:00:00Z",
"date": "2025-08-17",
"day_name": "Saturday",
"day_of_week": 6,
"credits": 234
},
{
"timestamp": "2025-08-18T00:00:00Z",
"date": "2025-08-18",
"day_name": "Sunday",
"day_of_week": 0,
"credits": 0
},
{
"timestamp": "2025-08-19T00:00:00Z",
"date": "2025-08-19",
"day_name": "Monday",
"day_of_week": 1,
"credits": 567
}
]
}
{
"response_context": {
"correlation_id": "q2r3s4t5u6v7w8x9y0z1a2b3c4d5e6f7",
"request_status": "success",
"time_took_in_seconds": 0.312
},
"from_date": "2025-01-01T00:00:00Z",
"to_date": "2025-07-01T00:00:00Z",
"resolution": "month",
"timezone": "UTC",
"total_credits": 15678,
"aggregations": [
{
"timestamp": "2025-01-01T00:00:00Z",
"year": 2025,
"month": 1,
"month_name": "January",
"month_abbr": "JAN",
"credits": 2345
},
{
"timestamp": "2025-02-01T00:00:00Z",
"year": 2025,
"month": 2,
"month_name": "February",
"month_abbr": "FEB",
"credits": 1890
},
{
"timestamp": "2025-03-01T00:00:00Z",
"year": 2025,
"month": 3,
"month_name": "March",
"month_abbr": "MAR",
"credits": 2567
}
]
}
Error Responses
{
"response_context": {
"correlation_id": "error123456789",
"request_status": "failure",
"time_took_in_seconds": 0.012
},
"error": {
"code": "INVALID_DATE_RANGE",
"message": "The from_date must be before to_date",
"details": {
"from_date": "2025-08-24T00:00:00Z",
"to_date": "2025-08-23T00:00:00Z"
}
}
}
{
"response_context": {
"correlation_id": "auth987654321",
"request_status": "failure",
"time_took_in_seconds": 0.008
},
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}
{
"response_context": {
"correlation_id": "error456789123",
"request_status": "failure",
"time_took_in_seconds": 0.010
},
"error": {
"code": "INVALID_RESOLUTION",
"message": "Resolution must be one of: hour, day, month"
}
}
Use Cases
Monitoring Credit Usage Patterns Track how your credit consumption varies throughout the day, week, or month to identify peak usage times and optimize your API call scheduling. Budget Planning Use monthly aggregations to understand long-term trends and plan your credit allocation for upcoming periods. Anomaly Detection Monitor hourly or daily consumption to quickly identify unexpected spikes in usage that may indicate issues or opportunities for optimization. Reporting and Analytics Generate detailed consumption reports for internal stakeholders or integrate with your own analytics dashboards for comprehensive visibility.Body
application/json
Response
Successful Response
This is base response model for all responses in partner service.
Was this page helpful?