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
| Parameter | Location | Type | Required | Description and constraints |
|---|---|---|---|---|
timeframe | query | "24h" / "7d" / "30d" | No | Timeframe 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.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
response.timeframe | string | Yes | The timeframe for the statistics |
response.totalSpent | integer | Yes | Total credits spent in the timeframe |
response.totalEarned | integer | Yes | Total credits earned in the timeframe |
response.totalRefunded | integer | Yes | Total credits refunded in the timeframe |
response.dailyUsage | array of object | Yes | Daily 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.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
response.dailyUsage[].date | string | Yes | Date of the usage Format: date. |
response.dailyUsage[].spent | integer | Yes | Credits spent on this day |
response.dailyUsage[].earned | integer | Yes | Credits 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.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
response.error | string | Yes | Error type |
response.message | string | No | Human-readable error message |
HTTP 500
Internal server error
Content type: application/json.
Required properties: error.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
response.error | string | Yes | Error type |
response.message | string | No | Human-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.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
UsageStats.timeframe | string | Yes | The timeframe for the statistics |
UsageStats.totalSpent | integer | Yes | Total credits spent in the timeframe |
UsageStats.totalEarned | integer | Yes | Total credits earned in the timeframe |
UsageStats.totalRefunded | integer | Yes | Total credits refunded in the timeframe |
UsageStats.dailyUsage | array of object | Yes | Daily 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.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
UsageStats.dailyUsage[].date | string | Yes | Date of the usage Format: date. |
UsageStats.dailyUsage[].spent | integer | Yes | Credits spent on this day |
UsageStats.dailyUsage[].earned | integer | Yes | Credits earned on this day |
AuthenticationError
Unknown properties are rejected. Required properties: error.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
AuthenticationError.error | string | Yes | Error type |
AuthenticationError.message | string | No | Human-readable error message |
Error
Required properties: error.
| Field | Type | Required | Description and constraints |
|---|---|---|---|
Error.error | string | Yes | Error type |
Error.message | string | No | Human-readable error message |