API Reference

Complete REST API documentation for the RevMine platform. All endpoints return JSON and require HTTPS.

Base URL: https://revmine.ai/api
Authentication: Most endpoints require a Bearer token in the Authorization header. Obtain a token via POST /api/auth/login. Tokens expire after 24 hours and can be refreshed via POST /api/auth/refresh.

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
Public

Exchanges a valid Auth1 OTP token for a RevMine access token and refresh token pair.

Request Body
{
  "auth1_token": "eyJhbGciOiJIUzI1NiIs...",
  "phone": "+15551234567"
}
Response 200
{
  "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"
  }
}
StatusDescription
400Missing or invalid auth1_token
401Auth1 token expired or invalid
500Internal server error
GET /api/auth/me Get current user
Auth Required

Returns the profile of the currently authenticated user.

Response 200
{
  "id": "usr_abc123",
  "phone": "+15551234567",
  "email": "user@example.com",
  "wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
  "tier": "growth",
  "created_at": "2026-03-01T00:00:00Z"
}
StatusDescription
401Missing or invalid access token
POST /api/auth/refresh Refresh access token
Public

Exchange a valid refresh token for a new access token.

Request Body
{
  "refresh_token": "rt_a1b2c3d4e5f6..."
}
Response 200
{
  "success": true,
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "expires_in": 86400
}
StatusDescription
400Missing refresh_token
401Refresh token expired or revoked
POST /api/auth/logout End session
Auth Required

Invalidates the current access token and refresh token pair.

