Closed Beta — Demo trading only. No real funds. Help us find bugs!
    BETA
    FeaturesPricingAbout
    Sign InJoin Beta

    BlockbotX API Reference

    Base URL: /api

    All endpoints return JSON. Authenticated endpoints require a valid JWT access token.


    Table of Contents

    • Authentication
    • Common Patterns
    • Rate Limiting
    • Error Handling
    • API Endpoints
      • Auth
      • Bots
      • Exchange
      • Trading
      • Market
      • Portfolio
      • DeFi
      • Dashboard
      • Marketplace
      • Templates
      • Notifications
      • Subscriptions
      • Referrals
      • User
      • Settings
      • Support
      • Help
      • Admin
      • System

    Authentication

    BlockbotX uses JWT-based authentication with httpOnly cookies.

    Token Lifecycle

    TokenStorageExpiryPurpose
    Access TokenhttpOnly cookie (accessToken)15 minutesAuthenticate API requests
    Refresh TokenhttpOnly cookie (refreshToken)7 daysObtain new access tokens

    How to Authenticate

    Option 1 -- Cookies (default for browser clients):

    The POST /api/auth/login endpoint sets httpOnly cookies automatically via Set-Cookie headers. Subsequent requests include these cookies automatically.

    Option 2 -- Authorization header (for programmatic clients):

    Authorization: Bearer <accessToken>
    

    The login response also returns the access token in the JSON body for clients that cannot use cookies.

    Token Refresh

    When the access token expires (15 min), call POST /api/auth/refresh. The refresh token cookie is read automatically and a new access token cookie is set in the response.

    Token Resolution Order

    1. Read accessToken from cookies
    2. If not found, read Authorization: Bearer <token> header
    3. Verify the token signature and check type === "access"
    4. Return { userId, email, role } or throw UnauthorizedError

    Common Patterns

    Request/Response Structure

    All routes use the asyncHandler() wrapper, which catches errors and returns standardized JSON responses.

    Success responses:

    { "data": { ... } }
    

    or domain-specific keys:

    { "bots": [...], "pagination": { ... } }
    

    Error responses:

    { "error": "Human-readable error message" }
    

    With validation errors:

    {
      "error": "Validation failed",
      "errors": [
        { "path": ["email"], "message": "Invalid email" }
      ]
    }
    

    Authentication Middleware

    All protected routes call getAuthUser(req) which returns:

    {
      userId: string;
      email: string;
      role: "user" | "admin" | "superadmin";
    }
    

    Role-Based Access

    The requireRole(userRole, requiredRole) function enforces a hierarchy:

    RoleLevelAccess
    user1Standard user endpoints
    admin2Admin panel, user management
    superadmin3System settings, destructive operations

    Input Validation

    All write endpoints validate input with Zod schemas. Invalid input throws BadRequestError (400) with the first validation issue message.


    Rate Limiting

    Rate limits are enforced per-IP using Redis-backed stores. In non-production environments, limits are relaxed for development convenience.

    TierLimitWindowKeyApplies To
    API100 requests15 minutesClient IPAll API routes (server-level)
    Auth5 requests15 minutesClient IPLogin, register, forgot-password, reset-password, 2FA
    Strict3 requests1 hourClient IPPassword reset, sensitive operations
    User1,000 requests1 hourJWT userId (fallback: IP)Per authenticated user across all endpoints

    Rate limit response (HTTP 429):

    { "error": "Too many requests. Please try again later." }
    

    Standard rate limit headers (RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset) are included in responses.


    Error Handling

    Error Classes

    ClassStatus CodeDefault Message
    BadRequestError400Bad Request
    UnauthorizedError401Unauthorized
    ForbiddenError403Forbidden
    NotFoundError404Not Found
    ConflictError409Conflict
    ValidationError422Validation Error
    InternalServerError500Internal Server Error

    Prisma Error Mapping

    Prisma CodeHTTP StatusMeaning
    P2002409Unique constraint violation
    P2025404Record not found
    P2003400Foreign key constraint failed

    In production, internal errors never expose stack traces or implementation details.


    API Endpoints

    Auth (11 routes)

    MethodPathDescriptionAuth Required
    POST/api/auth/registerCreate a new user accountNo
    POST/api/auth/loginAuthenticate and receive JWT tokensNo
    POST/api/auth/logoutClear session and revoke tokensYes
    POST/api/auth/refreshExchange refresh token for new access tokenNo (cookie)
    POST/api/auth/verify-emailVerify email address with tokenNo
    POST/api/auth/resend-verificationResend email verification linkNo
    POST/api/auth/forgot-passwordRequest a password reset emailNo
    POST/api/auth/reset-passwordReset password using reset tokenNo
    GET/api/auth/2fa/enableGet TOTP secret and QR code for setupYes
    POST/api/auth/2fa/enableConfirm 2FA setup with TOTP codeYes
    POST/api/auth/2fa/disableDisable 2FA for the accountYes
    POST/api/auth/2fa/verifyVerify a TOTP code (standalone check)Yes

    Example: Login (without 2FA)

    Request:

    POST /api/auth/login
    Content-Type: application/json
    
    {
      "email": "[email protected]",
      "password": "SecureP@ss123"
    }
    

    Response (200):

    Set-Cookie: accessToken=eyJ...; HttpOnly; Secure; SameSite=Lax; Max-Age=900; Path=/
    Set-Cookie: refreshToken=eyJ...; HttpOnly; Secure; SameSite=Strict; Max-Age=604800; Path=/
    
    {
      "message": "Login successful",
      "user": {
        "id": "clx1abc...",
        "email": "[email protected]",
        "firstName": "John",
        "lastName": "Doe",
        "emailVerified": true,
        "role": "user"
      },
      "accessToken": "eyJhbGciOiJIUzI1NiIs..."
    }
    

    Example: Login (with 2FA)

    Step 1 -- Initial login (2FA required):

    POST /api/auth/login
    Content-Type: application/json
    
    {
      "email": "[email protected]",
      "password": "SecureP@ss123"
    }
    

    Response (200):

    {
      "require2FA": true,
      "message": "Please provide your 2FA code"
    }
    

    Step 2 -- Submit with TOTP code:

    POST /api/auth/login
    Content-Type: application/json
    
    {
      "email": "[email protected]",
      "password": "SecureP@ss123",
      "totpToken": "123456"
    }
    

    Response (200): Same as the non-2FA login response above.

    Account Lockout

    After 5 consecutive failed login attempts, the account is locked for 30 minutes. The response during lockout:

    {
      "error": "Account is locked due to multiple failed login attempts. Please try again in 28 minute(s)."
    }
    

    Bots (28 routes)

    Core Bot CRUD

    MethodPathDescriptionAuth Required
    GET/api/botsList all bots (paginated, filterable)Yes
    POST/api/botsCreate a new botYes
    GET/api/bots/[id]Get bot detailsYes
    PUT/api/bots/[id]Update bot configurationYes
    DELETE/api/bots/[id]Delete a botYes
    POST/api/bots/[id]/startStart bot executionYes
    POST/api/bots/[id]/stopStop bot executionYes
    GET/api/bots/[id]/performanceGet bot performance metricsYes
    GET/api/bots/[id]/executionsList bot execution historyYes
    GET/api/bots/[id]/tradesList bot tradesYes
    POST/api/bots/[id]/backtestRun backtest on bot strategyYes
    GET/api/bots/[id]/balanceGet bot trading balanceYes
    GET/api/bots/[id]/profitGet bot profit/loss dataYes
    GET/api/bots/[id]/insightsGet AI-generated bot insightsYes

    DCA Bot

    MethodPathDescriptionAuth Required
    GET/api/bots/dcaList DCA botsYes
    POST/api/bots/dcaCreate a DCA botYes
    POST/api/bots/dca/[id]/executeManually trigger DCA executionYes
    GET/api/bots/dca/[id]/scheduleGet DCA scheduleYes
    GET/api/bots/dca/[id]/statisticsGet DCA bot statisticsYes

    Arbitrage Bot

    MethodPathDescriptionAuth Required
    GET/api/bots/arbitrageList arbitrage botsYes
    POST/api/bots/arbitrageCreate an arbitrage botYes
    GET/api/bots/arbitrage/[id]/opportunitiesList detected arbitrage opportunitiesYes
    GET/api/bots/arbitrage/[id]/statisticsGet arbitrage bot statisticsYes
    GET/api/bots/arbitrage/statisticsGet aggregate arbitrage statisticsYes
    GET/api/bots/arbitrage/profit-historyGet arbitrage profit historyYes

    Signal Bot

    MethodPathDescriptionAuth Required
    GET/api/bots/signalList signal botsYes
    POST/api/bots/signalCreate a signal botYes
    GET/api/bots/signal/[id]/providersList signal providers for botYes
    POST/api/bots/signal/[id]/send-signalSend a trading signalYes

    Pump Screener Bot

    MethodPathDescriptionAuth Required
    GET/api/bots/pumpList pump screener botsYes
    POST/api/bots/pumpCreate a pump screener botYes
    GET/api/bots/pump/[id]/detectionsList pump detections for botYes
    GET/api/bots/pump/[id]/statisticsGet pump bot statisticsYes
    GET/api/bots/pump/historicalGet historical pump detectionsYes
    GET/api/bots/pump/detections/recentGet most recent pump detectionsYes

    Example: Create Bot

    Request:

    POST /api/bots
    Content-Type: application/json
    
    {
      "name": "BTC Scalper",
      "type": "grid",
      "description": "Grid trading bot for BTC/USDT",
      "symbol": "BTCUSDT",
      "config": {
        "strategy": "grid",
        "paperTrading": true,
        "gridLevels": 10,
        "upperPrice": 70000,
        "lowerPrice": 60000
      },
      "riskSettings": {
        "maxPositionSize": 500,
        "stopLoss": 3,
        "takeProfit": 5,
        "initialBalance": 10000
      }
    }
    

    Response (201):

    {
      "bot": {
        "id": "clx2def...",
        "userId": "clx1abc...",
        "name": "BTC Scalper",
        "type": "grid",
        "description": "Grid trading bot for BTC/USDT",
        "status": "inactive",
        "paperTrading": true,
        "symbol": "BTCUSDT",
        "config": {
          "strategy": "grid",
          "paperTrading": true,
          "symbol": "BTCUSDT",
          "gridLevels": 10,
          "upperPrice": 70000,
          "lowerPrice": 60000
        },
        "riskSettings": {
          "maxPositionSize": 500,
          "stopLoss": 3,
          "takeProfit": 5,
          "initialBalance": 10000
        },
        "createdAt": "2026-03-03T10:00:00.000Z",
        "updatedAt": "2026-03-03T10:00:00.000Z"
      },
      "message": "Bot created successfully"
    }
    

    Example: List Bots

    Request:

    GET /api/bots?status=active&type=grid&page=1&limit=10
    

    Response (200):

    {
      "bots": [
        {
          "id": "clx2def...",
          "name": "BTC Scalper",
          "type": "grid",
          "status": "active",
          "paperTrading": true,
          "symbol": "BTCUSDT",
          "profitLoss": 245.50,
          "performance": {
            "totalTrades": 42,
            "totalExecutions": 156,
            "currentBalance": 10245.50,
            "totalProfitLoss": 245.50
          },
          "createdAt": "2026-03-01T10:00:00.000Z"
        }
      ],
      "pagination": {
        "page": 1,
        "limit": 10,
        "totalCount": 1,
        "totalPages": 1
      }
    }
    

    Exchange (9 routes)

    MethodPathDescriptionAuth Required
    GET/api/exchange/connectList exchange connectionsYes
    POST/api/exchange/connectConnect exchange (Binance or OKX)Yes
    DELETE/api/exchange/connect?id=<connectionId>Disconnect an exchangeYes
    GET/api/exchange/keysList API key metadata (no secrets)Yes
    POST/api/exchange/keysAdd exchange API keyYes
    DELETE/api/exchange/keys/[id]Delete an API keyYes
    POST/api/exchange/keys/testTest API key validityYes
    POST/api/exchange/test-connectionTest exchange connectivityYes
    GET/api/exchange/balanceGet primary exchange balanceYes
    GET/api/exchange/balancesGet all asset balancesYes
    GET/api/exchange/supportedList supported exchangesNo
    POST/api/exchange/syncSync exchange dataYes

    Supported exchanges: Binance, OKX

    Example: Connect Exchange

    Request:

    POST /api/exchange/connect
    Content-Type: application/json
    
    {
      "exchange": "binance",
      "apiKey": "abc123...",
      "apiSecret": "xyz789...",
      "isTestnet": false
    }
    

    For OKX, include the required passphrase field:

    {
      "exchange": "okx",
      "apiKey": "abc123...",
      "apiSecret": "xyz789...",
      "passphrase": "my-passphrase",
      "isTestnet": true
    }
    

    Response (201):

    {
      "message": "Exchange connected successfully",
      "connection": {
        "id": "clx3ghi...",
        "exchange": "binance",
        "isActive": true,
        "isTestnet": false,
        "createdAt": "2026-03-03T10:00:00.000Z",
        "updatedAt": "2026-03-03T10:00:00.000Z"
      }
    }
    

    If updating an existing connection, returns status 200 with "Exchange connection updated successfully".

    Notes:

    • API credentials are encrypted with AES-256-GCM before storage
    • The connection is tested against the exchange API before saving
    • One connection per exchange per user (@@unique([userId, exchange]))
    • OKX requires a passphrase; Binance does not

    Trading (7 routes)

    MethodPathDescriptionAuth Required
    POST/api/trading/orderPlace a new order (market or limit)Yes
    GET/api/trading/order/[id]Get order detailsYes
    DELETE/api/trading/order/[id]Cancel an open orderYes
    GET/api/trading/ordersList all orders (paginated)Yes
    GET/api/trading/balancesGet trading account balancesYes
    GET/api/trading/positionsList open positionsYes
    GET/api/trading/portfolioGet trading portfolio overviewYes
    GET/api/trading/historyGet trade historyYes

    Example: Place Order

    Request (market buy):

    POST /api/trading/order
    Content-Type: application/json
    
    {
      "symbol": "BTCUSDT",
      "side": "BUY",
      "type": "MARKET",
      "quoteOrderQty": "100"
    }
    

    Request (limit sell):

    POST /api/trading/order
    Content-Type: application/json
    
    {
      "exchange": "binance",
      "symbol": "ETHUSDT",
      "side": "SELL",
      "type": "LIMIT",
      "quantity": "0.5",
      "price": "3500",
      "timeInForce": "GTC"
    }
    

    Response (201):

    {
      "message": "Order placed successfully",
      "trade": {
        "id": "clx4jkl...",
        "symbol": "BTCUSDT",
        "side": "BUY",
        "type": "MARKET",
        "quantity": 0.00145,
        "price": 68965.52,
        "orderId": "1709452800000",
        "status": "FILLED",
        "executedAt": "2026-03-03T10:00:00.000Z"
      },
      "order": {
        "orderId": 1709452800000,
        "symbol": "BTCUSDT",
        "side": "BUY",
        "type": "MARKET",
        "status": "FILLED",
        "executedQty": 0.00145,
        "price": 68965.52,
        "transactTime": 1709452800000
      }
    }
    

    Notes:

    • If no exchange connection exists, the order executes in paper trading mode automatically
    • Paper trading supports: BTCUSDT, ETHUSDT, BNBUSDT, ADAUSDT, DOGEUSDT, XRPUSDT, DOTUSDT, SOLUSDT
    • LIMIT orders require price; MARKET orders accept quantity or quoteOrderQty
    • timeInForce options: GTC (Good Til Canceled), IOC (Immediate or Cancel), FOK (Fill or Kill)

    Market (12 routes)

    MethodPathDescriptionAuth Required
    GET/api/market/priceGet price for a symbol (query param)No
    GET/api/market/price/[symbol]Get price for a specific symbolNo
    GET/api/market/pricesGet prices for multiple symbolsNo
    GET/api/market/tickerGet 24h ticker for a symbolNo
    GET/api/market/tickersGet 24h tickers for all symbolsNo
    GET/api/market/historyGet OHLCV candlestick historyNo
    GET/api/market/searchSearch for trading pairsNo
    GET/api/market/statsGet market-wide statisticsNo
    GET/api/market/orderbookGet order book for a symbolNo
    GET/api/market/tradesGet recent trades for a symbolNo
    GET/api/market/watchlistGet user watchlistYes
    POST/api/market/watchlistAdd symbol to watchlistYes
    DELETE/api/market/watchlist/[symbol]Remove symbol from watchlistYes

    Portfolio (12 routes)

    MethodPathDescriptionAuth Required
    GET/api/portfolioGet portfolio overviewYes
    GET/api/portfolio/summaryGet portfolio summary metricsYes
    GET/api/portfolio/historyGet portfolio value historyYes
    GET/api/portfolio/performanceGet performance metrics (ROI, Sharpe, etc.)Yes
    GET/api/portfolio/analyticsGet detailed portfolio analyticsYes
    GET/api/portfolio/assetsGet all tracked assetsYes
    GET/api/portfolio/my-assetsGet user's held assetsYes
    GET/api/portfolio/allocationGet asset allocation breakdownYes
    GET/api/portfolio/compareCompare portfolio against benchmarksYes
    GET/api/portfolio/diversificationGet diversification score and analysisYes
    GET/api/portfolio/riskGet risk metrics (VaR, max drawdown, etc.)Yes
    GET/api/portfolio/exportExport portfolio data (CSV/JSON)Yes

    DeFi (21 routes)

    Protocols and Rates

    MethodPathDescriptionAuth Required
    GET/api/defi/protocolsList supported DeFi protocolsNo
    GET/api/defi/apy-ratesGet current APY rates across protocolsNo

    Staking

    MethodPathDescriptionAuth Required
    GET/api/defi/stakingList available staking optionsYes
    POST/api/defi/stakingCreate a staking positionYes
    GET/api/defi/staking/[positionId]Get staking position detailsYes
    DELETE/api/defi/staking/[positionId]Close a staking positionYes
    POST/api/defi/staking/syncSync staking data from chainYes
    GET/api/defi/staking-positionsList all staking positionsYes
    POST/api/defi/unstakeUnstake tokens from a positionYes

    Farming

    MethodPathDescriptionAuth Required
    GET/api/defi/farmList available yield farmsYes
    POST/api/defi/farmEnter a yield farmYes
    GET/api/defi/farm/positionsList farming positionsYes
    GET/api/defi/farm/analyticsGet farming analyticsYes
    POST/api/defi/farm/depositDeposit into a farmYes
    POST/api/defi/farm/withdrawWithdraw from a farmYes

    Liquidity

    MethodPathDescriptionAuth Required
    GET/api/defi/liquidityList liquidity poolsYes
    GET/api/defi/liquidity/positionsList LP positionsYes
    POST/api/defi/liquidity/addAdd liquidity to a poolYes
    POST/api/defi/liquidity/removeRemove liquidity from a poolYes

    Rewards and Portfolio

    MethodPathDescriptionAuth Required
    POST/api/defi/harvestHarvest pending rewardsYes
    GET/api/defi/rewardsGet accumulated rewardsYes
    GET/api/defi/portfolioGet DeFi portfolio overviewYes
    GET/api/defi/portfolio/analyticsGet DeFi portfolio analyticsYes

    Wallets

    MethodPathDescriptionAuth Required
    GET/api/defi/walletsList connected walletsYes
    POST/api/defi/walletsConnect a new walletYes
    GET/api/defi/wallets/[walletId]Get wallet detailsYes
    DELETE/api/defi/wallets/[walletId]Disconnect a walletYes

    Dashboard (4 routes)

    MethodPathDescriptionAuth Required
    GET/api/dashboardGet dashboard overview (balances, active bots, P&L)Yes
    GET/api/dashboard/performanceGet performance charts dataYes
    GET/api/dashboard/activityGet recent activity feedYes
    GET/api/dashboard/alertsGet active alerts and notificationsYes

    Marketplace (12 routes)

    MethodPathDescriptionAuth Required
    GET/api/marketplaceBrowse marketplace strategiesNo
    GET/api/marketplace/[id]Get strategy detailsNo
    POST/api/marketplace/[id]/purchasePurchase a strategyYes
    GET/api/marketplace/my-strategiesList user's published strategiesYes
    GET/api/marketplace/purchasedList purchased strategiesYes
    GET/api/marketplace/purchasesList purchase historyYes
    GET/api/marketplace/salesList sales history (for publishers)Yes
    GET/api/marketplace/strategiesList strategies (alternative endpoint)No
    GET/api/marketplace/strategies/[id]Get strategy detailsNo
    PUT/api/marketplace/strategies/[id]Update a published strategyYes
    DELETE/api/marketplace/strategies/[id]Unpublish a strategyYes
    POST/api/marketplace/strategies/[id]/purchasePurchase a strategyYes
    GET/api/marketplace/strategies/[id]/reviewsGet strategy reviewsNo
    POST/api/marketplace/strategies/[id]/reviewsSubmit a reviewYes
    POST/api/marketplace/strategies/[id]/favoriteFavorite a strategyYes
    DELETE/api/marketplace/strategies/[id]/favoriteUnfavorite a strategyYes

    Templates (7 routes)

    MethodPathDescriptionAuth Required
    GET/api/templatesList bot templatesNo
    POST/api/templatesCreate a templateYes
    GET/api/templates/[id]Get template detailsNo
    PUT/api/templates/[id]Update a templateYes
    DELETE/api/templates/[id]Delete a templateYes
    POST/api/templates/[id]/favoriteFavorite a templateYes
    DELETE/api/templates/[id]/favoriteUnfavorite a templateYes
    POST/api/templates/[id]/deployDeploy template as a new botYes
    GET/api/templates/categoriesList template categoriesNo

    Notifications (13 routes)

    MethodPathDescriptionAuth Required
    GET/api/notificationsList notifications (paginated)Yes
    GET/api/notifications/[id]Get notification detailsYes
    DELETE/api/notifications/[id]Delete a notificationYes
    POST/api/notifications/[id]/readMark notification as readYes
    GET/api/notifications/countGet unread notification countYes
    POST/api/notifications/mark-readMark selected notifications as readYes
    POST/api/notifications/read-allMark all notifications as readYes
    GET/api/notifications/preferencesGet notification preferencesYes
    PUT/api/notifications/preferencesUpdate notification preferencesYes
    GET/api/notifications/settingsGet notification settingsYes
    PUT/api/notifications/settingsUpdate notification settingsYes
    POST/api/notifications/subscribeSubscribe to push notificationsYes
    POST/api/notifications/testSend a test notificationYes
    POST/api/notifications/telegram/connectConnect Telegram accountYes
    POST/api/notifications/telegram/disconnectDisconnect Telegram accountYes
    POST/api/notifications/telegram/linkLink Telegram chat IDYes

    Subscriptions (10 routes)

    MethodPathDescriptionAuth Required
    GET/api/subscriptionsGet current subscriptionYes
    GET/api/subscriptions/plansList available plansNo
    POST/api/subscriptions/checkoutCreate Stripe checkout sessionYes
    POST/api/subscriptions/portalCreate Stripe customer portal sessionYes
    POST/api/subscriptions/cancelCancel subscriptionYes
    POST/api/subscriptions/reactivateReactivate cancelled subscriptionYes
    POST/api/subscriptions/upgradeUpgrade subscription planYes
    GET/api/subscriptions/payment-methodGet payment method detailsYes
    PUT/api/subscriptions/payment-methodUpdate payment methodYes
    GET/api/subscriptions/billing-historyGet billing/invoice historyYes
    GET/api/subscriptions/settingsGet subscription settingsYes
    PUT/api/subscriptions/settingsUpdate subscription settingsYes

    Referrals (9 routes)

    MethodPathDescriptionAuth Required
    GET/api/referralsGet referral program overviewYes
    GET/api/referrals/codeGet or generate referral codeYes
    GET/api/referrals/referred-usersList referred usersYes
    GET/api/referrals/statsGet referral statisticsYes
    GET/api/referrals/reward-tiersList reward tier structureYes
    GET/api/referrals/settingsGet referral settingsYes
    PUT/api/referrals/settingsUpdate referral settingsYes
    POST/api/referrals/applyApply a referral codeYes
    POST/api/referrals/claimClaim referral rewardsYes
    POST/api/referrals/withdrawWithdraw referral earningsYes

    User (11 routes)

    MethodPathDescriptionAuth Required
    GET/api/user/profileGet user profileYes
    PUT/api/user/profileUpdate user profileYes
    GET/api/user/accountGet account detailsYes
    DELETE/api/user/accountDelete user accountYes
    PUT/api/user/avatarUpload/update avatarYes
    DELETE/api/user/avatarRemove avatarYes
    POST/api/user/change-passwordChange passwordYes
    GET/api/user/preferencesGet user preferencesYes
    PUT/api/user/preferencesUpdate user preferencesYes
    GET/api/user/activityGet user activity logYes
    GET/api/user/statsGet user statisticsYes
    GET/api/user/sessionsList active sessionsYes
    DELETE/api/user/sessions/[id]Revoke a sessionYes
    GET/api/user/devicesList known devicesYes
    DELETE/api/user/devices/[id]Remove a known deviceYes

    Settings (8 routes)

    MethodPathDescriptionAuth Required
    GET/api/settingsGet all settingsYes
    PUT/api/settingsUpdate general settingsYes
    GET/api/settings/securityGet security settingsYes
    PUT/api/settings/securityUpdate security settingsYes
    GET/api/settings/notificationsGet notification settingsYes
    PUT/api/settings/notificationsUpdate notification settingsYes
    GET/api/settings/displayGet display/theme settingsYes
    PUT/api/settings/displayUpdate display/theme settingsYes
    GET/api/settings/tradingGet trading preferencesYes
    PUT/api/settings/tradingUpdate trading preferencesYes
    GET/api/settings/privacyGet privacy settingsYes
    PUT/api/settings/privacyUpdate privacy settingsYes
    POST/api/settings/data-exportRequest data export (GDPR)Yes
    POST/api/settings/resetReset settings to defaultsYes

    Support (7 routes)

    MethodPathDescriptionAuth Required
    GET/api/support/ticketsList support ticketsYes
    POST/api/support/ticketsCreate a support ticketYes
    GET/api/support/tickets/[id]Get ticket detailsYes
    PUT/api/support/tickets/[id]Update a ticketYes
    GET/api/support/tickets/[id]/messagesList ticket messagesYes
    POST/api/support/tickets/[id]/messagesSend a message on ticketYes
    PATCH/api/support/tickets/[id]/closeClose a ticketYes
    PATCH/api/support/tickets/[id]/reopenReopen a closed ticketYes
    GET/api/support/categoriesList support categoriesNo
    GET/api/support/faqList frequently asked questionsNo

    Help (6 routes)

    MethodPathDescriptionAuth Required
    GET/api/help/articlesList help articlesNo
    GET/api/help/articles/[id]Get article detailsNo
    GET/api/help/categoriesList help categoriesNo
    GET/api/help/faqsList FAQsNo
    GET/api/help/faqs/[id]Get FAQ detailsNo
    GET/api/help/searchSearch help contentNo

    Admin (35+ routes)

    All admin routes require admin or superadmin role.

    Users

    MethodPathDescriptionAuth Required
    GET/api/admin/usersList all users (paginated, searchable)Admin
    GET/api/admin/users/[id]Get user detailsAdmin
    PUT/api/admin/users/[id]Update user recordAdmin
    POST/api/admin/users/[id]/banBan a userAdmin
    POST/api/admin/users/[id]/unbanUnban a userAdmin
    POST/api/admin/users/[id]/suspendSuspend a user (with duration)Admin
    POST/api/admin/users/[id]/disableDisable a user accountAdmin
    POST/api/admin/users/[id]/reactivateReactivate a disabled accountAdmin
    POST/api/admin/users/[id]/lockLock a user accountAdmin
    POST/api/admin/users/[id]/unlockUnlock a user accountAdmin
    POST/api/admin/users/[id]/roleChange user roleAdmin
    POST/api/admin/users/[id]/disable-2faDisable user's 2FAAdmin
    POST/api/admin/users/[id]/force-password-resetForce password reset on next loginAdmin
    POST/api/admin/users/[id]/revoke-sessionsRevoke all user sessionsAdmin
    GET/api/admin/users/[id]/notesGet admin notes for userAdmin
    POST/api/admin/users/[id]/notesAdd admin note to userAdmin

    Bots

    MethodPathDescriptionAuth Required
    GET/api/admin/botsList all bots across usersAdmin
    POST/api/admin/bots/[id]/stopForce-stop a botAdmin

    Subscriptions

    MethodPathDescriptionAuth Required
    GET/api/admin/subscriptionsList all subscriptionsAdmin
    GET/api/admin/subscriptions/[id]Get subscription detailsAdmin
    POST/api/admin/subscriptions/[id]/cancelCancel a user's subscriptionAdmin
    POST/api/admin/subscriptions/grantGrant a subscription to userAdmin
    GET/api/admin/subscriptions/statsGet subscription statisticsAdmin

    Tickets

    MethodPathDescriptionAuth Required
    GET/api/admin/ticketsList all support ticketsAdmin
    GET/api/admin/tickets/[id]Get ticket detailsAdmin
    PUT/api/admin/tickets/[id]Update ticket (assign, priority, status)Admin
    GET/api/admin/tickets/[id]/messagesList ticket messagesAdmin
    POST/api/admin/tickets/[id]/messagesReply to a ticketAdmin

    Security

    MethodPathDescriptionAuth Required
    GET/api/admin/security/statsGet security statisticsAdmin
    GET/api/admin/security/eventsList security eventsAdmin
    GET/api/admin/security/login-historyGet login history across usersAdmin
    GET/api/admin/security/blocked-ipsList blocked IP addressesAdmin
    POST/api/admin/security/blocked-ipsBlock an IP addressAdmin
    DELETE/api/admin/security/blocked-ips/[id]Unblock an IP addressAdmin

    Help CMS

    MethodPathDescriptionAuth Required
    GET/api/admin/help/articlesList help articlesAdmin
    POST/api/admin/help/articlesCreate help articleAdmin
    GET/api/admin/help/articles/[id]Get article detailsAdmin
    PUT/api/admin/help/articles/[id]Update articleAdmin
    DELETE/api/admin/help/articles/[id]Delete articleAdmin
    GET/api/admin/help/categoriesList help categoriesAdmin
    POST/api/admin/help/categoriesCreate help categoryAdmin
    GET/api/admin/help/categories/[id]Get category detailsAdmin
    PUT/api/admin/help/categories/[id]Update categoryAdmin
    DELETE/api/admin/help/categories/[id]Delete categoryAdmin
    GET/api/admin/help/faqsList FAQsAdmin
    POST/api/admin/help/faqsCreate FAQAdmin
    GET/api/admin/help/faqs/[id]Get FAQ detailsAdmin
    PUT/api/admin/help/faqs/[id]Update FAQAdmin
    DELETE/api/admin/help/faqs/[id]Delete FAQAdmin

    System

    MethodPathDescriptionAuth Required
    GET/api/admin/overviewGet admin dashboard overviewAdmin
    GET/api/admin/settingsGet system settingsAdmin
    PUT/api/admin/settingsUpdate system settingsSuperadmin
    GET/api/admin/systemGet system health and metricsAdmin

    System (6 routes)

    MethodPathDescriptionAuth Required
    GET/api/healthHealth check (returns { status: "ok" })No
    GET/api/csrfGet CSRF tokenNo
    GET/api/analyticsGet public analytics dataNo
    GET/api/logs/executionsGet bot execution logsYes
    GET/api/system/statusGet system status and uptimeNo
    POST/api/webhooks/stripeStripe webhook receiver (HMAC-SHA256 verified)No (signature)

    Stripe Webhook: This endpoint uses stripe.webhooks.constructEvent() for cryptographic signature verification. It requires the raw request body (req.text()) and validates against STRIPE_WEBHOOK_SECRET. No JWT authentication is needed; security is provided by the Stripe HMAC-SHA256 signature.


    Appendix: Response Status Codes

    CodeMeaningWhen Used
    200OKSuccessful GET, PUT, PATCH, DELETE
    201CreatedSuccessful POST that creates a resource
    400Bad RequestValidation failure, invalid input
    401UnauthorizedMissing/invalid/expired token
    403ForbiddenInsufficient role or banned account
    404Not FoundResource does not exist
    409ConflictDuplicate resource (unique constraint)
    422Unprocessable EntityZod schema validation failure
    429Too Many RequestsRate limit exceeded
    500Internal Server ErrorUnexpected server error

    AI-powered crypto trading platform in closed beta. 8 bot engines, DeFi integration, and demo trading.

    Product

    • Features
    • Pricing
    • About
    • Join Beta

    Resources

    • Documentation
    • API Reference
    • Support
    • Blog
    • Status

    Legal

    • Terms of Service
    • Privacy Policy
    • Disclaimer

    © 2026 BlockbotX. All rights reserved.

    Built with AI · Powered by Next.js