API ReferenceToken APIGet Token SwapsGet Swaps by Token AddressGet Swaps by Token Address Mainnet OnlyLooking for swaps by token address on Solana?Access swaps by token address data using our powerful Solana APIExplore Solana APIGEThttps://deep-index.moralis.io/api/v2.2/erc20/:address/swapsGet all swap transactions (buy/sell) for a specific ERC20 token.NoteSwaps data is synced and available only from September 2024 onwards. Data prior to this date is not included.PATH PARAMSaddressstringrequiredThe token address to get transaction forQUERY PARAMSchainstringThe chain to queryeth0x1sepolia0xaa36a7polygon0x89bsc0x38bsc testnet0x61avalanche0xa86afantom0xfacronos0x19arbitrum0xa4b1chiliz0x15b38chiliz testnet0x15b32gnosis0x64gnosis testnet0x27d8base0x2105base sepolia0x14a34optimism0xaholesky0x4268polygon amoy0x13882linea0xe708moonbeam0x504moonriver0x505moonbase0x507linea sepolia0xe705flow0x2ebflow-testnet0x221ronin0x7e4ronin-testnet0x7e5lisk0x46flisk-sepolia0x106apulse0x171sei0x531cursorstringThe cursor returned in the previous response (used for getting the next page).limitnumberThe desired page size of the result.orderstringThe order of the result, in ascending (ASC) or descending (DESC)ASCDESCfromBlocknumberThe minimum block number from which to get the token transactionsProvide the param 'from_block' or 'from_date'If 'from_date' and 'from_block' are provided, 'from_block' will be used.toBlockstringThe block number to get the token transactions fromfromDatestringThe start date from which to get the token transactions (format in seconds or datestring accepted by momentjs)Provide the param 'from_block' or 'from_date'If 'from_date' and 'from_block' are provided, 'from_block' will be used.toDatestringThe end date from which to get the token transactions (format in seconds or datestring accepted by momentjs)Provide the param 'to_block' or 'to_date'If 'to_date' and 'to_block' are provided, 'to_block' will be used.transactionTypesstringArray of transaction types. Allowed values are 'buy', 'sell'.Responses200Returns swap transactions by wallet address.400Bad Request404Not Found429Too Many Requests500Internal Server ErrorAPI KEYTest Live APIcURLNode.jsPythonGoPHPcurl --request GET \ --url 'https://deep-index.moralis.io/api/v2.2/erc20/0x6982508145454ce325ddbe47a25d4ec3d2311933/swaps?chain=eth&limit=25&order=DESC' \ --header 'accept: application/json' \ --header 'X-API-Key: YOUR_API_KEY' // Node.js v18+ has native fetch support// No additional dependencies requiredconst options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' },};fetch('https://deep-index.moralis.io/api/v2.2/erc20/0x6982508145454ce325ddbe47a25d4ec3d2311933/swaps?chain=eth&limit=25&order=DESC', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));# Dependencies to install:# $ python -m pip install requestsimport requestsurl = "https://deep-index.moralis.io/api/v2.2/erc20/0x6982508145454ce325ddbe47a25d4ec3d2311933/swaps?chain=eth&limit=25&order=DESC"headers = { "Accept": "application/json", "X-API-Key": "YOUR_API_KEY"}response = requests.request("GET", url, headers=headers)print(response.text)package mainimport ( "fmt" "net/http" "io")func main() { url := "https://deep-index.moralis.io/api/v2.2/erc20/0x6982508145454ce325ddbe47a25d4ec3d2311933/swaps?chain=eth&limit=25&order=DESC" req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Accept", "application/json") req.Header.Add("X-API-Key", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body))}<?php// Dependencies to install:// $ composer require guzzlehttp/guzzlerequire_once('vendor/autoload.php');$client = new \GuzzleHttp\Client();$response = $client->request('GET', 'https://deep-index.moralis.io/api/v2.2/erc20/0x6982508145454ce325ddbe47a25d4ec3d2311933/swaps?chain=eth&limit=25&order=DESC', [ 'headers' => [ 'Accept' => 'application/json', 'X-API-Key' => 'YOUR_API_KEY', ],]);echo $response->getBody();Response Example200 Returns swap transactions by wallet address.{ "page": "2", "page_size": "100", "cursor": "", "result": [ { "transactionHash": "0x2bfcba4715774420936669cd0ff2241d70e9abecab76c9db813602015b3134ad", "transactionIndex": 1, "transactionType": "buy", "blockTimestamp": "2022-02-22T00:00:00Z", "blockNumber": 21093423, "subCategory": "accumulation", "walletAddress": "0x2bfcba4715774420936669cd0ff2241d70e9abec", "walletAddressLabel": "Murad Wallet", "entity": "Murad", "entityLogo": "https://entities-logos.s3.us-east-1.amazonaws.com/murad.png", "pairAddress": "0x36a46dff597c5a444bbc521d26787f57867d2214", "pairLabel": "BRETT/WETH", "exchangeAddress": "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f", "exchangeName": "Uniswap v2", "exchangeLogo": "https://entities-logos.s3.us-east-1.amazonaws.com/uniswap.png", "baseQuotePrice": "0.00003376480687", "totalValueUsd": 1165 } ]}