You can also access the Usage Export in the platform directly, more on that here.
Prerequisites
To use the Usage Export API, you need:- Workspace Admin Permission: Only workspace administrators can create API keys with usage export permissions and export data via the web interface.
- API Key with USAGE_EXPORT_API Scope: Special permission for accessing export functions
Important Security Notice: Users with access to an API key with USAGE_EXPORT_API scope can export workspace usage data for all areas, even if they normally don’t have access to view this data. Only grant this permission to trusted users.
Programmatic Export
Available Endpoints
The Usage Export API provides access to various data types:Authentication
All API requests require Bearer token authentication:Request Format
Response Format
Successful Response
Error Response
Example Requests
Export Assistant Usage
Export User Usage
Rate Limits
The Usage Export API is subject to the same rate limits as other API endpoints:- Tokens per Minute: 60.000 Tokens/Min
- Requests per Minute: 500 Requests/Min
Export Size Limits
Exports are limited to 1,000,000 rows. If your export exceeds this limit, you’ll receive a 400 error asking you to narrow the date range.Data Types in Detail
User Export
Shows individual user activity, depending on privacy settings:- Message count per user
- Activity patterns
- Note: User-specific data may be excluded due to workspace privacy settings
Assistant Export
Contains usage data for all assistants in the workspace, including:- Number of messages
- Active users
- Usage trends over time
Workflow Export
Usage data for workflows (if enabled):- Workflow executions
- Success rates
- Performance metrics
Project Export
Project-related usage statistics:- Project activity
- Involved users
- Resource consumption
Model Export
Detailed information about model usage:- AI models used
- Token consumption
- Cost per model
Troubleshooting
Common Errors
400 Bad Request - Export Too Large
401 Unauthorized
404 No Data Found
Security and Privacy
Privacy Settings
Depending on workspace configuration, certain data may be excluded:- User-identifying Data: May be excluded due to privacy settings
- Leaderboards: Must be enabled in the workspace to get complete user data
Best Practices
- Secure API Key Storage: Use environment variables or secure key management
- Regular Rotation: Renew API keys regularly
- Minimal Permissions: Only grant necessary scopes
- Monitoring: Monitor the usage of your API keys
Compliance
The Usage Export API helps with compliance requirements:- Audit Trails: Complete tracking of API usage
- Data Export: Support for GDPR data access rights
- Transparency: Clear insights into workspace usage