### Get Swap Order Info Request Examples Source: https://docs.dbotx.com/reference/query-task Examples of how to make a GET request to the Swap Order Info API using cURL, Python, and Node.js. These examples demonstrate how to include the necessary query parameters (ids) and headers (x-api-key) to retrieve order information. ```shell curl --location --request GET 'https://api-bot-v1.dbotx.com/automation/swap_orders?ids=order_id1,order_id2' \ --header 'x-api-key: YOUR_API_KEY' ``` ```python import requests url = "https://api-bot-v1.dbotx.com/automation/swap_orders" params = { "ids": "order_id1,order_id2" } headers = { "x-api-key": "YOUR_API_KEY" } response = requests.get(url, params=params, headers=headers) print(response.json()) ``` ```javascript const fetch = require('node-fetch'); const url = 'https://api-bot-v1.dbotx.com/automation/swap_orders?ids=order_id1,order_id2'; const apiKey = 'YOUR_API_KEY'; fetch(url, { method: 'GET', headers: { 'x-api-key': apiKey } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Fetch Copy Trading Tasks via cURL Source: https://docs.dbotx.com/reference/copy-trading-tasks This example demonstrates how to fetch copy trading tasks using the cURL command-line tool. It specifies the GET request method, the API endpoint, and includes the necessary 'x-api-key' header for authentication. ```shell curl --location --request GET 'https://api-bot-v1.dbotx.com/automation/follow_orders?page=0&size=20&chain=solana' \ --header 'x-api-key: YOUR_API_KEY' ``` -------------------------------- ### Fetch Copy Trading Tasks via Node.js Source: https://docs.dbotx.com/reference/copy-trading-tasks This Node.js example illustrates how to fetch copy trading tasks using the 'axios' library. It sets up the API endpoint and headers, then performs a GET request and logs the response data. ```javascript const axios = require('axios'); const url = 'https://api-bot-v1.dbotx.com/automation/follow_orders?page=0&size=20&chain=solana'; const apiKey = 'YOUR_API_KEY'; axios.get(url, { headers: { 'x-api-key': apiKey } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching data:', error); }); ``` -------------------------------- ### Example API Request (cURL) Source: https://docs.dbotx.com/index Demonstrates how to make a GET request to the DBot API for swap orders. It includes the necessary headers for accepting JSON and authenticating with the X-API-KEY. ```curl curl -X GET "https://api-bot-v1.dbotx.com/automation/swap_orders" \ -H "accept: application/json" \ -H "X-API-KEY: YOUR_API_KEY" ``` -------------------------------- ### Get Multiple Wallet Main Coin Balance (API Examples) Source: https://docs.dbotx.com/reference/wallet-balances Provides code examples for fetching multiple wallet balances using the DBOTX API. Includes examples for JSON, cURL (shell), and Python. ```json { "name": "Multiple Wallet Main Coin Balance", "method": "GET", "path": "https://api-data-v1.dbotx.com/kline/wallet/balances", "params": { "query": [ "chain=solana", "walletAddresses=HfrMWCM24kAymoPR1tESNtpHG5JAPLoqZ5bA1UKg4FTa,D9gXtr6gm2jDBeAAfMQz9Wh6ATS9DfiNoX5CZj7QVeh" ] }, "response": { "err": false, "res": [ { "account": "HfrMWCM24kAymoPR1tESNtpHG5JAPLoqZ5bA1UKg4FTa", "amount": 94857080, "uiAmount": 0.09485708 }, { "account": "D9gXtr6gm2jDBeAAfMQz9Wh6ATS9DfiNoX5CZj7QVeh", "amount": 273469127, "uiAmount": 0.273469127 } ] } } ``` ```shell curl --location --request GET 'https://api-data-v1.dbotx.com/kline/wallet/balances?chain=solana&walletAddresses=HfrMWCM24kAymoPR1tESNtpHG5JAPLoqZ5bA1UKg4FTa,D9gXtr6gm2jDBeAAfMQz9Wh6ATS9DfiNoX5CZj7QVeh' \ --header 'x-api-key: Your_api-key' ``` ```python import requests url = 'https://api-data-v1.dbotx.com/kline/wallet/balances?chain=solana&walletAddresses=HfrMWCM24kAymoPR1tESNtpHG5JAPLoqZ5bA1UKg4FTa,D9gXtr6gm2jDBeAAfMQz9Wh6ATS9DfiNoX5CZj7QVeh' headers = { 'x-api-key': 'YOUR_API_KEY' } response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### Create Swap Orders with Multiple Wallets (NodeJS) Source: https://docs.dbotx.com/reference/multi-fast-buy-sell-ws This NodeJS example demonstrates how to establish a WebSocket connection to the DBOTX trade API and send a request to create swap orders across multiple wallets. It includes detailed parameters for transaction configuration, such as chain, pair, order type, fee settings, slippage tolerance, and advanced PnL (Profit and Loss) order configurations. ```javascript const WebSocket = require('ws') function main() { const ws = new WebSocket('wss://api-data-v1.dbotx.com/trade/ws/', { headers: { 'x-api-key': 'YOUR_API_KEY', }, }) ws.on('open', () => { ws.send( JSON.stringify({ "id": 1761291309, "method": "createSwapOrdersMultiWallet", "params": { "chain": "solana", "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE", "walletIdList": [ "mglqkeq5009dol", "mglnkaeh0009pd" ], "type": "buy", "customFeeAndTip": false, "priorityFee": "", "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": true, "jitoTip": 0.001, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1, "minAmount": 100, "maxAmount": 100, "sellPercent": 0.5, "stopEarnPercent": 0.5, "stopLossPercent": 0.5, "stopEarnGroup": [ { "pricePercent": 0.2, "amountPercent": 0.5 }, { "pricePercent": 0.8, "amountPercent": 1 } ], "stopLossGroup": [ { "pricePercent": 0.2, "amountPercent": 0.5 }, { "pricePercent": 0.8, "amountPercent": 1 } ], "trailingStopGroup": [ { "pricePercent": 0.2, "amountPercent": 1,"activePricePercent”: 0.2 } ], "pnlOrderExpireDelta": 43200000, "pnlOrderExpireExecute": false, "pnlOrderUseMidPrice": false, "pnlCustomConfigEnabled": true, "pnlCustomConfig": { "customFeeAndTip": false, "priorityFee": "", "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": true, "jitoTip": 0.001, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1 } } }) ) setInterval(() => { ws.ping() }, 30000) }) ws.on('message', res => { console.log('res:', res.toString('utf-8')) }) } main() ``` -------------------------------- ### Get Group Info - Shell Example Source: https://docs.dbotx.com/reference/get-group-info This shell command demonstrates how to retrieve group information using cURL. It shows the necessary GET request to the DBOTX API endpoint, including the API key in the header and the 'type' query parameter. ```shell curl --location --request GET 'https://api-bot-v1.dbotx.com/automation/groups?type=follow_order' \ --header 'x-api-key: YOUR_API_KEY' ``` -------------------------------- ### Create or Update Copy Trading Task Request Example (JSON) Source: https://docs.dbotx.com/reference/edit-copy-trading-ws This JSON object demonstrates the structure and parameters required to create or update a copy trading task. It includes settings for task enablement, blockchain, DEX filters, target wallets, token blacklists, and detailed buy/sell configurations such as amounts, timing, market cap filters, tax limits, and anti-MEV options. ```json { "id": 1761291309, "method": "createOrUpdateFollowOrder", "params": { "id": "mh371eem0043qh", "enabled": false, "name": "task name15", "chain": "solana", "dexFilter": [ "raydium_amm", "pump" ], "targetIds": [ "ECQwEUMk75pxgruroXKTfqMHL4Aoj622vEZxBtYu4gNt" ], "tokenBlacklist": [ "5rfR98jWph5VhwG7wBJ5ftSfVgX5tGrwNCUAHRPDpump" ], "walletId": "mglqkeq5003dol", "groupId": "m53gevri055ird", "buySettings": { "enabled": true, "startHour": 10, "endHour": 12, "buyAmountType": "follow_amount", "maxBuyAmountUI": "0.001", "buyRatio": 1.5, "maxBalanceUI": 100, "reservedAmountUI": 0.01, "targetMinAmountUI": 0.1, "targetMaxAmountUI": 0.5, "minTokenMCUSD": 10000, "maxTokenMCUSD": 1000000, "maxBuyTax": 0.1, "maxSellTax": 0.1, "customFeeAndTip": false, "priorityFee": "0.00005", "jitoEnabled": true, "jitoTip": 0.001, "gasFeeDelta": 5, "maxFeePerGas": 100, "maxSlippage": 0.1, "skipFreezableToken": false, "skipMintableToken": false, "skipDelegatedToken": false, "skipNotOpensource": false } } } ``` -------------------------------- ### Get Group Info - JSON Example Source: https://docs.dbotx.com/reference/get-group-info This JSON snippet demonstrates how to retrieve group information using the DBOTX API. It specifies the HTTP method, endpoint, headers, and query parameters required for the request, along with an example of a successful response. ```json { "name": "Group Info", "method": "GET", "path": "https://api-bot-v1.dbotx.com/automation/groups?type=follow_order", "params": { "header": [ "x-api-key:YOUR_API_KEY" ], "query": { "type": "follow_order" } }, "response":{ "err": false, "res": [ { "id": "m53gevri055ird", "accountid": "vd1l2ge6ac1dxh", "type": "follow_order", "name": "group1", "createAt": "1732932000000", "updateAt": "1732932000000" } ] } } ``` -------------------------------- ### Get Signal Tokens (cURL) Source: https://docs.dbotx.com/reference/signal-tokens Demonstrates how to fetch signal token data using cURL. This command-line example shows a GET request to the signal endpoint, including the necessary API key for authentication. It highlights the basic structure for interacting with the API from a terminal. ```bash curl --location --request GET 'https://api-data-v1.dbotx.com/kline/signal?chain=solana' \ --header 'x-api-key: Your_api-key' ``` -------------------------------- ### Create or Update Follow Order Request Example Source: https://docs.dbotx.com/reference/create-copy-trading-ws This JSON object demonstrates a request to create or update a follow order in the DBOTX system. It includes parameters for enabling the task, specifying the blockchain, filtering DEXs, setting target wallets, managing token blacklists, and configuring detailed buy settings like amounts, limits, taxes, and slippage tolerance. ```json { "id": 1761291309, "method": "createOrUpdateFollowOrder", "params": { "enabled": true, "name": "task name", "chain": "solana", "dexFilter": [ "raydium_amm", "pump" ], "targetIds": [ "ECQwEUMk75pxgruroXKTfqMHL4Aoj622vEZxBtYu4gNt" ], "tokenBlacklist": [ "5rfR98jWph5VhwG7wBJ5ftSfVgX5tGrwNCUAHRPDpump" ], "walletId": "mglnkaeh0006pd", "groupId": "m53gevri055ird", "buySettings": { "enabled": true, "startHour": 10, "endHour": 12, "buyAmountType": "follow_amount", "maxBuyAmountUI": "0.1", "buyRatio": 1.5, "maxBalanceUI": 100, "reservedAmountUI": 0.01, "targetMinAmountUI": 0.1, "targetMaxAmountUI": 0.5, "minTokenMCUSD": 10000, "maxTokenMCUSD": 1000000, "maxBuyTax": 0.1, "maxSellTax": 0.1, "customFeeAndTip": false, "priorityFee": "0.00005", "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": true, "jitoTip": 0.001, "maxSlippage": 0.1, "skipFreezableToken": false, "skipMintableToken": false, "skipDelegatedToken": false } } } ``` -------------------------------- ### Get Main Coin Balance (JSON Response Example) Source: https://docs.dbotx.com/reference/wallet-balances Example JSON response structure for the Multiple Wallet Main Coin Balance API. It includes error status and an array of wallet balances, each with account address, raw amount, and UI amount. ```json { "err": false, "res": [ { "account": "HfrMWCM24kAymoPR1tESNtpHG5JAPLoqZ5bA1UKg4FTa", "amount": 94857080, "uiAmount": 0.09485708 }, { "account": "D9gXtr6gm2jDBeAAfMQz9Wh6ATS9DfiNoX5CZj7QVeh", "amount": 273469127, "uiAmount": 0.273469127 } ] } ``` -------------------------------- ### Create Swap Orders Multi Wallet Request Example (JSON) Source: https://docs.dbotx.com/reference/multi-fast-buy-sell-ws This JSON object demonstrates a sample request payload for the 'createSwapOrdersMultiWallet' API method. It includes essential parameters such as chain, pair, wallet list, trade type, and various fee and risk management settings. ```json { "id": 1761291309, "method": "createSwapOrdersMultiWallet", "params": { "chain": "solana", "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE", "walletIdList": [ "mglqkeq5009dol", "mglnkaeh0009pd" ], "type": "buy", "customFeeAndTip": false, "priorityFee": "", "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": true, "jitoTip": 0.001, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1, "minAmount": 100, "maxAmount": 100, "sellPercent": 0.5, "stopEarnPercent": 0.5, "stopLossPercent": 0.5, "stopEarnGroup": [ { "pricePercent": 0.2, "amountPercent": 0.5 }, { "pricePercent": 0.8, "amountPercent": 1 } ], "stopLossGroup": [ { "pricePercent": 0.2, "amountPercent": 0.5 }, { "pricePercent": 0.8, "amountPercent": 1 } ], "trailingStopGroup": [ { "pricePercent": 0.2, "amountPercent": 1,"activePricePercent”: 0.2 } ], "pnlOrderExpireDelta": 43200000, "pnlOrderExpireExecute": false } } ``` -------------------------------- ### Get Token Holders Data (Shell) Source: https://docs.dbotx.com/reference/token-holders This shell command demonstrates how to make a GET request to the Token Holders API. It includes the necessary URL with query parameters for 'chain' and 'token', and an example of how to include an API key in the headers. This is useful for quick testing or integration into shell scripts. ```shell curl --location --request GET 'https://api-data-v1.dbotx.com/kline/holders?chain=solana&token=7ik9WBeLnNMFrt5a4N48BBLKkLAc7daHszFuGGdwPump' \ --header 'x-api-key: Your_api-key' ``` -------------------------------- ### Create Swap Order Request Example (JSON) Source: https://docs.dbotx.com/reference/create-task-ws This JSON object demonstrates a request to create a swap order. It includes parameters for blockchain, token pair, wallet, trade type, fee configuration, slippage tolerance, and advanced risk management settings like stop-loss and take-profit groups. ```json { "id": 1761291309, "method": "createSwapOrder", "params": { "chain": "solana", "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE", "walletId": "lus8auwp009zvg", "type": "buy", "customFeeAndTip": false, "priorityFee": "", "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": true, "jitoTip": 0.001, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1, "amountOrPercent": 0.1, "migrateSellPercent": 1, "minDevSellPercent": 0.5, "devSellPercent": 1, "stopEarnPercent": 0.5, "stopLossPercent": 0.5, "stopEarnGroup": [ { "pricePercent": 0.2, "amountPercent": 0.5 }, { "pricePercent": 0.8, "amountPercent": 1 } ], "stopLossGroup": [ { "pricePercent": 0.2, "amountPercent": 0.5 }, { "pricePercent": 0.8, "amountPercent": 1 } ], "trailingStopGroup": [ { "pricePercent": 0.2, "amountPercent": 1,"activePricePercent”: 0.2 } ], "pnlOrderExpireDelta": 43200000, "pnlOrderExpireExecute": false, "pnlOrderUseMidPrice": false, "pnlCustomConfigEnabled": true, "pnlCustomConfig": { ``` -------------------------------- ### Get Token Holders Data (Node.js) Source: https://docs.dbotx.com/reference/token This Node.js example illustrates how to fetch token holder data from the DBotx API. It uses the 'axios' library to send a GET request to the /kline/holders endpoint, specifying the token and chain. An API key is included in the request headers for authentication. ```javascript const axios = require('axios'); const apiUrl = 'https://api-data-v1.dbotx.com/kline/holders'; const params = { chain: 'solana', token: '7ik9WBeLnNMFrt5a4N48BBLKkLAc7daHszFuGGdwPump' }; const headers = { 'x-api-key': 'Your_api-key' }; axios.get(apiUrl, { params: params, headers: headers }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching data:', error); }); ``` -------------------------------- ### Get Wallet Main Coin Balance Response Example (JSON) Source: https://docs.dbotx.com/reference/wallet-balance Example JSON response structure for the Wallet Main Coin Balance API. It includes error status, account details, and the balance in raw and UI amounts. This format is consistent across all subscription tiers. ```json { "err": false, "res": { "account": "0x200545E6BFC28baC0e116baDCE1235699b42D636", "amount": "4493343553347610", "uiAmount": 0.00449334355334761 } } ``` -------------------------------- ### Create Limit Order via WebSocket in Python Source: https://docs.dbotx.com/reference/create-limit-order-ws This Python example demonstrates establishing a WebSocket connection to the DBOTX API Data v1 using the 'websockets' library and sending a 'createLimitOrder' request. It requires an API key and the 'asyncio' library for asynchronous operations. The code defines the order parameters in a dictionary, converts it to JSON, and sends it over the WebSocket. It also includes functions for keeping the connection alive with pings and for listening to incoming messages. ```python import asyncio import websockets import json async def main(): uri = "wss://api-data-v1.dbotx.com/trade/ws/" headers = {"x-api-key": "YOUR_API_KEY"} msg = { "id": 1761291309, "method": "createLimitOrder", "params": { "chain": "solana", "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE", "walletId": "mglnkaeh0009pd", "groupId": "m53gevri055ird", "settings": [ { "enabled": True, "tradeType": "buy", "triggerPriceUsd": "0.022348210260", "triggerDirection": "down", "currencyAmountUI": "0.1", "customFeeAndTip": False, "priorityFee": "", "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": True, "jitoTip": 0.001, "expireDelta": 360000000, "expireExecute": False, "useMidPrice": False, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1 }, { "enabled": True, "tradeType": "sell", "triggerPriceUsd": "1.5", "triggerDirection": "up", "customFeeAndTip": False, "priorityFee": "0.00005", "currencyAmountUI": 1, "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": True, "jitoTip": 0.001, "expireDelta": 360000000, "expireExecute": False, "useMidPrice": False, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1 } ] } } async with websockets.connect(uri, additional_headers=headers) as ws: await ws.send(json.dumps(msg)) async def keep_alive(): while True: await ws.ping() await asyncio.sleep(30) async def listen_for_messages(): async for message in ws: print(message) await asyncio.gather(keep_alive(), listen_for_messages()) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Fetch Meme Token Data with Node.js Source: https://docs.dbotx.com/reference/meme-tokens-completing This Node.js example uses the 'node-fetch' library to make an API call to retrieve meme token data. It requires an API key and handles potential HTTP errors. Make sure to install 'node-fetch' (`npm install node-fetch`). ```javascript const fetch = require('node-fetch'); async function makeAPICall() { const url = 'https://api-data-v1.dbotx.com/kline/meme?chain=solana&sortBy=buyAndSellTimes&sort=-1&interval=1h&status=finishing&filter={"dexs":["pump","raydium_launchpad","boop"]}'; const apiKey = 'YOUR_API_KEY'; const headers = { 'x-api-key': apiKey }; try { const response = await fetch(url, { headers }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); console.log(JSON.stringify(data, null, 2)); } catch (error) { console.error('Error:', error); } } makeAPICall(); ``` -------------------------------- ### Fetch Wallet Historical Trading Records (Shell) Source: https://docs.dbotx.com/reference/wallet-trades This example demonstrates how to fetch wallet historical trading records using a cURL command. It requires an API key for authentication and specifies the account and trade type in the query parameters. ```shell curl --location --request GET 'https://api-data-v1.dbotx.com/kline/wallet/trades?account=7Zcn6n3J5Z9YyzEcVz9vhMPJVkAtboAZyZtZpM8KjM7m&type=buy' \ --header 'x-api-key: Your_api-key' ``` -------------------------------- ### Create Opening Sell Order (JSON, Shell, Python, Node) Source: https://docs.dbotx.com/reference/create-migrate-order This snippet demonstrates how to create an opening sell order using the DBOTX API. It includes examples in JSON, Shell (curl), Python, and Node.js. The request requires an API key and specifies order parameters such as chain, pair, amount, and slippage. The response includes an order ID or an error object. ```json { "name": "Create Opening Sell", "method": "POST", "path": "https://api-bot-v1.dbotx.com/automation/migrate_order", "params": { "header": [ "x-api-key:YOUR_API_KEY" ] }, "body": { "chain": "solana", "pairType": "pump", "pair": "fzLktjWBLFsSjncfkh79rUFqvafWcY5tzedWJyuypump", "walletId": "lvg40po10005q7", "tradeType": "sell", "amountOrPercent": 1, "customFeeAndTip": false, "priorityFee": "", "jitoEnabled": true, "jitoTip": 0.001, "expireDelta": 360000000, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1 }, "response": { "err": false, "res": { "id": "migrateorderid001" } } ``` ```shell curl --location --request POST 'https://api-bot-v1.dbotx.com/automation/migrate_order' \ --header 'x-api-key: YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data-raw '{"chain":"solana","pairType":"pump","pair":"fzLktjWBLFsSjncfkh79rUFqvafWcY5tzedWJyuypump","walletId":"lvg40po10005q7","tradeType":"sell","amountOrPercent":1,"customFeeAndTip":false,"priorityFee":"","jitoEnabled":true,"jitoTip":0.001,"expireDelta":360000000,"maxSlippage":0.1,"concurrentNodes":2,"retries":1}' ``` ```python import requests url = "https://api-bot-v1.dbotx.com/automation/migrate_order" headers = { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' } payload = { "chain": "solana", "pairType": "pump", "pair": "fzLktjWBLFsSjncfkh79rUFqvafWcY5tzedWJyuypump", "walletId": "lvg40po10005q7", "tradeType": "sell", "amountOrPercent": 1, "customFeeAndTip": False, "priorityFee": "", "jitoEnabled": True, "jitoTip": 0.001, "expireDelta": 360000000, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1 } response = requests.post(url, headers=headers, json=payload) print(response.text) ``` ```node const fetch = require('node-fetch'); async function makeAPICall() { const url = 'https://api-bot-v1.dbotx.com/automation/migrate_order'; const apiKey = 'YOUR_API_KEY'; const payload = { "chain": "solana", "pairType": "pump", "pair": "fzLktjWBLFsSjncfkh79rUFqvafWcY5tzedWJyuypump", "walletId": "lvg40po10005q7", "tradeType": "sell", "amountOrPercent": 1, "customFeeAndTip": false, "priorityFee": "", "jitoEnabled": true, "jitoTip": 0.001, "expireDelta": 360000000, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1 }; try { const response = await fetch(url, { method: 'POST', headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); console.log(JSON.stringify(data, null, 2)); } catch (error) { console.error('Error:', error); } } makeAPICall(); ``` -------------------------------- ### Python WebSocket Example for Batch Update Auto Sniper Order Source: https://docs.dbotx.com/reference/switch-auto-snipers-ws Example of disabling auto snipers using Python and the 'websockets' library. It establishes a WebSocket connection, sends a batch update request, and implements a keep-alive mechanism with pings. Requires installation of the 'websockets' and 'asyncio' libraries. ```python import asyncio import websockets import json async def main(): uri = "wss://api-data-v1.dbotx.com/trade/ws/" headers = {"x-api-key": "YOUR_API_KEY"} msg = { "id": 1761291309, "method": "batchUpdateSnipeOrder", "params": { "ids": ["mh483o31043tva", "mh47j198043m8a"], "enabled": true } } async with websockets.connect(uri, additional_headers=headers) as ws: await ws.send(json.dumps(msg)) async def keep_alive(): while True: await ws.ping() await asyncio.sleep(30) async def listen_for_messages(): async for message in ws: print(message) await asyncio.gather(keep_alive(), listen_for_messages()) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### NodeJS WebSocket Example for Batch Update Auto Sniper Order Source: https://docs.dbotx.com/reference/switch-auto-snipers-ws Example of disabling auto snipers using NodeJS and the 'ws' library. It connects to the WebSocket, sends a batch update request, and includes a heartbeat mechanism to keep the connection alive. Requires installation of the 'ws' package. ```javascript const WebSocket = require('ws') function main() { const ws = new WebSocket('wss://api-bot-v1.dbotx.com/trade/ws/', { headers: { 'x-api-key': 'YOUR_API_KEY', }, }) ws.on('open', () => { ws.send( JSON.stringify({ "id": 1761291309, "method": "batchUpdateSnipeOrder", "params": { "ids": ["mh483o31043tva", "mh47j198043m8a"], "enabled": true } }) ) setInterval(() => { ws.ping() }, 30000) }) ws.on('message', res => { console.log('res:', res.toString('utf-8')); }) } main() ``` -------------------------------- ### Get Auto Sniper Tasks - JSON Example Source: https://docs.dbotx.com/reference/auto-sniper-tasks This JSON example demonstrates a successful response from the 'Auto Sniper Tasks' endpoint. It includes details about the user's automated sniper tasks, such as account ID, task ID, enabled status, chain, expiration, wallet information, and buy/sell settings. ```json { "err": false, "res": [ { "accountId": "vd1l2ge6ac1dxh", "id": "n1v50h7hfkt0e1", "enabled": true, "chain": "solana", "expireAt": 1731324301348, "expireDelta": 36000000, "walletId": "lus8auwp003zvg", "walletType": "solana", "walletAddress": "your wallet address", "walletName": "your wallet name", "buyState": "done", "buyErrorCode": "", "buyErrorMessage": "", "sellState": "done", "sellErrorCode": "", "sellErrorMessage": "", "buySettings": { "buyAmountUI": 0.1, "customFeeAndTip": false, "priorityFee": "0.005", "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": true, "jitoTip": 0.001, "maxSlippage": 0.1, "minLiquidity": 0, "concurrentNodes": 2, "retries": 1 }, "sellSettings": { "enabled": true, "tradeType": "sell", "stopEarnEnabled": true, "stopEarnMode": "profit_percent", "stopEarnPercentOrPrice": 0.5, "stopLossEnabled": true, "stopLossMode": "loss_percent", "stopLossPercentOrPrice": 0.5, "autoSell": false, "useMidPrice": false, "customFeeAndTip": false, "priorityFee": null, "gasFeeDelta": 5, "maxFeePerGas": 100, "jitoEnabled": true, "jitoTip": 0.001, "maxSlippage": 0.1, "concurrentNodes": 2, "retries": 1 }, "tokenInfo": { "contract": "CzLSujWBLFsSjncfkh59rUFqvafWcY5tzedWJSuypump", "createAt": 1728554501806, "name": "token name", "symbol": "token symbol" } } ] } ```