Token Statistics API
The Token Statistics API provides functionality for managing and retrieving token-related statistics in the CRM application. This API enables authorized CRM users to access and modify various token statistics, including buyback data, token supply information, user growth metrics, and social media statistics.
Authentication​
Authentication is automatically managed through HTTP cookies, with the system handling both the accessToken and the refreshToken.
Authorization​
All operations in the Token Statistics API are protected by role-based access control:
- Most operations require either the
OWNER
,CMS
, orBO
role - Some operations (like creating token statistics) are restricted to the
OWNER
role only
Available Operations​
Queries​
- tokenStat: Retrieve token statistics for a specific token (defaults to BLOCK)
- tokenStats: Retrieve statistics for all tokens
Mutations​
- createTokenStat: Create a new token statistics entry (OWNER role only)
- addUpdateMonthlyBuyBack: Add or update monthly buyback data
- addUpdateBuybackTiers: Add or update buyback tier information with multilingual support
- createUpdateTiersData: Create or update tier-related data
- createUpdateTokenSupply: Update token supply information with multilingual descriptions
- addUpdateUserGrowth: Track user growth metrics over time
- addUpdateTokenMultipliers: Configure token multipliers for different tiers
- addUpdateSocialStats: Monitor social media statistics
Key Features​
Multilingual Content Support​
Several operations support multilingual content through the LangTextInput
type:
- addUpdateBuybackTiers: Supports multilingual tier information and descriptions
- createUpdateTokenSupply: Supports multilingual titles and descriptions
AI-Powered Translation​
The API integrates with AI translation capabilities for automatic content localization:
- When creating new buyback tiers, content is automatically translated to all supported languages
- When updating token supply information with a single language, translations are automatically generated
Data Validation​
All input data is thoroughly validated:
- Month values are restricted to 1-12
- Year values are restricted to 2020-2100
- Tier values are restricted to 1-5
- Numerical values have appropriate minimum constraints
- Text fields must not be empty
- Multilingual content must have at least one entry
Error Handling​
The API follows standard GraphQL error handling conventions:
- Operations return boolean values to indicate success or failure
- Special response types provide detailed operation status
- GraphQL errors are returned for validation failures or unauthorized access