SMBAI API Documentation

Welcome to the official SMBAI API documentation. Our RESTful API provides a powerful interface to interact with the SMBAI ecosystem, enabling you to build integrations, manage your account, view AI trading data, and handle wallet transactions.

Introduction

This documentation provides a comprehensive guide to all available endpoints, parameters, and response formats. All API endpoints are hosted under the base URL https://api.smbaifarm.ai/v1/. All requests return data in JSON format, and all request bodies must be sent as JSON with the Content-Type: application/json header.

Authentication

The SMBAI API uses API Keys to authenticate requests. You can view and manage your API keys in your SMBAI account settings. Authentication is performed via the Authorization header using the Bearer Token scheme.

Warning: Your API keys carry many privileges. Be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, etc.

Example Authentication Header

# All requests must include this header
Authorization: Bearer sk_live_1a2b3c4d5e6f7g8h9i0j...

Error Handling

The SMBAI API uses standard HTTP status codes to indicate the success or failure of a request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate a client-side error (e.g., failed authentication, missing parameters), and codes in the 5xx range indicate a server-side error.

All error responses will return a JSON body with a specific error code and message.

Example Error Response (400 Bad Request)

{
  ""error"": true,
  ""status"": 400,
  ""code"": "missing_parameter",
  ""message"": "Required parameter 'amount' is missing."
}

Rate Limiting

To ensure platform stability, the API employs rate limiting. By default, clients are limited to 120 requests per minute.

If you exceed this limit, you will receive an HTTP 429 Too Many Requests error. You can check the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers in the response to track your usage.

Versioning

The API is versioned via the URL. The current stable version is v1.

https://api.smbaifarm.ai/v1/

Breaking changes will be introduced under new version numbers (e.g., v2). We will provide advanced notice for any deprecations.

User Accounts

GET Fetch User by Username

Retrieves the details of a specific user account by their username. This provides non-sensitive account information and status.

https://api.smbaifarm.ai/v1/users/{username}

TRY IT OUT

Response
// Click "Send Request" to test the endpoint...

GET Get Current User

Retrieves the complete account details for the authenticated user.

/users/me

Example Request

curl -X GET "https://api.smbaifarm.ai/v1/users/me" \
     -H "Authorization: Bearer sk_live_..."

Example Response (200 OK)

{
  ""user_id"": "usr_1a2b3c",
  ""username"": "john_doe",
  ""email"": "john.doe@example.com",
  ""status"": "active",
  ""kyc_level"": 3,
  ""created_at"": "2025-04-01T10:30:00Z",
  ""has_2fa"": true
}

Deposits

POST Initiate UPI Deposit

Creates a new deposit request from a verified UPI source. This will generate a payment request to be completed by the user.

/deposits/initiate_upi

Request Body

Parameter Type Description
amount Integer Required. Amount in INR (e.g., 10000). Must be an integer.
upi_id String Required. The user's registered UPI ID (e.g., username@bank).

Example Request

curl -X POST "https://api.smbaifarm.ai/v1/deposits/initiate_upi" \
     -H "Authorization: Bearer sk_live_..." \
     -H "Content-Type: application/json" \
     -d '{
          ""amount"": 50000,
          ""upi_id"": "your-vpa@okbank"
        }'

Success Response (201 Created)

{
  ""deposit_id"": "dep_Z1Y2X3W4V5",
  ""status"": "pending",
  ""amount"": 50000,
  ""currency"": "INR",
  ""upi_link"": "upi://pay?pa=smbai@bank&pn=SMBAI&am=50000...",
  ""expires_at"": "2025-04-01T12:05:00Z"
}
Error 503: This is the error message that will be shown if the UPI gateway is down or experiences a server issue.

Error Response (503 Service Unavailable)

{
  ""error"": true,
  ""status"": 503,
  ""code"": "payment_gateway_offline",
  ""message"": "The UPI payment gateway is currently experiencing a server issue. Please try again after some time or check your UPI ID."
}

