API ReferenceToken APIGet Token SwapsGet Swaps by Pair AddressVersion: 2.2Get Swaps by Pair AddressLooking for swaps by pair address on EVM?Access token swap data by pair address using our EVM API.Explore EVM APIGEThttps://solana-gateway.moralis.io/token/:network/pairs/:pairAddress/swapsGet all swap related transactions (buy, sell, add liquidity & remove liquidity) for a specific pair address.PATH PARAMSnetworkstringrequiredThe network to querymainnetdevnetpairAddressstringrequiredThe address of the pairQUERY 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. Allowed values are 'buy', 'sell', 'addLiquidity', 'removeLiquidity'.Responses200 Returns swap transactions by pair 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/pairs/EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx/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/pairs/EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx/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/pairs/EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx/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/pairs/EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx/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/pairs/EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx/swaps?order=DESC', [ 'headers' => [ 'Accept' => 'application/json', 'X-API-Key' => 'YOUR_API_KEY', ],]);echo $response->getBody();Response Example200 Returns swap transactions by pair address.{ "page": 1, "cursor": "", "pageSize": 100, "exchangeLogo": "https://entities-logos.s3.amazonaws.com/raydium.png", "exchangeName": "Raydium AMM v4", "exchangeAddress": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", "pairAddress": "EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx", "pairLabel": "$WIF/SOL", "baseToken": { "address": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", "name": "dogwifhat", "symbol": "$WIF", "logo": "https://bafkreibk3covs5ltyqxa272uodhculbr6kea6betidfwy3ajsav2vjzyum.ipfs.nftstorage.link", "decimals": "6" }, "quoteToken": { "address": "So11111111111111111111111111111111111111112", "name": "Wrapped SOL", "symbol": "SOL", "logo": "", "decimals": "9" }, "result": [ { "transactionHash": "3TKXFCC8LQ9AoXjexQZocNaKhP9Lzh76AYL2kRherokwzxaZsaqZTfJU2c79UNsQyjFYxLFR8JLyiwr5Gpu96brW", "transactionType": "sell", "transactionIndex": 103, "blockTimestamp": "2024-12-05T09:16:31.000Z", "blockNumber": 305530938, "walletAddress": "MfDuWeqSHEqTFVYZ7LoexgAK9dxk7cy4DFJWjWMGVWa", "subCategory": "partialSell", "baseTokenAmount": "267.722149000", "quoteTokenAmount": "3.718135539", "baseTokenPriceUsd": 3.268334358, "quoteTokenPriceUsd": 235.334481202, "baseQuotePrice": "0.013888038", "totalValueUsd": 875.005498109 } ]}