Overview
The Zencoder Analytics API enables programmatic access to your organization’s usage data, allowing you to integrate Zencoder metrics into your existing business intelligence tools, custom dashboards, and reporting systems. This REST API provides the same data available in the Analytics Dashboard in a machine-readable format.API access is available for users on Core plans and above. Requires Owner or Manager role permissions within your organization.
Getting Your API Credentials
Before making API requests, you’ll need to generate a personal access token to obtain yourclient_id
and client_secret
:
- Navigate to auth.zencoder.ai and sign in
- Go to Administration → Settings
- Select Personal Tokens from the settings menu
- Click Generate Token
- Configure your token:
- Description: Enter a meaningful identifier (e.g., “Analytics API Integration” or “BI Dashboard”)
- Expiration: Select an appropriate duration for your use case
- Click Generate
Important: After generation, immediately copy and securely store both your Client ID and Client Secret. The Client Secret will only be displayed once and cannot be retrieved later. Store these credentials in a secure location such as a password manager or secrets management system.
Authentication
To authenticate and obtain a JWT access token, make a POST request to the authentication endpoint. EndpointContent-Type: application/json
Parameter | Type | Required | Description |
---|---|---|---|
client_id | string | Yes | Your client identifier |
client_secret | string | Yes | Your client secret key |
grant_type | string | Yes | OAuth 2.0 grant type. Use "client_credentials" |
Authorization
header of subsequent API requests:
- cURL
- Node.js
- Python
View Response Fields
View Response Fields
Field | Type | Description |
---|---|---|
token_type | string | Token type (e.g., “Bearer”) |
access_token | string | JWT token to be used in subsequent API requests |
id_token | string | Same as access_token |
refresh_token | string | JWT refresh token for obtaining new tokens |
expires_in | int | Time until access_token ’s expiration in seconds |
Usage Data Endpoint
Retrieves usage analytics data for the authenticated tenant (account). EndpointAuthorization: Bearer YOUR_ACCESS_TOKEN
Parameter | Type | Required | Description |
---|---|---|---|
period | string | No | Time period for usage data. Must be one of: 7d , 30d , 90d . Defaults to 7d if neither period nor day is provided |
day | string | No | Specific day for usage data in YYYY-MM-DD format. Cannot be used together with period |
period
OR day
, but not both. If neither is provided, defaults to period=7d
.
Example Requests
Get usage data for the last 30 days:
400 Bad Request - Invalid period parameter
400 Bad Request - Invalid period parameter
400 Bad Request - Invalid day parameter format
400 Bad Request - Invalid day parameter format
400 Bad Request - Both period and day parameters provided
400 Bad Request - Both period and day parameters provided
500 Internal Server Error
500 Internal Server Error
Data Object
Data Object
Field | Type | Description |
---|---|---|
period | object | Time period information for the data |
summary | object | Aggregate statistics for the period |
users | array | List of user usage details |
daily | array | Daily breakdown of usage statistics |
Period Object
Period Object
Field | Type | Description |
---|---|---|
start | string | Start date of the period (ISO 8601 format) |
end | string | End date of the period (ISO 8601 format) |
days | int | Number of days in the period |
Summary Object
Summary Object
Field | Type | Description |
---|---|---|
total_active_users | int | Total number of active users in the period |
total_messages | int | Total number of messages sent in the period |
User Object
User Object
Field | Type | Description |
---|---|---|
email | string | User’s email address |
messages | int | Number of messages sent by the user |
last_active | string | Date of user’s last activity (ISO 8601 format) |
ides | array | List of IDEs used by the user |
languages | array | List of programming languages used |
Daily Data Object
Daily Data Object
Field | Type | Description |
---|---|---|
day | string | Date for this data point (ISO 8601 format) |
active_users | int | Number of active users on this day |
messages | int | Number of messages sent on this day |
ides | array | IDE usage breakdown for this day |
languages | array | Language usage breakdown for this day |
IDE Usage Object
IDE Usage Object
Field | Type | Description |
---|---|---|
ide_name | string | Name of the IDE |
engaged_users | int | Number of users who used this IDE |
Language Usage Object
Language Usage Object
Field | Type | Description |
---|---|---|
language_name | string | Name of the programming language |
engaged_users | int | Number of users who used this language |
- Last 30 Days
- Specific Day
- Last 7 Days (Default)
- cURL
- Node.js
- Python
Troubleshooting
Authentication Failures
Authentication Failures
- Verify your
client_id
andclient_secret
are correct - Ensure your subscription is Core or higher
- Check that your account has Owner or Manager permissions
- Confirm you generated a personal access token in Settings
401 Unauthorized Errors
401 Unauthorized Errors
Empty or Missing Data
Empty or Missing Data
- Confirm users in your organization have been active during the requested period
- Verify the date format for
day
parameter isYYYY-MM-DD
- Check that the requested date range contains activity
- Ensure users are part of your organization and have authenticated at least once
Invalid Parameter Errors
Invalid Parameter Errors
- For
period
parameter, use only:7d
,30d
, or90d
- For
day
parameter, use format:YYYY-MM-DD
- Do not provide both
period
andday
parameters in the same request
Connection or Network Issues
Connection or Network Issues
- Verify you can reach
https://fe.zencoder.ai
andhttps://api.zencoder.ai
- Check your firewall or proxy settings
- Ensure your network allows HTTPS requests to Zencoder endpoints