Error Response (422 Unprocessable Entity)

{
  ""error"": true,
  ""status"": 422,
  ""code"": "invalid_upi_id",
  ""message"": "Could not validate payment source. Please check your UPI ID or contact support."
}

GET Get Crypto Deposit Address

Retrieves the unique, permanent deposit address for a specific cryptocurrency.

/deposits/address

Query Parameters

Parameter Type Description
currency String Required. The currency symbol (e.g., SOL, USDT).
network String Required. The network (e.g., Solana, BSC).

Example Request

curl -X GET "https://api.smbaifarm.ai/v1/deposits/address?currency=USDT&network=Solana" \
     -H "Authorization: Bearer sk_live_..."

Success Response (200 OK)

{
  ""currency"": "USDT",
  ""network"": "Solana",
  ""address"": "8f2A...B5p9",
  ""memo"": null
}

AI Trading

GET Get All AI Strategies

Retrieves a list of all available AI trading strategies that your account has access to.

/ai/strategies

Example Response (200 OK)

{
  ""data"": [
    {
      ""id"": "strat_ai_main_v3",
      ""name"": "SMBAI Global Macro",
      ""description"": "Multi-market strategy (Forex, Crypto, Commodities).",
      ""risk_profile"": "medium",
      ""is_active"": true
    },
    {
      ""id"": "strat_sol_defi_v1",
      ""name"": "Solana DeFi Alpha",
      ""description"": "High-frequency strategy for Solana ecosystem assets.",
      ""risk_profile"": "high",
      ""is_active"": false
    }
  ]
}

GET Get Global AI Stats

Returns high-level, aggregated statistics for the main AI trading bot. This data is cached and updated every 60 seconds.

/ai/stats

Example Response (200 OK)

{
  ""strategy_id"": "strat_ai_main_v3",
  ""total_pnl_percent_all_time"": 14.72,
  ""24h_change_percent"": 0.12,
  ""total_aum_locked_usd"": 1542850.50,
  ""active_markets"": [
    "forex",
    "crypto",
    "commodities"
  ],
  ""status"": "operational"
}

POST Update AI Settings

Updates the user's AI trading settings, such as risk tolerance or strategy allocation.

/ai/settings

Request Body

Parameter Type Description
strategy_id String Required. The ID of the strategy to activate (e.g., strat_ai_main_v3).
risk_level String Required. Must be one of: low, medium, high.
max_drawdown_percent Integer Optional. A percentage (1-100) to set a personal stop-loss.

Example Response (200 OK)

{
  ""success"": true,
  ""message"": "AI settings updated successfully.",
  ""settings"": {
    ""active_strategy"": "strat_ai_main_v3",
    ""risk_level"": "medium",
    ""max_drawdown_percent"": 20
  }
}

Market Data

GET Get All Markets

Retrieves a list of all tradable markets and pairs supported by the AI.

/markets

Example Response (200 OK)

{
  ""forex"": [
    "EUR/USD",
    "GBP/USD",
    "USD/JPY",
    "USD/INR"
  ],
  ""crypto"": [
    "BTC/USD",
    "ETH/USD",
    "SOL/USD"
  ],
  ""commodities"": [
    "XAU/USD",
    "XAG/USD"
  ]
}

Security

GET Get Security Logs

Retrieves a paginated list of all security-related events for the user's account (logins, password changes, etc.).

/security/logs?page=1&limit=20

Example Response (200 OK)

{
  ""page"": 1,
  ""total_pages"": 5,
  ""logs"": [
    {
      ""event"": "login_success",
      ""ip_address"": "192.0.2.1",
      ""timestamp"": "2025-11-04T18:30:00Z"
    },
    {
      ""event"": "api_key_created",
      ""ip_address"": "192.0.2.1",
      ""timestamp"": "2025-11-04T18:00:00Z"
    }
  ]
}
More Endpoints: This documentation is a summary. Contact enterprise support for access to our WebSocket feeds and advanced trading endpoints.