Skip to main content

Get usage statistics

GET /api/credits/usage-stats

Retrieve credit usage statistics for a specified timeframe

Authentication​

  • Option 1: x-api-key: YOUR_API_KEY (header). API key for authentication. Create one in your dashboard.
  • Option 2: Authorization: Bearer YOUR_ACCESS_TOKEN. Dashboard JWT in Authorization: Bearer <token>, only on operations that explicitly list this scheme. Prefer x-api-key for REST integrations. OAuth for hosted MCP is a separate connection at https://mcp.zvid.io/mcp.

Create API keys at app.zvid.io/api-keys. Keep credentials on your server.

Parameters​

ParameterLocationTypeRequiredDescription and constraints
timeframequery"24h" / "7d" / "30d"NoTimeframe for statistics (24h, 7d, or 30d) Default: "30d".

Request​

The shell examples read credentials from ZVID_API_KEY (or ZVID_ACCESS_TOKEN for Bearer authentication). Set that variable in your environment. Replace sample project, template, job, and asset identifiers with values from your own account.

This operation does not take a request body.

Request example​

curl --request GET 'https://api.zvid.io/api/credits/usage-stats' \
--header "x-api-key: $ZVID_API_KEY"

Responses​

HTTP 200​

Usage statistics retrieved successfully

Content type: application/json.

Unknown properties are rejected. Required properties: timeframe, totalSpent, totalEarned, totalRefunded, dailyUsage.

FieldTypeRequiredDescription and constraints
response.timeframestringYesThe timeframe for the statistics
response.totalSpentintegerYesTotal credits spent in the timeframe
response.totalEarnedintegerYesTotal credits earned in the timeframe
response.totalRefundedintegerYesTotal credits refunded in the timeframe
response.dailyUsagearray of objectYesDaily breakdown of credit usage

Nested field: response.dailyUsage

Daily breakdown of credit usage

Array item: response.dailyUsage[]

Unknown properties are rejected. Required properties: date, spent, earned.

FieldTypeRequiredDescription and constraints
response.dailyUsage[].datestringYesDate of the usage Format: date.
response.dailyUsage[].spentintegerYesCredits spent on this day
response.dailyUsage[].earnedintegerYesCredits earned on this day

Example response

{
"timeframe": "30d",
"totalSpent": 500,
"totalEarned": 1000,
"totalRefunded": 50,
"dailyUsage": [
{
"date": "2025-01-15",
"spent": 100,
"earned": 0
},
{
"date": "2025-01-14",
"spent": 75,
"earned": 500
}
]
}

HTTP 401​

Unauthorized

Content type: application/json.

Unknown properties are rejected. Required properties: error.

FieldTypeRequiredDescription and constraints
response.errorstringYesError type
response.messagestringNoHuman-readable error message

HTTP 500​

Internal server error

Content type: application/json.

Required properties: error.

FieldTypeRequiredDescription and constraints
response.errorstringYesError type
response.messagestringNoHuman-readable error message

Schema definitions​

The following definitions describe the fields referenced above. Expand a definition to inspect its complete contract.

UsageStats

Unknown properties are rejected. Required properties: timeframe, totalSpent, totalEarned, totalRefunded, dailyUsage.

FieldTypeRequiredDescription and constraints
UsageStats.timeframestringYesThe timeframe for the statistics
UsageStats.totalSpentintegerYesTotal credits spent in the timeframe
UsageStats.totalEarnedintegerYesTotal credits earned in the timeframe
UsageStats.totalRefundedintegerYesTotal credits refunded in the timeframe
UsageStats.dailyUsagearray of objectYesDaily breakdown of credit usage

Nested field: UsageStats.dailyUsage

Daily breakdown of credit usage

Array item: UsageStats.dailyUsage[]

Unknown properties are rejected. Required properties: date, spent, earned.

FieldTypeRequiredDescription and constraints
UsageStats.dailyUsage[].datestringYesDate of the usage Format: date.
UsageStats.dailyUsage[].spentintegerYesCredits spent on this day
UsageStats.dailyUsage[].earnedintegerYesCredits earned on this day
AuthenticationError

Unknown properties are rejected. Required properties: error.

FieldTypeRequiredDescription and constraints
AuthenticationError.errorstringYesError type
AuthenticationError.messagestringNoHuman-readable error message
Error

Required properties: error.

FieldTypeRequiredDescription and constraints
Error.errorstringYesError type
Error.messagestringNoHuman-readable error message