API Integration
All HTTP calls are in src/services/api.ts.
Base URL: {REACT_APP_API_BASE_URL} — default http://localhost:3001/api
Auth header: Authorization: Bearer {agent_auth_token}
401 handling: Axios interceptor dispatches auth:unauthorized → logout.
Auth & Account
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| POST | /agent-auth/login | loginWithUsernameOrEmail | Agent login |
| POST | /agent-auth/verify-otp | verifyPortalLoginOtp | Verify login OTP |
| POST | /agent-auth/forgot-password/request-otp | requestForgotPasswordOtp | Forgot password step 1 |
| POST | /agent-auth/forgot-password/verify-otp | verifyForgotPasswordOtp | Forgot password step 2 |
| POST | /agent-auth/forgot-password/confirm | confirmForgotPasswordReset | Forgot password step 3 — set new password |
| PATCH | /agent/settings/two-factor | patchPortalTwoFactor | Enable/disable 2FA |
| PATCH | /agent/settings/low-balance-warning | patchAgentLowBalanceWarning | Low balance warning |
| POST | /agent/verify/send-otp | sendAgentVerificationOtp | Send agent verification OTP |
| POST | /agent/verify/confirm | confirmAgentVerificationOtp | Confirm agent OTP |
Dashboard & Credits
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/dashboard | fetchDashboard | Balances, shop/player stats |
| POST | /agent/credits/purchase | purchaseCredits | Buy credits (payment redirect) |
| POST | /agent/convert-balance-to-credits | convertBalanceToCredits | USD → credits |
| POST | /agent/credits/distribute | distributeCredits | Distribute credits to shop |
| POST | /agent/shops/:shopId/credits/withdraw | withdrawCreditsFromShop | Withdraw credits from shop to agent |
| GET | /agent/payments/zeroxprocessing/static-wallets | listZeroxStaticWallets | Static crypto wallet list |
| POST | /agent/payments/zeroxprocessing/static-wallets/init | initZeroxStaticWallets | Initialize crypto wallets |
Agent Transactions (Credit ledger)
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/transactions | fetchAgentTransactions | Credit ledger |
| GET | /agent/transactions/:id | fetchAgentCreditTransactionById | Transaction detail |
| GET | /agent/transactions/export | exportAgentWalletTransactions | CSV export |
Online Balance / USD Wallet
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/online-balance/ledger | fetchAgentOnlineBalanceLedger | USD ledger |
| GET | /agent/online-balance/ledger/:id | fetchAgentUsdLedgerEntryById | USD entry detail |
| GET | /agent/online-balance/ledger/export | exportAgentOnlineBalanceLedger | CSV export |
| GET | /agent/online-balance/withdrawals/otp/eligibility | fetchAgentWithdrawalOtpEligibility | Check OTP eligibility |
| POST | /agent/online-balance/withdrawals/otp/send | sendAgentWithdrawalOtp | Send OTP |
| POST | /agent/online-balance/withdrawals/otp/verify | verifyAgentWithdrawalOtp | Verify OTP |
| POST | /agent/online-balance/withdrawals | createAgentOnlineBalanceWithdrawal | Create USD withdrawal |
| GET | /agent/online-balance/withdrawals/fee | fetchAgentOnlineBalanceWithdrawalFee | Fee preview |
| GET | /agent/portal-withdrawal-limits | fetchAgentPortalWithdrawalLimits | Withdrawal limits |
Shops
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/shops | fetchShops | Shop list |
| GET | /agent/shops/stats | fetchAgentShopHierarchyStats | Hierarchy stats by date |
| GET | /agent/shops/:shopId | fetchShop | Shop detail |
| POST | /agent/shops | createShop | Create new shop |
| PATCH | /agent/shops/:shopId/suspend | suspendShop | Suspend shop |
| PATCH | /agent/shops/:shopId/unsuspend | unsuspendShop | Unsuspend shop |
| PATCH | /agent/shops/:shopId/cost | updateShopCost | Update cost rate |
| PATCH | /agent/shops/:shopId/name | updateShopName | Rename shop |
| PATCH | /agent/shops/:shopId/password | updateShopPassword | Change shop password |
| PATCH | /agent/shops/:shopId/popup-permissions | updateShopPopupPermission | Shop popup permission |
| GET | /agent/shops/:shopId/wallets | fetchAgentShopWallets | Shop wallets |
| GET | /agent/shops/:shopId/transactions | fetchAgentShopWalletTransactions | Shop credit ledger |
| GET | /agent/shops/:shopId/transactions/:id | fetchAgentShopCreditTransactionById | Shop credit tx detail |
| GET | /agent/shops/:shopId/online-balance/ledger | fetchAgentShopOnlineBalanceLedger | Shop USD ledger |
| GET | /agent/shops/:shopId/online-balance/ledger/:id | fetchAgentShopUsdLedgerEntryById | Shop USD entry detail |
| GET | /agent/shops/:shopId/game-mappings | fetchShopGameMappings | Game mappings |
| PUT | /agent/shops/:shopId/game-mappings | putShopGameMappings | Update game mappings |
Players
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/players | fetchAgentPlayers | Player list |
| GET | /agent/players/:playerId | fetchAgentPlayer | Player detail |
| GET | /agent/players/:playerId/transactions | fetchAgentPlayerTransactions | Player transaction history |
Provider Fees & Payment
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/provider-fees | fetchProviderFeeConfigs | Fee table (read-only) |
| GET | /payment/provider-fee-rate | getProviderFeeRate | Fee rate |
| GET | /payment/supported-methods | useSupportedZeroxMethods (hook) | Supported methods (public) |
Broadcasts & Popups
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/broadcasts | fetchAgentBroadcasts | Broadcast list |
| POST | /agent/broadcasts/:id/ack | ackAgentBroadcast | Acknowledge broadcast |
| POST | /agent/broadcasts | createAgentBroadcast | Send broadcast |
| GET | /agent/in-app-popups/unseen | fetchAgentInAppPopupsUnseen | Unseen popups |
| POST | /agent/in-app-popups/:id/seen | markAgentInAppPopupSeen | Mark as seen |
| POST | /agent/in-app-popups/:id/never-again | markAgentInAppPopupNeverAgain | Never show again |
| POST | /agent/in-app-popups | createAgentInAppPopup | Send popup |
Fraud & Games
| Method | Endpoint | Function | Purpose |
|---|---|---|---|
| GET | /agent/player-fraud-indicators | fetchAgentPlayerFraudIndicators | Player fraud (list) |
| GET | /agent/player-fraud-indicators/:id | fetchAgentPlayerFraudIndicatorDetail | Detail |
| GET | /agent/player-fraud-indicators/transaction/:id/profit-analysis | fetchAgentPlayerFraudWithdrawalAnalysis | Profit analysis |
| POST | /agent/player-fraud-indicators/:id/resolve | resolveAgentPlayerFraudIndicator | Resolve indicator |
| GET | /game-providers | fetchPublicGameProviders | Game provider list |