API ReferenceToken APIGet Token SwapsGet Swaps by Token AddressVersion: 2.2Get Swaps by Token AddressLooking for swaps by token address on EVM?Access token swap data by token address using our EVM API.Explore EVM APIGEThttps://solana-gateway.moralis.io/token/:network/:tokenAddress/swapsGet all swap related transactions (buy, sell) for a specific token address.PATH PARAMSnetworkstringrequiredThe network to querymainnetdevnettokenAddressstringrequiredThe address of the tokenQUERY PARAMSfromDatestringThe starting date (format in seconds or datestring accepted by momentjs)Provide the param 'fromBlock' or 'fromDate'If 'fromDate' and 'fromBlock' are provided, 'fromBlock' will be used.toDatestringThe ending date (format in seconds or datestring accepted by momentjs)Provide the param 'toBlock' or 'toDate'If 'toDate' and 'toBlock' are provided, 'toBlock' will be used.cursorstringThe cursor returned in the previous response (used for getting the next page)limitnumberThe number of results to returnorderstringThe order of the result, in ascending (ASC) or descending (DESC)ASCDESCtransactionTypesstringTransaction types to fetch. Possible values: 'buy','sell'Responses200 Returns swap transactions by token address.objectAPI KEYTest Live APINode.jsPythoncURLGoPHP// Dependencies to install:// $ npm install node-fetch --save// add "type": "module" to package.jsonimport fetch from 'node-fetch';const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' },};fetch('https://solana-gateway.moralis.io/token/mainnet/EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm/swaps?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://solana-gateway.moralis.io/token/mainnet/EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm/swaps?order=DESC"headers = { "Accept": "application/json", "X-API-Key": "YOUR_API_KEY"}response = requests.request("GET", url, headers=headers)print(response.text)curl --request GET \ --url 'https://solana-gateway.moralis.io/token/mainnet/EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm/swaps?order=DESC' \ --header 'accept: application/json' \ --header 'X-API-Key: YOUR_API_KEY' package mainimport ( "fmt" "net/http" "io/ioutil")func main() { url := "https://solana-gateway.moralis.io/token/mainnet/EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm/swaps?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, _ := ioutil.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://solana-gateway.moralis.io/token/mainnet/EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm/swaps?order=DESC', [ 'headers' => [ 'Accept' => 'application/json', 'X-API-Key' => 'YOUR_API_KEY', ],]);echo $response->getBody();Response Example200 Returns swap transactions by token address.{ "cursor": "", "page": 1, "pageSize": 100, "result": [ { "transactionHash": "5aQsHeSC3hqsNKhk1NNfBCX8cGEmQNwLb58rQQXifdpRLeLA84KiNdf9Bun3ySPjmYTeWiE8RoH4rsKCEPQsPnD9", "transactionIndex": 225, "transactionType": "sell", "baseQuotePrice": "71.400663877", "blockTimestamp": "2024-12-05T09:27:57.000Z", "blockNumber": 305532588, "subCategory": "partialSell", "walletAddress": "HeVbY7DnpmdPsp3dHPs9uewW1VZtzS2Ng8jf3UX5mexv", "pairAddress": "4mMDQ5kG9fFrBSQeedErsUoTBhY5KKnsKWGvenXRTwSy", "pairLabel": "$WIF/SOL", "exchangeName": "Raydium CLMM", "exchangeAddress": "CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK", "exchangeLogo": "https://entities-logos.s3.amazonaws.com/raydium.png", "baseToken": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", "quoteToken": "So11111111111111111111111111111111111111112", "bought": { "address": "So11111111111111111111111111111111111111112", "amount": "0.046709315", "usdPrice": 235.994560973, "usdAmount": 11.023144286774563, "symbol": "SOL", "logo": "", "name": "Wrapped SOL", "tokenType": "token0" }, "sold": { "address": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", "amount": "3.367337000", "usdPrice": 3.30521522, "usdAmount": 11.12977350326914, "symbol": "$WIF", "logo": "https://bafkreibk3covs5ltyqxa272uodhculbr6kea6betidfwy3ajsav2vjzyum.ipfs.nftstorage.link", "name": "dogwifhat", "tokenType": "token1" }, "totalValueUsd": 11.129773503 } ]}