Authentication
Exchange Auth1 OTP tokens for RevMine session tokens. All auth endpoints are under /api/auth.
POST /api/auth/login Exchange Auth1 token for RevMine session
Exchanges a valid Auth1 OTP token for a RevMine access token and refresh token pair.
{
"auth1_token": "eyJhbGciOiJIUzI1NiIs...",
"phone": "+15551234567"
}
{
"success": true,
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "rt_a1b2c3d4e5f6...",
"expires_in": 86400,
"user": {
"id": "usr_abc123",
"phone": "+15551234567",
"created_at": "2026-03-01T00:00:00Z"
}
}
| Status | Description |
|---|---|
400 | Missing or invalid auth1_token |
401 | Auth1 token expired or invalid |
500 | Internal server error |
GET /api/auth/me Get current user
Returns the profile of the currently authenticated user.
{
"id": "usr_abc123",
"phone": "+15551234567",
"email": "user@example.com",
"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
"tier": "growth",
"created_at": "2026-03-01T00:00:00Z"
}
| Status | Description |
|---|---|
401 | Missing or invalid access token |
POST /api/auth/refresh Refresh access token
Exchange a valid refresh token for a new access token.
{
"refresh_token": "rt_a1b2c3d4e5f6..."
}
{
"success": true,
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 86400
}
| Status | Description |
|---|---|
400 | Missing refresh_token |
401 | Refresh token expired or revoked |
POST /api/auth/logout End session
Invalidates the current access token and refresh token pair.
{
"success": true,
"message": "Logged out successfully"
}
Tokens
Create and manage revenue-backed tokens on Solana. Token creation is a two-step process: initialize, then confirm on-chain deployment.
POST /api/create-token/init Initialize token creation
Begins the token creation process. Validates parameters and prepares the on-chain transaction.
{
"name": "Acme Rewards",
"symbol": "ACME",
"total_supply": 1000000,
"decimals": 8,
"burn_rate": 5,
"mining_rate": 6.0,
"description": "Revenue-backed loyalty token for Acme SaaS",
"logo_url": "https://example.com/logo.png"
}
{
"success": true,
"token_id": "tok_abc123",
"status": "pending_confirmation",
"transaction": {
"unsigned_tx": "base64-encoded-transaction...",
"expires_at": "2026-03-28T12:05:00Z"
}
}
| Status | Description |
|---|---|
400 | Invalid parameters (name, symbol, supply) |
401 | Authentication required |
409 | Token with this symbol already exists |
POST /api/create-token/confirm Confirm on-chain deployment
Confirms the token creation by submitting the signed transaction. The token is deployed on-chain upon success.
{
"token_id": "tok_abc123",
"signed_tx": "base64-encoded-signed-transaction..."
}
{
"success": true,
"token_id": "tok_abc123",
"mint_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
"tx_signature": "5UfDuYCMPo...",
"explorer_url": "https://explorer.solana.com/tx/5UfDuYCMPo..."
}
GET /api/token/{id} Get token details
Retrieve details for a specific token including on-chain data.
{
"id": "tok_abc123",
"name": "Acme Rewards",
"symbol": "ACME",
"mint_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
"total_supply": 1000000,
"circulating_supply": 250000,
"total_burned": 15000,
"decimals": 8,
"burn_rate": 5,
"mining_rate": 6.0,
"status": "active",
"created_at": "2026-03-01T00:00:00Z"
}
| Status | Description |
|---|---|
404 | Token not found |
GET /api/token/{id}/stats Get token statistics
Returns aggregate statistics for a token: active miners, total mined, burn history, and distribution metrics.
{
"token_id": "tok_abc123",
"active_miners": 142,
"total_mined": 85420.50,
"total_burned": 15000,
"total_distributed": 70420.50,
"burn_count": 12,
"avg_mining_rate": 6.8,
"last_burn_at": "2026-03-27T14:30:00Z"
}
Mining
Manage mining sessions. Users earn tokens by maintaining active mining sessions. Rewards accrue over time at the configured mining rate.
POST /api/mining/start Start mining session
Starts a new mining session for the given wallet and token. If an active session already exists, it will be resumed instead.
{
"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
"token": "tok_abc123",
"invitedMiners": 5
}
{
"success": true,
"session": {
"id": "session_1711612800000_a1b2c3d4",
"miningRate": 9.0,
"startedAt": "2026-03-28T12:00:00Z",
"invitedMiners": 5
}
}
6.0 * (1.0 + 0.1 * min(invitedMiners, 200))
| Status | Description |
|---|---|
400 | Missing wallet or token |
403 | Mining suspended (fraud detection) |
429 | Rate limit exceeded |
POST /api/mining/stop Stop mining session
Stops an active mining session. Pending rewards are preserved and can be claimed later.
{
"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
"sessionId": "session_1711612800000_a1b2c3d4"
}
{
"success": true,
"pendingRewards": 42.75,
"totalMined": 1250.50
}
POST /api/mining/claim Claim mined rewards
Claims accumulated mining rewards. When on-chain distribution is enabled, tokens are transferred to the user's wallet on Solana. Triggers a mining.claimed webhook event.
{
"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
"sessionId": "session_1711612800000_a1b2c3d4"
}
{
"success": true,
"claimed": 42.75,
"totalMined": 1293.25,
"fraudPenalty": null,
"distribution_status": "on_chain",
"tx_signature": "5UfDuYCMPo...",
"distribution_error": null
}
| Status | Description |
|---|---|
400 | Missing wallet / invalid Solana address |
429 | Claim rate limit exceeded |
GET /api/mining/status Get current mining status
Returns the current mining session status and pending rewards for a wallet.
?wallet=7xKXtg...&token=tok_abc123
{
"miningActive": true,
"sessionId": "session_1711612800000_a1b2c3d4",
"miningRate": 9.0,
"pendingRewards": 18.50,
"totalMined": 1250.50,
"startedAt": "2026-03-28T12:00:00Z",
"invitedMiners": 5
}
Miners
Query miner records and statistics.
GET /api/miners List miners
Returns a paginated list of miners for the authenticated user's token.
?token_id=tok_abc123&limit=20&offset=0&status=active
{
"miners": [
{
"id": "miner_7xKXtg..._tok_abc123",
"wallet": "7xKXtg2CW87d...",
"tokens_mined": 1250.50,
"status": "active",
"joined": "2026-03-01T00:00:00Z",
"last_active": "2026-03-28T12:00:00Z"
}
],
"total": 142
}
GET /api/miners/{wallet} Get miner details
Returns detailed information for a specific miner by wallet address.
{
"id": "miner_7xKXtg..._tok_abc123",
"wallet": "7xKXtg2CW87d...",
"token_id": "tok_abc123",
"tokens_mined": 1250.50,
"status": "active",
"joined": "2026-03-01T00:00:00Z",
"last_active": "2026-03-28T12:00:00Z",
"mining_sessions": 47,
"total_claims": 32
}
| Status | Description |
|---|---|
404 | Miner not found |
Distribution
Execute and track token distributions to miners and holders.
POST /api/distribution/execute Execute distribution
Executes a token distribution to the specified recipients using a configured minting strategy.
{
"token_id": "tok_abc123",
"strategy_id": "strat_pro_rata",
"amount": 10000,
"note": "March 2026 monthly distribution"
}
{
"success": true,
"distribution_id": "dist_abc123",
"recipients": 142,
"total_distributed": 10000,
"tx_signatures": ["5UfDuYCMPo..."],
"status": "completed"
}
| Status | Description |
|---|---|
400 | Missing token_id or amount |
402 | Insufficient treasury balance |
GET /api/distribution/history Distribution history
Returns a paginated history of token distributions.
?token_id=tok_abc123&limit=20&offset=0
{
"distributions": [
{
"id": "dist_abc123",
"token_id": "tok_abc123",
"amount": 10000,
"recipients": 142,
"status": "completed",
"created_at": "2026-03-28T12:00:00Z"
}
],
"total": 8
}
Burns
Execute, schedule, and simulate token burns on Solana. Burns reduce circulating supply and increase token scarcity.
POST /api/burn/execute Execute token burn
Executes an immediate on-chain token burn. Sends tokens to the Solana burn address and records the transaction. Triggers a burn.executed webhook event.
{
"token_id": "tok_abc123",
"amount": 5000,
"note": "Quarterly deflationary burn",
"dry_run": false
}
{
"message": "Burn executed successfully",
"burn": {
"id": "burn_1711612800000_a1b2c3d4e",
"token_id": "tok_abc123",
"amount": 5000,
"status": "completed",
"executed_at": "2026-03-28T12:00:00Z",
"tx_signature": "5UfDuYCMPo..."
},
"transaction": {
"signature": "5UfDuYCMPo...",
"explorer_url": "https://explorer.solana.com/tx/5UfDuYCMPo..."
}
}
| Status | Description |
|---|---|
400 | Missing token_id or invalid amount |
400 | Amount below/above configured min/max |
404 | Token not found |
429 | Cooldown period active |
500 | On-chain burn failed |
GET /api/burn/history Burn history
Returns a paginated list of past burn events.
?token_id=tok_abc123&limit=20&offset=0
{
"burns": [
{
"id": "burn_1711612800000_a1b2c3d4e",
"token_id": "tok_abc123",
"amount": 5000,
"status": "completed",
"trigger_type": "manual",
"tx_signature": "5UfDuYCMPo...",
"executed_at": "2026-03-28T12:00:00Z"
}
],
"total": 12
}
POST /api/burn/simulate Simulate a burn
Performs a dry-run burn simulation. No tokens are actually burned. Returns projected supply impact.
{
"token_id": "tok_abc123",
"amount": 5000
}
{
"simulation": true,
"token_id": "tok_abc123",
"burn_amount": 5000,
"current_supply": 985000,
"projected_supply": 980000,
"supply_reduction_pct": 0.51,
"estimated_tx_fee": 0.000005
}
Rewards
Achievements, challenges, and leaderboard for gamified engagement.
GET /api/rewards/achievements Get achievements
Returns the list of achievements and the user's progress toward each.
{
"achievements": [
{
"id": "ach_first_mine",
"name": "First Mine",
"description": "Complete your first mining session",
"reward": 50,
"completed": true,
"completed_at": "2026-03-02T10:00:00Z"
},
{
"id": "ach_100_tokens",
"name": "Century Miner",
"description": "Mine 100 tokens",
"reward": 200,
"completed": false,
"progress": 72,
"target": 100
}
]
}
GET /api/rewards/challenges Get active challenges
Returns currently active time-limited challenges.
{
"challenges": [
{
"id": "chl_march_sprint",
"name": "March Mining Sprint",
"description": "Mine 500 tokens before March 31",
"reward": 1000,
"progress": 320,
"target": 500,
"ends_at": "2026-03-31T23:59:59Z"
}
]
}
GET /api/rewards/leaderboard Get leaderboard
Returns the top miners ranked by total tokens mined.
?token_id=tok_abc123&limit=50
{
"leaderboard": [
{
"rank": 1,
"wallet": "7xKX...gHkV",
"tokens_mined": 12500.00,
"tier": "Diamond"
}
]
}
Referrals
Track referral performance, codes, and tiered reward payouts.
GET /api/referrals/stats Referral statistics
Returns aggregate referral statistics including conversion rate, rewards paid, and tier breakdown.
{
"total_referrals": 245,
"confirmed_referrals": 189,
"pending_referrals": 56,
"conversion_rate": 77.1,
"total_rewards_paid": 18900,
"avg_reward_per_referral": 100,
"tiers": [
{
"name": "Starter",
"minReferrals": 0,
"reward": 50
},
{
"name": "Gold",
"minReferrals": 10,
"reward": 100
}
]
}
GET /api/referrals/codes Get referral codes
Returns the authenticated user's referral codes and their usage stats.
{
"codes": [
{
"code": "ACME-JOHN-2026",
"uses": 12,
"max_uses": 100,
"reward_per_use": 100,
"created_at": "2026-03-01T00:00:00Z"
}
]
}
Webhooks
Register HTTP endpoints to receive real-time event notifications from RevMine. Webhooks are signed with HMAC-SHA256 for security.
X-RevMine-Signature header containing sha256={hmac}. The HMAC is computed over {timestamp}.{payload} using your webhook secret. Always verify signatures before processing events.
POST /api/webhooks Register webhook
Registers a new webhook URL to receive event notifications. The URL must be publicly accessible and must not target private IP ranges. An HMAC signing secret is generated automatically if not provided.
{
"url": "https://example.com/webhooks/revmine",
"events": [
"mining.claimed",
"burn.executed",
"referral.confirmed"
],
"secret": "optional-custom-secret"
}
{
"id": "wh_1711612800000_a1b2c3d4e5f6",
"url": "https://example.com/webhooks/revmine",
"events": ["mining.claimed", "burn.executed", "referral.confirmed"],
"secret": "whsec_a1b2c3d4e5f6...",
"created_at": "2026-03-28T12:00:00Z"
}
secret is only returned in the registration response. Store it securely. If lost, delete the webhook and create a new one.
| Status | Description |
|---|---|
400 | Invalid URL or unknown event types |
409 | Webhook with this URL already registered |
429 | Maximum of 10 webhooks per account |
GET /api/webhooks List webhooks
Returns all registered webhooks for the authenticated user. Secrets are masked (only last 8 characters shown).
{
"webhooks": [
{
"id": "wh_1711612800000_a1b2c3d4e5f6",
"url": "https://example.com/webhooks/revmine",
"events": ["mining.claimed", "burn.executed"],
"active": true,
"secret_hint": "...d4e5f6a7",
"created_at": "2026-03-28T12:00:00Z"
}
],
"total": 1
}
DELETE /api/webhooks/{id} Remove webhook
Permanently deletes a webhook registration. Events will no longer be delivered to this URL.
{
"success": true,
"id": "wh_1711612800000_a1b2c3d4e5f6",
"message": "Webhook deleted"
}
| Status | Description |
|---|---|
403 | Not authorized to delete this webhook |
404 | Webhook not found |
Widget
Configure and embed the RevMine mining widget on your site.
GET /api/widget/config Get widget configuration
Returns the current widget configuration for the authenticated user's token.
{
"token_id": "tok_abc123",
"theme": "dark",
"position": "bottom-right",
"color": "#f97316",
"show_leaderboard": true,
"show_referral": true,
"custom_css": null
}
PUT /api/widget/config Update widget configuration
Updates the widget configuration. All fields are optional; only provided fields are updated.
{
"theme": "dark",
"position": "bottom-right",
"color": "#f97316",
"show_leaderboard": true,
"show_referral": true
}
{
"success": true,
"message": "Widget configuration updated"
}
POST /api/widget/embed Generate embed code
Generates the HTML embed snippet for the mining widget.
{
"token_id": "tok_abc123"
}
{
"embed_code": "<script src=\"https://revmine.ai/widget.js\" data-token=\"tok_abc123\"></script>",
"widget_key": "wk_abc123"
}
Error Codes
All error responses follow a consistent JSON format with error and optional code fields.
{
"error": "Human-readable error message",
"code": "MACHINE_READABLE_CODE"
}
| HTTP Status | Meaning |
|---|---|
400 | Bad Request -- Invalid parameters or missing required fields |
401 | Unauthorized -- Missing or invalid access token |
403 | Forbidden -- Valid token but insufficient permissions |
404 | Not Found -- Resource does not exist |
409 | Conflict -- Resource already exists (duplicate) |
429 | Too Many Requests -- Rate limit exceeded (check Retry-After header) |
500 | Internal Server Error -- Something went wrong on our end |
Rate Limits
API endpoints are rate-limited to ensure fair usage. Limits vary by tier.
| Tier | Requests/min | Mining Claims/hr |
|---|---|---|
| Free | 60 | 5 |
| Growth | 300 | 20 |
| Enterprise | 1,000 | 100 |
Rate limit headers are included in every response:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1711612860
Retry-After: 42
Webhook Events
Events that can be subscribed to when registering a webhook. Use * to subscribe to all events.
| Event | Description | Triggered When |
|---|---|---|
| mining.started | Mining session began | A user starts a new mining session |
| mining.claimed | Rewards claimed | A user claims their accumulated mining rewards |
| burn.executed | Token burn completed | An on-chain token burn transaction is confirmed |
| referral.confirmed | Referral confirmed | A referred user completes the required action |
| distribution.completed | Distribution finished | A scheduled or manual token distribution completes |
| token.created | Token deployed | A new token is created and deployed on Solana |
| challenge.completed | Challenge ended | A time-limited challenge concludes |
{
"id": "dlv_1711612800000_a1b2c3d4e5f6a7b8c9d0",
"event": "mining.claimed",
"created_at": "2026-03-28T12:00:00Z",
"data": {
"wallet": "7xKXtg2CW87d...",
"token": "tok_abc123",
"claimed": 42.75,
"total_mined": 1293.25,
"distribution_status": "on_chain",
"tx_signature": "5UfDuYCMPo..."
}
}
X-RevMine-Signature: sha256=a1b2c3d4e5f6...
X-RevMine-Event: mining.claimed
X-RevMine-Delivery-ID: dlv_1711612800000_a1b2c3d4e5f6a7b8c9d0
X-RevMine-Timestamp: 2026-03-28T12:00:00.000Z
// Verify the webhook signature const crypto = require('crypto'); function verifySignature(payload, signature, secret, timestamp) { const expected = crypto .createHmac('sha256', secret) .update(`${timestamp}.${payload}`) .digest('hex'); return crypto.timingSafeEqual( Buffer.from(signature), Buffer.from(`sha256=${expected}`) ); }