Token System API
Overview
The Token System API allows users to earn, spend, and manage tokens within the application. It provides endpoints for token transactions, balance checks, and staking operations.
Types
TokenBalance
Represents a user's token balance and related information.
type TokenBalance {
id: ID!
userId: Int!
balance: BigDecimal!
lastActivityDate: DateTime
createdAt: DateTime!
updatedAt: DateTime!
}
TokenTransaction
Records individual token transactions including earnings, spending, and staking operations.
type TokenTransaction {
id: ID!
userId: ID!
amount: Float!
type: TokenTransactionType!
adVendor: String
region: String
createdAt: DateTime!
}
TokenTransactionType
Enum representing different types of token transactions.
enum TokenTransactionType {
EARN # From watching ads
SPEND # From using VPN
STAKE # For staking tokens
UNSTAKE # For unstaking tokens
}
DailyStats
Provides daily statistics for token activities.
type DailyStats {
watchedAds: Int!
remainingAds: Int!
tokensEarned: Float!
tokensSpent: Float!
}
RemainingLimits
Shows remaining limits for token-earning activities.
type RemainingLimits {
remainingDailyAds: Int!
remainingHourlyAds: Int!
nextHourlyReset: DateTime!
nextDailyReset: DateTime!
}
Queries
Get Token Balance
Retrieves the current token balance for the authenticated user.
query {
getTokenBalance {
id
userId
balance
lastActivityDate
createdAt
updatedAt
}
}
Get Daily Stats
Retrieves daily statistics for token activities.
query {
getMyDailyStats {
watchedAds
remainingAds
tokensEarned
tokensSpent
}
}
Get Remaining Limits
Retrieves remaining limits for token-earning activities.
query {
getMyRemainingLimits {
remainingDailyAds
remainingHourlyAds
nextHourlyReset
nextDailyReset
}
}
Mutations
Earn Tokens
Earn tokens by watching ads or completing other activities.
mutation {
earnTokens(
adVendor: String!
region: String!
) {
id
balance
lastActivityDate
}
}
Input Parameters
adVendor
: The provider of the ad (required)region
: The region where the ad was viewed (required)
Spend Tokens
Spend tokens on VPN services or other features.
mutation {
spendTokens(
minutes: Int!
activeDevices: Int!
) {
id
balance
lastActivityDate
}
}