Coins API

Manage LB coins with these API endpoints. Includes minting, transferring, burning, and querying balances.

Get User Wallet

GET/api/wallets/me

Fetch the authenticated user's wallet with balance and statistics.

JavaScript
fetch('https://api.loopingbinary.com/api/wallets/me', {
  headers: { 'Authorization': 'Bearer token' }
})

Response Example

{
  "id": "uuid",
  "userId": 1,
  "balance": 1234.56,
  "activeCoins": 1234.56,
  "totalReceived": 2000.00,
  "totalSent": 765.44,
  "createdAt": "2025-01-15T10:30:00Z"
}

Mint Coins

POST/api/admin/mint

Create new coins and add them to a user's wallet.

JavaScript
fetch('https://api.loopingbinary.com/api/admin/mint', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY',
    'Authorization': 'Bearer token'
  },
  body: JSON.stringify({
    userId: 1,
    amount: 100,
    reason: 'Bonus'
  })
})

Transfer Coins

POST/api/coins/transfer

Transfer coins from one user to another.

JavaScript
fetch('https://api.loopingbinary.com/api/coins/transfer', {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'Authorization': 'Bearer token'},
  body: JSON.stringify({
    toUserId: 2,
    amount: 50,
    reason: 'Payment'
  })
})

Burn Coins

POST/api/admin/burn

Remove coins from a user's wallet.

JavaScript
fetch('https://api.loopingbinary.com/api/admin/burn', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY',
    'Authorization': 'Bearer token'
  },
  body: JSON.stringify({
    userId: 1,
    amount: 20,
    reason: 'Violation'
  })
})

Transaction History

GET/api/coins/history

Get all coin transactions for the authenticated user.

JavaScript
fetch('https://api.loopingbinary.com/api/coins/history', {
  headers: { 'Authorization': 'Bearer token' }
})

Response Example

{
  "transactions": [
    {
      "id": 1,
      "type": "MINT",
      "amount": 100,
      "fromUserId": null,
      "toUserId": 1,
      "reason": "Initial bonus",
      "createdAt": "2025-10-02T12:00:00Z"
    },
    {
      "id": 2,
      "type": "TRANSFER",
      "amount": 50,
      "fromUserId": 1,
      "toUserId": 2,
      "reason": "Purchase subscription",
      "createdAt": "2025-10-02T13:00:00Z"
    }
  ]
}

Next Steps