# Node.js API Reference Documentation

**Base Node API URL:** `https://app.edistry.com:3000/api`  
**Port:** `3000`  

---

## 1. Authentication & Profile Routes (`auth.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 1 | `/api/register` | `POST` | User registration |
| 2 | `/api/resendotp` | `POST` | Resend OTP |
| 3 | `/api/register-otp-verification` | `POST` | Verify registration OTP |
| 4 | `/api/login` | `POST` | User login |
| 5 | `/api/login-pin-verification` | `POST` | Verify login PIN |
| 6 | `/api/update-profile` | `POST` | Update user profile info |
| 7 | `/api/forgot-pin` | `POST` | Request forgot PIN OTP |
| 8 | `/api/forgot-pin-otp-verification` | `POST` | Verify forgot PIN OTP |
| 9 | `/api/forgot-pin-change` | `POST` | Set new PIN |
| 10 | `/api/user-details` | `POST` | Get user details |
| 11 | `/api/user-account-delete` | `POST` | Delete user account |
| 12 | `/api/user-logout` | `POST` | User logout |
| 13 | `/api/get-account-verification` | `POST` | Fetch KYC/Account verification status |
| 14 | `/api/email-verification-otp-send` | `POST` | Send email verification OTP |
| 15 | `/api/email-verification-otp` | `POST` | Verify email OTP |
| 16 | `/api/user-change-pin` | `POST` | Change user PIN |
| 17 | `/api/bank-verification` | `POST` | Verify user bank account |
| 18 | `/api/user-details-change` | `POST` | Update user profile details (with avatar upload) |

---

## 2. Trading Engine Routes (`trading_engine.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 19 | `/api/exit-position` | `POST` | Exit an open trading position |
| 20 | `/api/cancel-order` | `POST` | Cancel a pending order |
| 21 | `/api/combined-margin-order` | `POST` | Execute combined margin order |
| 22 | `/api/contest-order` | `POST` | Place Equity contest order |
| 23 | `/api/crypto-contest-order` | `POST` | Place Crypto contest order |
| 24 | `/api/modify-order` | `POST` | Modify order parameters |
| 25 | `/api/nfo-contest-order` | `POST` | Place F&O (NFO) contest order |
| 26 | `/api/trading-terminal` | `POST` | Fetch trading terminal main summary data |
| 27 | `/api/trading-performance` | `POST` | Get trading performance metrics |
| 28 | `/api/trading-terminal-segment-details` | `POST` | Get segment breakdown details for trading terminal |

---

## 3. Stock & Watchlist Management Routes (`stock_management.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 29 | `/api/add-order` | `POST` | Add standard order |
| 30 | `/api/get-order` | `POST` | Get specific order details |
| 31 | `/api/get-orders` | `POST` | Fetch user active/pending orders |
| 32 | `/api/get-order-history` | `POST` | Get past order history |
| 33 | `/api/get-position` | `POST` | Fetch open positions |
| 34 | `/api/get-close-position` | `POST` | Fetch closed positions |
| 35 | `/api/get-trade-history` | `POST` | Get executed trade history |
| 36 | `/api/get-watchlist` | `POST` | Fetch user watchlist |
| 37 | `/api/order-change-watchlist` | `POST` | Reorder stocks in watchlist |
| 38 | `/api/add-watchlist` | `POST` | Add stock to watchlist |
| 39 | `/api/remove-watchlist` | `POST` | Remove stock from watchlist |
| 40 | `/api/load-watchlist` | `POST` | Load watchlist tokens and data |
| 41 | `/api/stock-list` | `POST` | Fetch available stock list |
| 42 | `/api/search-stock-list` | `POST` | Search stocks by name or symbol |
| 43 | `/api/last-market-price` | `POST` | Get last traded price (LTP) |
| 44 | `/api/get-market-stock` | `POST` | Get stock market detail |
| 45 | `/api/get-market-crypto-stock` | `POST` | Get crypto market stock detail |
| 46 | `/api/get-market-indices` | `POST` | Get market indices |
| 47 | `/api/get-top-indices` | `POST` | Get top market indices |
| 48 | `/api/get-marketdata` | `POST` | Get market data feed |

---

