Image Usage Analytics
This endpoint helps you get image analytics data like bandwidth consumption, request count, CDN hit ratio, etc.
Body
application/json
- Type: objectdate
_range requiredProperties: 2The timeframe to get the data for. Currently we only support a maximum of 30 days between
start_atandend_at. - Type: array of stringenummetricsrequired
Define the metric you need the data for. Currently we support
bandwidth_consumption,requests_count,status_4xx,status_5xx, andavg_response_time.values- bandwidth
_consumption - requests
_count - transformations
_count - bandwidth
_savings - origin
_hit _rate - avg
_transformation _response _time - status
_4xx - status
_5xx
- bandwidth
- Properties: 1Type: objectfilters
- Type: stringenumgroup
_by valuesdailyweeklymonthlyhourly
Responses
- application/json
- application/json
- application/json
- application/json
Request Example for post/image/analytics
import Gumlet from '@gumlet/nodejs-sdk';
const client = new Gumlet({
apiKey: process.env['API_KEY'], // defaults to the API_KEY env var
});
const imageUsageAnalytic = await client.imageUsageAnalytics.retrieve({
metrics: ['bandwidth_consumption'],
date_range: {
start_at: '2024-01-01',
end_at: '2024-01-01',
},
group_by: 'daily',
});
console.log(imageUsageAnalytic);
{
"bandwidth_consumption": [
{
"units": 1,
"timestamp": 1
}
],
"requests_count": [
{
"units": 1,
"timestamp": 1
}
],
"status_2xx": [
{
"units": 0,
"timestamp": 1
}
],
"status_4xx": [
{
"units": 0,
"timestamp": 1
}
],
"status_5xx": [
{
"units": 0,
"timestamp": 1
}
],
"avg_response_time": [
{
"units": 0,
"timestamp": 1
}
],
"cdn_hit_rate": [
{
"units": 0,
"timestamp": 1
}
],
"transformations_count": [
{
"units": 1,
"timestamp": 1
}
],
"origin_hit_rate": [
{
"units": 0,
"timestamp": 1
}
],
"avg_transformation_response_time": [
{
"timestamp": 1,
"fetch_time": 0,
"response_time": 1
}
],
"content_type": [
{
"avif": 1,
"png": 1,
"jpeg": 1,
"gif": 1,
"webp": 1,
"jxl": 1,
"mp4": 1,
"timestamp": 1
}
],
"bandwidth_savings": [
{
"units": 0,
"timestamp": 1
}
],
"bandwidth_consumption_by_source": [
{
"bytes": 1,
"domain": "string"
}
],
"ai_credit_usage": [
{
"timestamp": 1,
"bg_removal": 1,
"shadow_gen": 1
}
]
}
