Skip to content

Coins

Endpoints for managing the virtual currency system.

Deduct Coins

Deduct coins from user's balance for purchases or wagers.

Endpoint

POST /api/auth/coins/deduct

Request

json
{
  "amount": 50,
  "reason": "prediction_wager",
  "reference_id": "event_123"
}

Response

json
{
  "message": "Coins deducted successfully",
  "data": {
    "previous_balance": 100,
    "amount_deducted": 50,
    "new_balance": 50,
    "transaction_id": "txn_abc123"
  }
}

Error Responses

  • 400 - Insufficient balance
  • 422 - Invalid amount or reason

Award Daily Coins

Claim daily coin bonus.

Endpoint

POST /api/auth/daily-coins

Response

json
{
  "message": "Daily coins awarded",
  "data": {
    "coins_awarded": 10,
    "new_balance": 110,
    "next_claim_at": "2024-01-16T00:00:00Z",
    "streak_days": 5,
    "streak_bonus": 5
  }
}

Error Responses

  • 400 - Already claimed today
  • 429 - Too many requests

Notes

  • Daily coins can be claimed once every 24 hours
  • Consecutive day streaks earn bonus coins
  • Claim resets at midnight UTC