## 4. Contest Routes (`contest.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 49 | `/api/upcoming-contest` | `POST` | Get list of upcoming contests |
| 50 | `/api/my-contest` | `POST` | Get joined active contests |
| 51 | `/api/my-past-contest` | `POST` | Get past completed contests |
| 52 | `/api/contest-detail` | `POST` | Get contest details |
| 53 | `/api/contest-detail-reward` | `POST` | Get contest reward breakdown |
| 54 | `/api/join-contest` | `POST` | Join a contest |
| 55 | `/api/check-portfolio-join` | `POST` | Check portfolio eligibility for contest |
| 56 | `/api/contest-reward` | `POST` | Fetch claimed contest rewards |

---

## 5. Wallet, Plans & Payment Routes (`wallet_and_plans.routes.js` & Payment Webviews)
*Prefix:* `/api/` & `/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 57 | `/api/user-get-transaction` | `POST` | Get wallet transaction history |
| 58 | `/api/user-withdrawal-request` | `POST` | Submit balance withdrawal request |
| 59 | `/api/get-topup-plans` | `POST` | Get wallet top-up plan list |
| 60 | `/api/topup-tnx` | `POST` | Process top-up transaction |
| 61 | `/api/get-plans` | `POST` | Get membership/subscription plans |
| 62 | `/api/user-get-plans` | `POST` | Get user active plans |
| 63 | `/api/sb-plan-join` | `POST` | Join subscription plan |
| 64 | `/api/sb-plan-renew` | `POST` | Renew subscription plan |
| 65 | `/api/get-plan-history` | `POST` | Fetch history of purchased plans |
| 66 | `/api/sb-my-claimed-offers` | `POST` | Get user claimed offer details |
| 67 | `/pay/:id` | `GET/POST` | Razorpay plan payment webview |
| 68 | `/topup-pay/:id` | `GET/POST` | Razorpay top-up payment webview |

---

## 6. Content & Miscellaneous Routes (`content_and_misc.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 69 | `/api/how-to-play` | `POST` | Fetch how-to-play guides |
| 70 | `/api/course-progress-get` | `POST` | Get course completion progress |
| 71 | `/api/course-progress-update` | `POST` | Update course progress |
| 72 | `/api/learn-stocks` | `POST` | List learning modules / stock articles |
| 73 | `/api/learn-stock-single` | `POST` | Fetch single learn stock detail |
| 74 | `/api/offerzone` | `POST` | Get available offerzone deals |
| 75 | `/api/user-get-offers` | `POST` | Fetch user eligible offers |
| 76 | `/api/sb-offer-claim` | `POST` | Claim an offer |
| 77 | `/api/get-holiday` | `POST` | Get trading market holiday list |
| 78 | `/api/user-setting` | `POST` | Get user application settings |
| 79 | `/api/about` | `POST` | Get about app information |
| 80 | `/api/app-update` | `POST` | Check app version / force update status |
| 81 | `/api/user-support` | `POST` | Submit customer support ticket (with screenshot upload) |

---

## 7. Social, Performance & Notifications Routes (`social_and_performance.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 82 | `/api/get-dashboard` | `POST` | Get user main dashboard data |
| 83 | `/api/user-get-performance` | `POST` | Get trading performance report |
| 84 | `/api/user-get-statistics` | `POST` | Get user trading statistics |
| 85 | `/api/get-leaderboard` | `POST` | Get global leaderboard rankings |
| 86 | `/api/get-notification` | `POST` | Get user notifications list |
| 87 | `/api/notification-read` | `POST` | Mark notification as read |
| 88 | `/api/user-rate-app` | `POST` | Submit user app rating |

---

## 8. Stock NFO Routes (`stock_nfo.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 89 | `/api/nfo-stock-list` | `GET` | Get NFO (Futures & Options) stock list |
| 90 | `/api/nfo-stock-tokens` | `GET` | Get instrument tokens for NFO stocks |

---

## 9. Admin & Utility Routes (`admin.routes.js`)
*Prefix:* `/api/`

| # | Endpoint | Method | Description |
|---|---|---|---|
| 91 | `/api/admin/balance-settlement/start` | `POST` | Trigger automated balance settlement task |
| 92 | `/api/admin/balance-settlement/status` | `GET` | Get status of active settlement task |
| 93 | `/api/admin/balance-settlement/clean-logs` | `POST` | Clean settlement log files |
| 94 | `/api/admin/zerodha-authenticate` | `POST` | Trigger Zerodha token auto-authentication |
| 95 | `/api/admin/concurrency-test/start` | `POST` | Start API load/concurrency stress test |
| 96 | `/api/admin/concurrency-test/logs` | `GET` | Fetch logs of concurrency test |
