### GET /users/get-referral-code Source: https://apidocs.nobitex.ir/deprecated Retrieves the default referral code for an authenticated user. This endpoint is deprecated and may be non-functional in current or future versions of Nobitex. Use this endpoint to get the referral code, referred users count, and referral fee information. ```APIDOC ## GET /users/get-referral-code ### Description Retrieves the default referral code for an authenticated user along with referral statistics including referred users count and total referral fees. ### Method GET ### Endpoint /users/get-referral-code ### Base URL https://apiv2.nobitex.ir ### Authentication Required - Token-based authentication ### Headers - **Authorization** (string) - Required - Token authentication header in format: "Token yourTOKENhereHEX0000000000" ### Request Example ``` curl 'https://apiv2.nobitex.ir/users/get-referral-code' \ -H "Authorization: Token yourTOKENhereHEX0000000000" ``` ### Response #### Success Response (200 OK) - **status** (string) - Status indicator, returns "ok" on success - **referralCode** (string) - The default referral code for the user - **referredUsersCount** (integer) - Total number of users who used this referral code - **referralFeeTotalCount** (integer) - Total count of referral fee transactions - **referralFeeTotal** (number) - Total accumulated referral fees ### Response Example ```json { "status": "ok", "referredUsersCount": 0, "referralCode": "84440", "referralFeeTotalCount": 0, "referralFeeTotal": 0 } ``` ### Deprecation Notice ⚠️ **DEPRECATED** - This endpoint is considered legacy due to structural or functional changes. It should no longer be used in new implementations. This endpoint may be disabled or non-responsive in current or future versions of the Nobitex API. ``` -------------------------------- ### Place Margin Order (httpie) Source: https://apidocs.nobitex.ir/index Example of how to place a margin order using httpie. This command-line tool simplifies sending HTTP requests. ```bash http POST https://apiv2.nobitex.ir/margin/orders/add \ srcCurrency=btc&dstCurrency=rls&amount=0.01&price=6400000000 ``` -------------------------------- ### Fetch System Settings using HTTP GET Source: https://apidocs.nobitex.ir/index This code snippet illustrates fetching system settings via an HTTP GET request. It targets the same Nobitex API endpoint as the cURL example. This method is suitable for environments where cURL is not available or preferred. ```http http GET https://apiv2.nobitex.ir/v2/options ``` -------------------------------- ### Get Default Referral Code - Nobitex API Source: https://apidocs.nobitex.ir/deprecated Retrieves the default referral code for an authenticated user from the Nobitex API. This endpoint is deprecated and should no longer be used. Requires a valid authorization token for authentication and returns referral code details including referred users count and total referral fees. ```bash curl 'https://apiv2.nobitex.ir/users/get-referral-code' \ -H "Authorization: Token yourTOKENhereHEX0000000000" ``` ```http POST https://apiv2.nobitex.ir/users/get-referral-code ``` ```json { "status": "ok", "referredUsersCount": 0, "referralCode": "84440", "referralFeeTotalCount": 0, "referralFeeTotal": 0 } ``` -------------------------------- ### GET /v2/options Source: https://apidocs.nobitex.ir/index Retrieve system settings and configurations, including active currencies, trading limits, and precision settings. ```APIDOC ## GET /v2/options ### Description This endpoint retrieves system settings and configurations from Nobitex. It provides information such as active cryptocurrencies, minimum order amounts, withdrawal limits, and precision settings for various markets. ### Method GET ### Endpoint /v2/options ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl 'https://apiv2.nobitex.ir/v2/options' ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request, typically "ok". - **features** (object) - Contains feature-related settings. - **fcmEnabled** (boolean) - Status of FCM (Firebase Cloud Messaging) enablement. - **chat** (string) - Type of chat support (e.g., "livechat"). - **walletsToNet** (boolean) - Status of wallets to net conversion. - **autoKYC** (boolean) - Status of automatic KYC (Know Your Customer) verification. - **enabledFeatures** (array of strings) - List of enabled features. - **betaFeatures** (array of strings) - List of beta features. - **coins** (array of objects) - Details for each cryptocurrency. - **coin** (string) - The symbol of the cryptocurrency. - **name** (string) - The full name of the cryptocurrency. - **defaultNetwork** (string) - The default network for the cryptocurrency. - **displayPrecision** (string) - The precision for displaying the cryptocurrency value. - **networkList** (object) - Network-specific settings for the cryptocurrency. - **[NetworkName]** (object) - Settings for a specific network. - **addressRegex** (string) - Regular expression for validating deposit addresses. - **coin** (string) - The symbol of the cryptocurrency for this network. - **depositEnable** (boolean) - Whether deposits are enabled for this network. - **isDefault** (boolean) - Whether this is the default network. - **minConfirm** (integer) - Minimum confirmations required for deposits. - **name** (string) - The name of the network. - **network** (string) - The identifier of the network. - **withdrawEnable** (boolean) - Whether withdrawals are enabled for this network. - **withdrawFee** (string) - The withdrawal fee for this network. - **withdrawIntegerMultiple** (string) - The multiple for integer withdrawal amounts. - **withdrawMax** (string) - The maximum withdrawal amount. - **withdrawMin** (string) - The minimum withdrawal amount. - **stdName** (string) - The standard name or symbol for the cryptocurrency. - **nobitex** (object) - General Nobitex system configurations. - **allCurrencies** (array of strings) - Symbols of all available currencies in the market. - **activeCurrencies** (array of strings) - Symbols of main and level-one currencies. - **xchangeCurrencies** (array of strings) - Symbols of exchange currencies. - **topCurrencies** (array of strings) - Symbols of top market currencies. - **testingCurrencies** (array of strings) - Symbols of currencies under development and testing. - **withdrawLimits** (object) - Withdrawal limits at different levels. - **normal** (object) - Normal withdrawal limits. - **dailyCoin** (string) - Daily coin withdrawal limit. - **dailyRial** (string) - Daily Rial withdrawal limit. - **dailySummation** (string) - Daily total withdrawal summation limit. - **monthlySummation** (string) - Monthly total withdrawal summation limit. - **level0** (object) - Level 0 withdrawal limits. - **dailyCoin** (string) - Daily coin withdrawal limit. - **dailyRial** (string) - Daily Rial withdrawal limit. - **dailySummation** (string) - Daily total withdrawal summation limit. - **monthlySummation** (string) - Monthly total withdrawal summation limit. - **[LevelID]** (object) - Withdrawal limits for a specific KYC level. - **dailyCoin** (string) - Daily coin withdrawal limit. - **dailyRial** (string) - Daily Rial withdrawal limit. - **dailySummation** (string) - Daily total withdrawal summation limit. - **monthlySummation** (string) - Monthly total withdrawal summation limit. - **minOrders** (object) - Minimum order amounts for different currencies. - **[CurrencySymbol]** (string) - Minimum order amount for the specified currency. - **amountPrecisions** (object) - Decimal precision for amounts in different markets. - **[MarketPair]** (string) - Decimal precision for amounts in the specified market pair (e.g., "BTCIRT"). - **pricePrecisions** (object) - Decimal precision for prices in different markets. - **[MarketPair]** (string) - Decimal precision for prices in the specified market pair (e.g., "BTCIRT"). - **giftCard** (object) - Gift card related settings. - **physicalFee** (string) - Fee for physical gift cards. #### Response Example ```json { "status": "ok", "features": { "fcmEnabled": true, "chat": "livechat", "walletsToNet": false, "autoKYC": true, "enabledFeatures": [ "PriceAlert", "StopLoss", "GiftCard", "OCO" ], "betaFeatures": [] }, "coins": [ { "coin": "rls", "name": "Rial", "defaultNetwork": "FIAT_MONEY", "displayPrecision": "10", "networkList": { "FIATMONEY": { "addressRegex": "", "coin": "rls", "depositEnable": true, "isDefault": true, "minConfirm": 0, "name": "FIAT", "network": "FIAT_MONEY", "withdrawEnable": true, "withdrawFee": "4_000_0.00000000", "withdrawIntegerMultiple": "0.10000000", "withdrawMax": "500_000_000_0.00000000", "withdrawMin": "15_000_0.00000000" } }, "stdName": "﷼" } ], "nobitex": { "allCurrencies": [ "rls", "btc" ], "activeCurrencies": [ "rls", "btc", "eth", "ltc" ], "xchangeCurrencies": [], "topCurrencies": [ "btc", "eth", "usdt", "doge", "shib", "trx", "ada", "ltc", "xrp" ], "testingCurrencies": [ "hbar" ], "withdrawLimits": { "normal": { "dailyCoin": "0", "dailyRial": "0", "dailySummation": "0", "monthlySummation": "0" }, "level0": { "dailyCoin": "0", "dailyRial": "0", "dailySummation": "0", "monthlySummation": "0" }, "44": { "dailyCoin": "1000000000", "dailyRial": "200000000", "dailySummation": "1000000000", "monthlySummation": "15000000000" } }, "minOrders": { "rls": "3000000", "usdt": "11", "2": "3000000", "13": "11" }, "amountPrecisions": { "BTCIRT": "0.000001", "BTCUSDT": "0.000001", "ETHIRT": "0.00001" }, "pricePrecisions": { "BTCIRT": "10", "BTCUSDT": "0.01", "ETHIRT": "10" }, "giftCard": { "physicalFee": "360000" } } } ``` ``` -------------------------------- ### Install Centrifuge SDK Source: https://apidocs.nobitex.ir/index Install the Centrifuge SDK package using npm for WebSocket communication. ```bash npm install centrifuge ``` -------------------------------- ### Example POST Request with API Headers Source: https://apidocs.nobitex.ir/index Provides an example of a POST request to the /orders/cancel-old endpoint, including the necessary Nobitex API headers: Nobitex-Key, Nobitex-Signature, and Nobitex-Timestamp. This demonstrates how to structure a request for API interaction. ```curl curl -X POST "https://apiv2.nobitex.ir/orders/cancel-old" \ -H "Content-Type: application/json" \ -H "Nobitex-Key: " \ -H "Nobitex-Signature: " \ -H "Nobitex-Timestamp: " \ -d '{ \ "order": 27032, \ "status": "canceled" \ }' ``` -------------------------------- ### POST /market/orders/cancel-old - Example Request Source: https://apidocs.nobitex.ir/index Example of authenticating and making a request to cancel orders. Demonstrates proper header construction with Nobitex-Key, Nobitex-Signature, and Nobitex-Timestamp. ```APIDOC ## POST /market/orders/cancel-old ### Description Cancel old orders with proper Ed25519 authentication headers. ### Method POST ### Endpoint https://apiv2.nobitex.ir/market/orders/cancel-old ### Request Headers - **Content-Type**: application/json - **Nobitex-Key**: - **Nobitex-Signature**: - **Nobitex-Timestamp**: - **User-Agent**: TraderBot/XXXXX (recommended) ### Request Body - **order** (integer) - Required - Order ID to cancel - **status** (string) - Required - Status value (e.g., "canceled") ### Request Example ``` curl -X POST "https://apiv2.nobitex.ir/market/orders/cancel-old" \ -H "Content-Type: application/json" \ -H "Nobitex-Key: " \ -H "Nobitex-Signature: " \ -H "Nobitex-Timestamp: " \ -d '{ "order": 27032, "status": "canceled" }' ``` ``` -------------------------------- ### Example Response for All Market Order Books Source: https://apidocs.nobitex.ir/index An example JSON response when fetching order books for all markets. It includes the status and nested objects for each market symbol (e.g., BTCIRT, USDTIRT), containing their respective last update times, asks, and bids. ```json { "status": "ok", "BTCIRT": { "lastUpdate": 1644991756704, "asks": [ ["1476091000", "1.016"], ["1479700000", "0.2561"] ], "bids": [ ["1470001120", "0.126571"], ["1470000000", "0.818994"] ] }, "USDTIRT": { "lastUpdate": 1644991767392, "asks": [ ["277990", "6688.3"], ["278000", "28185.03"] ], "bids": [ ["277960", "119.31"], ["271240", "1079.75"] ] } } ``` -------------------------------- ### Fetch System Settings using cURL Source: https://apidocs.nobitex.ir/index This code snippet demonstrates how to retrieve system settings using a cURL command. It sends a GET request to the Nobitex API's v2 options endpoint. No authentication token or input parameters are required for this request. ```bash curl 'https://apiv2.nobitex.ir/v2/options' ``` -------------------------------- ### Nobitex API Overview Source: https://apidocs.nobitex.ir/index This section provides an overview of the Nobitex API, including general information, authentication, market data, user information, trading, withdrawals, WebSockets, security, and more. ```APIDOC ## Nobitex API Documentation Welcome to the Nobitex API documentation. This API allows you to access market data, manage your account, execute trades, and more. ### Authentication and Token - Details on how to authenticate and obtain API tokens. ### API Key (Test) - Information regarding the experimental API key functionality. ### User Agent Setting - Guidelines for setting the User Agent string. ### Limitations - Information on API rate limits and other restrictions. ### Changes and Deprecations - A log of recent changes and deprecated API features. ### Troubleshooting Guide - Help for resolving common API-related issues. ### Getting Started with the API - A guide for new users to begin integrating with the Nobitex API. ### Market Information (Public) - **Order Book List**: Get real-time order book data. - **Depth Chart (Test)**: Access experimental depth chart data. - **Trade List**: Retrieve a list of recent trades. - **Nobitex Market Statistics**: Get overall market statistics. - **Nobitex Market OHLC Statistics**: Access Open, High, Low, Close data for markets. ### User Information - **Profile**: View user profile details. - **Generate Blockchain Address**: Create new blockchain deposit addresses. - **Add Bank Card**: Register a new bank card. - **Add Bank Account**: Register a new bank account. - **User Limitations**: Check user-specific trading or withdrawal limits. - **Wallets List**: Get a list of user's wallets. - **Wallets List (Optional)**: An optional endpoint for wallet list retrieval. - **Balance**: View account balances. - **Wallet Transaction List**: See transactions for a specific wallet. - **Transaction History (Optional)**: Filtered transaction history. - **Deposit List**: List of user deposits. - **Favorite Markets**: Manage and view favorite trading markets. ### Trading on Spot Market - **New Order Placement**: Submit a new spot market order. - **Order Status View**: Check the status of an existing order. - **User Orders List**: Retrieve a list of the user's orders. - **Order Status Change**: Modify the status of an order (e.g., cancel). - **Batch Order Cancellation**: Cancel multiple orders at once. - **User Trades List**: Get a list of the user's executed trades. ### Trading on Margin Market - **View Margin Markets**: List available margin trading markets. - **View Active Staking Pools**: See active staking pools for margin trading. - **Transfer Funds to Margin Wallet**: Move funds into the margin wallet. - **Get User Leverage Limit**: Retrieve user-specific leverage limits. - **Margin Order Placement**: Place an order on the margin market. - **View Positions List**: Get a list of open margin positions. - **View Single Position**: Retrieve details for a specific margin position. - **Close Position**: Close an open margin position. - **Edit Margin of Open Position**: Adjust the margin for an open position. ### Withdrawal - **Withdrawal Request Submission**: Initiate a withdrawal request. - **Withdrawal Request Confirmation**: Confirm a withdrawal request. - **Withdrawals List**: View a history of withdrawal requests. - **View Withdrawal**: Get details of a specific withdrawal. ### WebSocket - **Connect to WebSocket**: Establish a WebSocket connection. - **Get Token**: Obtain WebSocket authentication token. - **Authentication**: Authenticate WebSocket connection. - **Order Book List Channel**: Subscribe to real-time order book updates. - **Nobitex Market OHLC Statistics Channel**: Subscribe to market OHLC data. - **Public Trades Channel**: Receive real-time trade updates. - **Market Status Channel**: Get updates on market statuses. - **Private User Orders Channel**: Subscribe to your own order updates. - **Private User Trades Channel**: Subscribe to your own trade updates. ### Address Book and Secure Withdrawal - **View Address Book**: List saved withdrawal addresses. - **Add New Address**: Add a new address to the address book. - **Delete Address**: Remove an address from the address book. - **Enable Secure Withdrawal**: Activate secure withdrawal features. - **Disable Secure Withdrawal**: Deactivate secure withdrawal features. ### Security - **Login History**: View past login activities. - **Emergency Stop Activation**: Enable emergency stop functionality. - **Anti-Phishing**: Configure anti-phishing measures. ### Friend Introduction Plan - **Invitation Codes List**: View your invitation codes. - **Create Invitation Code**: Generate a new invitation code. - **User Invitation Status**: Track the status of user invitations. - **Register Inviter**: Register an inviter for a user. ### Authentication (Detailed) - **Recommended Token Acquisition Method**: The preferred way to get an authentication token. - **Login - Get Token**: Endpoint for logging in and receiving a token. - **FAQ Get Token**: Frequently asked questions about token retrieval. - **Logout - Burn Token**: Endpoint for logging out and invalidating a token. ### Profit and Loss - **Daily P&L Last Week**: View daily profit and loss for the past week. - **Total Daily P&L Last Week**: View total daily profit and loss for the past week. - **Total Monthly P&L**: View total profit and loss for the past month. ### Others - **System Settings**: Access and modify system settings. ### General Considerations - **Troubleshooting Guide**: A comprehensive guide to resolving issues. - **Success Responses**: Information on successful API responses. - **Failure Responses**: Details on error codes and messages. - **Pagination**: How to handle paginated results. - **Time Filtering**: Guidelines for filtering data by time range. - **Monetary Values**: Handling of currency and monetary values. - **Two-Factor Validation**: Requirements for 2FA. - **Call Rate Limitation**: Understanding and adhering to rate limits. - **Common and Pro Modes**: Differences and usage of different API modes. ### Frequently Asked Questions - **Login and Token Questions**: Common queries about authentication. - **Test Environment Availability**: Does Nobitex offer a testing environment? - **API Usage Limitations**: Are there any restrictions on API usage? - **Date Format**: What is the standard date format for API requests/responses? - **Sample Code Availability**: Are code samples provided for the API? ### API Change Log - History of modifications to the Nobitex API. ### API Terms of Use - Legal terms and conditions for using the Nobitex API. ### GitHub Repository - Link to the official Nobitex API GitHub repository. ### Postman Collection - A Postman collection for easily testing Nobitex API endpoints. ### Nobitex Website - Link to the main Nobitex website. ``` -------------------------------- ### Place Margin Order (cURL) Source: https://apidocs.nobitex.ir/index Example of how to place a margin order using cURL. This request specifies source and destination currencies, leverage, amount, and price. ```bash curl -X POST 'https://apiv2.nobitex.ir/margin/orders/add' \ -H "Authorization: Token yourTOKENhereHEX0000000000" \ -H "content-type: application/json" \ --data '{"srcCurrency": "btc", "dstCurrency": "rls", "leverage": "2", "amount": "0.01", "price": "6400000000"}' ``` -------------------------------- ### View Positions List using cURL Source: https://apidocs.nobitex.ir/index This snippet shows how to fetch a list of positions using the cURL command-line tool. It demonstrates how to specify source currency and status, and includes an authorization token. ```bash curl 'https://apiv2.nobitex.ir/positions/list?srcCurrency=btc&status=active' \ -H "Authorization: Token yourTOKENhereHEX0000000000" ``` -------------------------------- ### List Referral Links (http client) Source: https://apidocs.nobitex.ir/index An alternative method using the 'http' command-line client to fetch the list of referral links. Similar to the curl example, it requires an authorization token and retrieves details about the user's referral links. ```http http --follow --timeout 3600 GET https://apiv2.nobitex.ir/users/referral/links-list \ Authorization:'Token yourTOKENhereHEX0000000000' ``` -------------------------------- ### List Referral Links (curl) Source: https://apidocs.nobitex.ir/index This command retrieves a list of all referral links created by the user for the 'Introduce a Friend' program. It requires an authorization token. The response contains a list of referral links along with associated statistics. ```curl curl -X GET 'https://apiv2.nobitex.ir/users/referral/links-list' \ --header 'Authorization: Token yourTOKENhereHEX0000000000' ``` -------------------------------- ### Example Response for Order Book Source: https://apidocs.nobitex.ir/index An example JSON response when successfully fetching the order book for a specific market. It includes status, last update timestamp, last trade price, and lists of asks and bids with price and volume. ```json { "status": "ok", "lastUpdate": 1644991756704, "lastTradePrice": "35650565900", "asks": [ ["1476091000", "1.016"], ["1479700000", "0.2561"] ], "bids": [ ["1470001120", "0.126571"], ["1470000000", "0.818994"] ] } ``` -------------------------------- ### View Positions List using httpie Source: https://apidocs.nobitex.ir/index This snippet illustrates fetching a list of positions using the httpie command-line tool. It utilizes a simpler syntax for specifying query parameters compared to cURL. ```bash http GET https://apiv2.nobitex.ir/positions/list \ srcCurrency=btc&status=active ``` -------------------------------- ### View Margin Trading Markets (httpie) Source: https://apidocs.nobitex.ir/index Retrieves information about supported margin trading markets using httpie. This command-line client simplifies API interactions. The response details each market's configuration, such as fee rates and leverage. ```bash http GET https://apiv2.nobitex.ir/margin/markets/list ``` -------------------------------- ### POST /apikeys/create Source: https://apidocs.nobitex.ir/index Create a new API key with specified permissions and security settings. API keys provide granular access control with READ, TRADE, and WITHDRAW permissions, IP whitelisting, and customizable expiration dates. Returns both public and private keys on successful creation. ```APIDOC ## POST /apikeys/create ### Description Creates a new API key for secure and controlled access to Nobitex APIs. Each key can have specific permissions and IP restrictions, with optional expiration dates for enhanced security. ### Method POST ### Endpoint /apikeys/create ### Authentication - **Required**: OTP (2FA) token must be sent in `X-totp` header - **Authorization**: Token authentication required ### Parameters #### Request Body - **name** (string) - Required - Identifier name for the API key (e.g., "my-api-key") - **description** (string) - Optional - Custom description for reference (e.g., "API key for internal services") - **permissions** (string enum) - Required - Comma-separated permission list. Allowed values: `READ`, `TRADE`, `WITHDRAW` (e.g., "READ,TRADE") - **ipAddressesWhitelist** (array of strings) - Optional - List of allowed IPv4/IPv6 addresses (e.g., ["192.168.1.10", "10.0.0.5"]) - **expirationDate** (datetime UTC) - Optional - Key expiration date in ISO 8601 format (e.g., "2025-12-31T23:59:59Z") ### Request Example ```json { "name": "my-api-key", "description": "API key for internal services", "permissions": "READ,TRADE", "ipAddressesWhitelist": [ "192.168.1.10", "10.0.0.5" ], "expirationDate": "2025-12-31T23:59:59Z" } ``` ### Response #### Success Response (200) - **key** (object) - Created API key object containing: - **createdAt** (datetime) - Key creation timestamp - **description** (string) - Key description - **expirationDate** (datetime) - Expiration date if set - **ipAddressesWhitelist** (array) - List of whitelisted IPs - **key** (string) - Public API key - **name** (string) - Key identifier - **permissions** (string) - Granted permissions - **updatedAt** (datetime) - Last update timestamp - **privateKey** (string) - Private key for HMAC signing (displayed ONLY once) - **status** (string) - Response status ("ok") #### Response Example ```json { "key": { "createdAt": "2025-09-02T16:50:29.381869Z", "description": "API key for internal services", "expirationDate": "2025-12-31T23:59:59Z", "ipAddressesWhitelist": ["192.168.1.10", "10.0.0.5"], "key": "5XOCQZSPLQM4MiLzuUnZoBuqgYgTKl40W2X5j1pxfIA=", "name": "my-api-key", "permissions": "READ,TRADE", "updatedAt": "2025-09-02T16:50:29.381876Z" }, "privateKey": "S5y19KewZzheCWCO4xqMcwwvtR8vQ-hHjE_cdjz-XxE=", "status": "ok" } ``` ### Security Considerations - **OTP Required**: 2FA verification (X-totp header) is mandatory - **Private Key**: Displayed only once - store securely in Secret Manager immediately - **Notification**: Email confirmation sent upon key creation - **Audit**: Key creation event logged in user audit trail - **Warning**: Cannot retrieve private key after initial response - save it immediately ``` -------------------------------- ### Successful API Response Example Source: https://apidocs.nobitex.ir/index Demonstrates a typical successful response from the Nobitex API. A successful operation returns an object with an HTTP 200 status and a 'status' key set to 'ok'. Additional fields may be present depending on the specific API. ```json { "status": "ok", "otherFields": "..." } ``` -------------------------------- ### View Margin Trading Markets (cURL) Source: https://apidocs.nobitex.ir/index Fetches a list of available markets for margin trading. This request requires an authorization token and provides details on each market, including supported currencies, fees, and leverage limits. ```bash curl 'https://apiv2.nobitex.ir/margin/markets/list' \ -H "Authorization: Token yourTOKENhereHEX0000000000" ``` -------------------------------- ### POST /market/orders/add Source: https://apidocs.nobitex.ir/index Place a new order in the spot market. Supports limit and market orders, as well as stop-loss orders. ```APIDOC ## POST /market/orders/add ### Description Place a new order in the spot market. Supports limit and market orders, as well as stop-loss orders. ### Method POST ### Endpoint https://apiv2.nobitex.ir/market/orders/add ### Parameters #### Request Body - **type** (string) - Required - The type of order (`buy` or `sell`). - **execution** (string) - Optional - The order execution type. Defaults to `limit`. Use `market` for market price orders, or `stop_market` for stop-loss market orders. - **srcCurrency** (string) - Required - The source currency symbol (e.g., `btc`, `eth`). - **dstCurrency** (string) - Required - The destination currency symbol (e.g., `rls`, `usdt`). - **amount** (monetary) - Required - The volume of the source currency. - **price** (monetary) - Required (for `limit` execution) - The unit price for the order. - **stopPrice** (monetary) - Required (for `stop_market` execution) - The price at which the stop-loss order becomes active. - **clientOrderId** (string) - Optional - A unique user-defined identifier for the order (up to 32 characters). ### Request Example (Limit Buy Order) ```json { "type": "buy", "srcCurrency": "btc", "dstCurrency": "rls", "amount": "0.6", "price": 520000000, "clientOrderId": "order1" } ``` ### Request Example (Stop-Loss Sell Order) ```json { "type": "sell", "srcCurrency": "doge", "dstCurrency": "rls", "amount": "64", "execution": "stop_market", "stopPrice": 47500, "clientOrderId": "order1" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation ('ok'). - **order** (object) - Details of the placed order. - **id** (integer) - The unique identifier for the order. - **type** (string) - The type of the order (`buy` or `sell`). - **execution** (string) - The execution type of the order. - **market** (string) - The trading pair (e.g., `DOGE-RLS`). - **srcCurrency** (string) - The source currency name. - **dstCurrency** (string) - The destination currency name. - **price** (string) - The unit price of the order. - **amount** (string) - The volume of the order. - **param1** (string) - Additional parameter, relevant for stop-loss orders (e.g., stop price). - **totalPrice** (string) - The total price of the order. - **matchedAmount** (string) - The amount of the order that has been matched. - **unmatchedAmount** (string) - The remaining unmatched amount of the order. - **status** (string) - The current status of the order (e.g., 'Active', 'Inactive'). - **partial** (boolean) - Indicates if partial fills are allowed. - **fee** (number) - The fee associated with the order. - **created_at** (string) - The timestamp when the order was created. - **clientOrderId** (string) - The user-defined client order ID. #### Response Example (Limit Buy Order) ```json { "status": "ok", "order": { "id": 25, "type": "sell", "srcCurrency": "Bitcoin", "dstCurrency": "ریال", "price": "520000000", "amount": "0.6", "totalPrice": "312000000.0", "matchedAmount": 0, "unmatchedAmount": "0.6", "status": "Active", "partial": false, "fee": 0, "created_at": "2018-11-28T11:36:13.592827+00:00", "clientOrderId": "order1" } } ``` #### Response Example (Stop-Loss Sell Order) ```json { "status": "ok", "order": { "id": 26, "type": "sell", "execution": "StopMarket", "market": "DOGE-RLS", "srcCurrency": "Dogecoin", "dstCurrency": "\ufdfc", "price": "market", "amount": "64", "param1": "47500", "totalPrice": "0", "totalOrderPrice": "3008000", "matchedAmount": "0", "unmatchedAmount": "64", "status": "Inactive", "partial": false, "fee": 0, "created_at": "2022-01-17T12:14:18.005896+00:00", "averagePrice": "0", "clientOrderId": "order1" } } ``` ``` -------------------------------- ### Subscribe to OHLC Candle Data (JavaScript SDK) Source: https://apidocs.nobitex.ir/index This snippet demonstrates how to subscribe to OHLC (Open, High, Low, Close) candle data for a specific market symbol and resolution using the Nobitex JavaScript SDK. It shows how to handle subscription confirmation and data publication. The `delta: 'fossil'` option is optional and optimizes bandwidth for compatible clients. ```javascript const sub = client.newSubscription('public:candle-BTCIRT-15', { delta: 'fossil' }); sub.on('subscribed', (ctx) => { console.log('subscribed'); }); sub.on('publication', (ctx) => { console.log(ctx.data); }); sub.subscribe(); ``` -------------------------------- ### Retrieve user orders list with HTTPie - Nobitex API Source: https://apidocs.nobitex.ir/index Fetches a list of user orders using HTTPie HTTP client with query parameters for source currency, destination currency, and detail level. HTTPie provides a simpler syntax compared to cURL for API testing. ```bash http GET https://apiv2.nobitex.ir/market/orders/list \ srcCurrency=btc dstCurrency=usdt details=2 ``` -------------------------------- ### Connect to Multiple Channels Simultaneously Source: https://apidocs.nobitex.ir/index Subscribe to multiple channels using a single WebSocket client instance. This example demonstrates how to create subscriptions for different order book channels and listen for publications. It's suitable for JavaScript. ```javascript const channels = ['public:orderbook-BTCIRT', 'public:orderbook-USDTIRT', 'public:orderbook-FTMIRT'] const subs = channels.map(channel => { const sub = client.newSubscription(channel, { delta: 'fossil' }) sub.subscribe() sub.on('publication', (ctx) => { console.log(channel, ctx.data); }) return sub }); ``` -------------------------------- ### Add Bank Card - cURL and HTTP Source: https://apidocs.nobitex.ir/index Adds a new bank card to user account. Requires card number and bank name parameters. Rate limited to 30 requests per 30 minutes. Returns success status confirmation. ```cURL curl 'https://apiv2.nobitex.ir/users/cards-add' \ -X POST \ -H "Authorization: Token yourTOKENhereHEX0000000000" \ -H "content-type: application/json" \ --data '{"number":"5041721011111111","bank":"رسالت"}' ``` ```HTTP POST https://apiv2.nobitex.ir/users/cards-add \ number=5041721011111111 bank=رسالت ``` -------------------------------- ### Retrieve User Profile - cURL and HTTP Source: https://apidocs.nobitex.ir/index Fetches complete user profile information including personal details, bank cards, bank accounts, verification status, and trading statistics. Requires valid authentication token. Returns profile data with nested arrays of bank information and verification flags. ```cURL curl 'https://apiv2.nobitex.ir/users/profile' \ -H "Authorization: Token yourTOKENhereHEX0000000000" ``` ```HTTP POST https://apiv2.nobitex.ir/users/profile ``` -------------------------------- ### Place OCO Order using httpie Source: https://apidocs.nobitex.ir/index This snippet shows how to place an Order Cancels Order (OCO) using the httpie command-line tool. It's an alternative to cURL for making HTTP requests and achieves the same functionality of creating an OCO order with specified parameters. ```shell http POST https://apiv2.nobitex.ir/market/orders/add \ type=buy srcCurrency=btc dstCurrency=usdt amount=0.01 mode=oco price=42390 stopPrice=42700 stopLimitPrice=42715 clientOrderId=order1 ``` -------------------------------- ### Add Bank Account - cURL and HTTP Source: https://apidocs.nobitex.ir/index Adds a new bank account to user profile. Requires account number, SHABA number, and bank name. Rate limited to 30 requests per 30 minutes. Returns success status confirmation. ```cURL curl 'https://apiv2.nobitex.ir/users/accounts-add' \ -X POST \ -H "Authorization: Token yourTOKENhereHEX0000000000" \ -H "content-type: application/json" \ --data '{"number":"5041721011111111","shaba":"IR111111111111111111111111","bank":"رسالت"}' ``` ```HTTP POST https://apiv2.nobitex.ir/users/accounts-add \ number=5041721011111111 shaba=IR111111111111111111111111 bank=رسالت ``` -------------------------------- ### Subscribe to Order Book Updates (JavaScript SDK) Source: https://apidocs.nobitex.ir/index This snippet demonstrates how to subscribe to real-time order book updates for a specific market pair (e.g., BTCIRT) using the JavaScript SDK. It includes handlers for subscription confirmation and receiving publications, which contain the order book data. The 'fossil' delta option is optional and reduces bandwidth by sending diffs. ```javascript const sub = client.newSubscription('public:orderbook-BTCIRT', { delta: 'fossil' }); sub.on('subscribed', (ctx) => { console.log('subscribed'); }); sub.on('publication', (ctx) => { console.log(ctx.data); }); sub.subscribe(); ``` -------------------------------- ### POST /margin/orders/add Source: https://apidocs.nobitex.ir/index Allows users to place a margin order. This endpoint supports both buy and sell orders with leverage, and can be configured as a limit order by default. ```APIDOC ## POST /margin/orders/add ### Description Allows users to place a margin order. This endpoint supports both buy and sell orders with leverage, and can be configured as a limit order by default. ### Method POST ### Endpoint https://apiv2.nobitex.ir/margin/orders/add ### Parameters #### Query Parameters - **execution** (string) - Optional - The execution type of the order. Defaults to `limit`. Possible values: `limit`, `market`, `stop_limit`, `stop_market`. - **srcCurrency** (string) - Required - The source currency for the margin trade. Example: `btc`. - **dstCurrency** (string) - Required - The destination currency for the margin trade. Example: `rls` or `usdt`. - **type** (string) - Optional - The type of order, either `sell` or `buy`. Defaults to `sell`. - **leverage** (monetary) - Optional - The leverage multiplier for the trade. Defaults to `1`. Must be between 1 and the market's maximum leverage, with increments of 0.5. - **amount** (monetary) - Required - The amount of the source currency to trade. - **price** (monetary) - Required - The price at which to place the order. - **stopPrice** (monetary) - Optional - The stop-loss price for the order. ### Request Example ```json { "srcCurrency": "btc", "dstCurrency": "rls", "leverage": "2", "amount": "0.01", "price": "6400000000" } ``` ### Response #### Success Response (200) - **order** (Order) - An object containing details of the placed margin order. - **id** (integer) - The unique identifier of the order. - **type** (string) - The type of order (`sell` or `buy`). - **execution** (string) - The execution type of the order (`Limit`). - **tradeType** (string) - The type of trade (`Margin`). - **srcCurrency** (string) - The source currency. - **dstCurrency** (string) - The destination currency. - **price** (string) - The price of the order. - **amount** (string) - The amount of the order. - **status** (string) - The current status of the order (`Active`). - **totalPrice** (string) - The total price of the order. - **totalOrderPrice** (string) - The total order price. - **matchedAmount** (integer) - The amount that has been matched. - **unmatchedAmount** (string) - The amount that is yet to be matched. - **leverage** (string) - The leverage applied to the order. - **side** (string) - The side of the order (`open`). - **partial** (boolean) - Indicates if the order can be partially filled. - **fee** (integer) - The fee associated with the order. - **created_at** (string) - The timestamp when the order was created. - **averagePrice** (string) - The average price of matched trades. #### Response Example ```json { "status": "ok", "order": { "id": 25, "type": "sell", "execution": "Limit", "tradeType": "Margin", "srcCurrency": "btc", "dstCurrency": "rls", "price": "6400000000", "amount": "0.01", "status": "Active", "totalPrice": "0", "totalOrderPrice": "64000000", "matchedAmount": 0, "unmatchedAmount": "0.01", "leverage": "2", "side": "open", "partial": false, "fee": 0, "created_at": "2022-10-20T11:36:13.592827+00:00", "averagePrice": "0" } } ``` ### Error Handling - **ParseError**: Input format is incorrect. - **TradeLimitation**: User does not have sufficient verification level. - **UnsupportedMarginSrc**: The requested cryptocurrency is not supported for margin trading. - **MarginClosed**: Margin trading has been closed or not opened. ### Rate Limiting - 300 requests per 10 minutes. ``` -------------------------------- ### Initialize Centrifuge Client (JavaScript) Source: https://apidocs.nobitex.ir/index Initializes the Centrifuge client for WebSocket connections to Nobitex. Requires a connection token. This is a basic setup for establishing a connection. ```javascript const centrifuge = new Centrifuge('wss://ws.nobitex.ir/connection/websocket', { token: '' }); ```