Response 200
{
  "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
Auth Required

Begins the token creation process. Validates parameters and prepares the on-chain transaction.

Request Body
{
  "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"
}
Response 200
{
  "success": true,
  "token_id": "tok_abc123",
  "status": "pending_confirmation",
  "transaction": {
    "unsigned_tx": "base64-encoded-transaction...",
    "expires_at": "2026-03-28T12:05:00Z"
  }
}
StatusDescription
400Invalid parameters (name, symbol, supply)
401Authentication required
409Token with this symbol already exists
POST /api/create-token/confirm Confirm on-chain deployment
Auth Required

Confirms the token creation by submitting the signed transaction. The token is deployed on-chain upon success.

Request Body
{
  "token_id": "tok_abc123",
  "signed_tx": "base64-encoded-signed-transaction..."
}
Response 200
{
  "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
Auth Required

Retrieve details for a specific token including on-chain data.

Response 200
{
  "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"
}
StatusDescription
404Token not found
GET /api/token/{id}/stats Get token statistics
Auth Required

Returns aggregate statistics for a token: active miners, total mined, burn history, and distribution metrics.

Response 200
{
  "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
Auth Required

Starts a new mining session for the given wallet and token. If an active session already exists, it will be resumed instead.

Request Body
{
  "wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
  "token": "tok_abc123",
  "invitedMiners": 5
}
Response 200
{
  "success": true,
  "session": {
    "id": "session_1711612800000_a1b2c3d4",
    "miningRate": 9.0,
    "startedAt": "2026-03-28T12:00:00Z",
    "invitedMiners": 5
  }
}
Mining rate: Base rate is 6.0 tokens/hour. Each invited miner adds a 10% bonus (up to 200 miners = 20x multiplier). Formula: 6.0 * (1.0 + 0.1 * min(invitedMiners, 200))
StatusDescription
400Missing wallet or token
403Mining suspended (fraud detection)
429Rate limit exceeded
POST /api/mining/stop Stop mining session
Auth Required

Stops an active mining session. Pending rewards are preserved and can be claimed later.

Request Body
{
  "wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
  "sessionId": "session_1711612800000_a1b2c3d4"
}
Response 200
{
  "success": true,
  "pendingRewards": 42.75,
  "totalMined": 1250.50
}
POST /api/mining/claim Claim mined rewards
Auth Required

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.

Request Body
{
  "wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgHkV",
  "sessionId": "session_1711612800000_a1b2c3d4"
}
Response 200
{
  "success": true,
  "claimed": 42.75,
  "totalMined": 1293.25,
  "fraudPenalty": null,
  "distribution_status": "on_chain",
  "tx_signature": "5UfDuYCMPo...",
  "distribution_error": null
}
StatusDescription
400Missing wallet / invalid Solana address
429Claim rate limit exceeded
GET /api/mining/status Get current mining status
Auth Required

Returns the current mining session status and pending rewards for a wallet.

Query Parameters
?wallet=7xKXtg...&token=tok_abc123
Response 200
{
  "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
Auth Required

Returns a paginated list of miners for the authenticated user's token.

Query Parameters
?token_id=tok_abc123&limit=20&offset=0&status=active
Response 200
{
  "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
Auth Required

Returns detailed information for a specific miner by wallet address.

Response 200
{
  "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
}
StatusDescription
404Miner not found

Distribution

Execute and track token distributions to miners and holders.

POST /api/distribution/execute Execute distribution
Auth Required

Executes a token distribution to the specified recipients using a configured minting strategy.

Request Body
{
  "token_id": "tok_abc123",
  "strategy_id": "strat_pro_rata",
  "amount": 10000,
  "note": "March 2026 monthly distribution"
}
Response 200
{
  "success": true,
  "distribution_id": "dist_abc123",
  "recipients": 142,
  "total_distributed": 10000,
  "tx_signatures": ["5UfDuYCMPo..."],
  "status": "completed"
}
StatusDescription
400Missing token_id or amount
402Insufficient treasury balance
GET /api/distribution/history Distribution history
Auth Required

Returns a paginated history of token distributions.

Query Parameters
?token_id=tok_abc123&limit=20&offset=0
Response 200
{
  "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
Auth Required

Executes an immediate on-chain token burn. Sends tokens to the Solana burn address and records the transaction. Triggers a burn.executed webhook event.

Request Body
{
  "token_id": "tok_abc123",
  "amount": 5000,
  "note": "Quarterly deflationary burn",
  "dry_run": false
}
Response 200
{
  "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..."
  }
}
StatusDescription
400Missing token_id or invalid amount
400Amount below/above configured min/max
404Token not found
429Cooldown period active
500On-chain burn failed
GET /api/burn/history Burn history
Auth Required

Returns a paginated list of past burn events.

Query Parameters
?token_id=tok_abc123&limit=20&offset=0
Response 200
{
  "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
Auth Required

Performs a dry-run burn simulation. No tokens are actually burned. Returns projected supply impact.

Request Body
{
  "token_id": "tok_abc123",
  "amount": 5000
}
Response 200
{
  "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
Auth Required

Returns the list of achievements and the user's progress toward each.

Response 200
{
  "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
Auth Required

Returns currently active time-limited challenges.

Response 200
{
  "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
Auth Required

Returns the top miners ranked by total tokens mined.

Query Parameters
?token_id=tok_abc123&limit=50
Response 200
{
  "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
Auth Required

Returns aggregate referral statistics including conversion rate, rewards paid, and tier breakdown.

Response 200
{
  "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
Auth Required

Returns the authenticated user's referral codes and their usage stats.

Response 200
{
  "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.

Webhook Signatures: Every webhook delivery includes an 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
Auth Required

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.

Request Body
{
  "url": "https://example.com/webhooks/revmine",
  "events": [
    "mining.claimed",
    "burn.executed",
    "referral.confirmed"
  ],
  "secret": "optional-custom-secret"
}
Response 201
{
  "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"
}
Important: The secret is only returned in the registration response. Store it securely. If lost, delete the webhook and create a new one.
StatusDescription
400Invalid URL or unknown event types
409Webhook with this URL already registered
429Maximum of 10 webhooks per account
GET /api/webhooks List webhooks
Auth Required

Returns all registered webhooks for the authenticated user. Secrets are masked (only last 8 characters shown).

Response 200
{
  "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
Auth Required

Permanently deletes a webhook registration. Events will no longer be delivered to this URL.

Response 200
{
  "success": true,
  "id": "wh_1711612800000_a1b2c3d4e5f6",
  "message": "Webhook deleted"
}
StatusDescription
403Not authorized to delete this webhook
404Webhook not found

Widget

Configure and embed the RevMine mining widget on your site.

GET /api/widget/config Get widget configuration
Auth Required

Returns the current widget configuration for the authenticated user's token.

Response 200
{
  "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
Auth Required

Updates the widget configuration. All fields are optional; only provided fields are updated.

Request Body
{
  "theme": "dark",
  "position": "bottom-right",
  "color": "#f97316",
  "show_leaderboard": true,
  "show_referral": true
}
Response 200
{
  "success": true,
  "message": "Widget configuration updated"
}
POST /api/widget/embed Generate embed code
Auth Required

Generates the HTML embed snippet for the mining widget.

Request Body
{
  "token_id": "tok_abc123"
}
Response 200
{
  "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 Response Format
{
  "error": "Human-readable error message",
  "code": "MACHINE_READABLE_CODE"
}
HTTP StatusMeaning
400Bad Request -- Invalid parameters or missing required fields
401Unauthorized -- Missing or invalid access token
403Forbidden -- Valid token but insufficient permissions
404Not Found -- Resource does not exist
409Conflict -- Resource already exists (duplicate)
429Too Many Requests -- Rate limit exceeded (check Retry-After header)
500Internal Server Error -- Something went wrong on our end

Rate Limits

API endpoints are rate-limited to ensure fair usage. Limits vary by tier.

TierRequests/minMining Claims/hr
Free605
Growth30020
Enterprise1,000100

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.

EventDescriptionTriggered 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
Webhook Payload Format
{
  "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..."
  }
}
Webhook Headers
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
Signature Verification (Node.js)
// 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}`)
  );
}
Retry Policy: Failed deliveries are retried up to 3 times with exponential backoff (1s, 5s, 25s). If all retries fail, the delivery is logged as failed. You can check delivery status via the dashboard.