Get Swaps
curl --request POST \
--url https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"chain_id": 1,
"wallet": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"limit": 20
}
'import requests
url = "https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps"
payload = {
"chain_id": 1,
"wallet": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"limit": 20
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({chain_id: 1, wallet: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', limit: 20})
};
fetch('https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain_id' => 1,
'wallet' => '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
'limit' => 20
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps"
payload := strings.NewReader("{\n \"chain_id\": 1,\n \"wallet\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"limit\": 20\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chain_id\": 1,\n \"wallet\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"limit\": 20\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain_id\": 1,\n \"wallet\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"limit\": 20\n}"
response = http.request(request)
puts response.read_body{
"count": 123,
"cursor": "<string>",
"data": [
{
"id": 123,
"chain_id": 123,
"swap_type": "quote_token",
"protocol": "<string>",
"wallet_address": "<string>",
"pool_address": "<string>",
"token_address_in": "<string>",
"token_address_out": "<string>",
"token_amount_in": 123,
"token_amount_out": 123,
"token_price_in": 123,
"token_price_out": 123,
"pre_token_balance_in": 123,
"pre_token_balance_out": 123,
"post_token_balance_in": 123,
"post_token_balance_out": 123,
"usd_amount_in": 123,
"usd_amount_out": 123,
"block_number": 123,
"block_time": "2023-11-07T05:31:56Z",
"tx_hash": "<string>"
}
]
}{
"error": "Bad request: Invalid request parameters"
}{
"error": "Unauthorized: Invalid or missing API key"
}{
"error": "Forbidden: Access denied for the current API plan"
}{
"error": "Too many requests: Rate limit exceeded"
}{
"error": "Internal server error"
}Swaps
Get Swaps
Returns swaps for a combination of wallet, token and/or pool.
POST
/
v1
/
evm
/
dex
/
swaps
/
get-swaps
Get Swaps
curl --request POST \
--url https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"chain_id": 1,
"wallet": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"limit": 20
}
'import requests
url = "https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps"
payload = {
"chain_id": 1,
"wallet": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"limit": 20
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({chain_id: 1, wallet: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', limit: 20})
};
fetch('https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain_id' => 1,
'wallet' => '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
'limit' => 20
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps"
payload := strings.NewReader("{\n \"chain_id\": 1,\n \"wallet\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"limit\": 20\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chain_id\": 1,\n \"wallet\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"limit\": 20\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://refract.prismapi.io/v1/evm/dex/swaps/get-swaps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain_id\": 1,\n \"wallet\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n \"limit\": 20\n}"
response = http.request(request)
puts response.read_body{
"count": 123,
"cursor": "<string>",
"data": [
{
"id": 123,
"chain_id": 123,
"swap_type": "quote_token",
"protocol": "<string>",
"wallet_address": "<string>",
"pool_address": "<string>",
"token_address_in": "<string>",
"token_address_out": "<string>",
"token_amount_in": 123,
"token_amount_out": 123,
"token_price_in": 123,
"token_price_out": 123,
"pre_token_balance_in": 123,
"pre_token_balance_out": 123,
"post_token_balance_in": 123,
"post_token_balance_out": 123,
"usd_amount_in": 123,
"usd_amount_out": 123,
"block_number": 123,
"block_time": "2023-11-07T05:31:56Z",
"tx_hash": "<string>"
}
]
}{
"error": "Bad request: Invalid request parameters"
}{
"error": "Unauthorized: Invalid or missing API key"
}{
"error": "Forbidden: Access denied for the current API plan"
}{
"error": "Too many requests: Rate limit exceeded"
}{
"error": "Internal server error"
}Authorizations
Your Prism API key. You can get one for free in the Prism Dashboard.
Body
application/json
Numeric EVM chain ID to query. See Supported Chains.
Wallet address to filter swaps by.
Token address to filter swaps by.
Pool address to filter swaps by.
Maximum number of results to return in a single page.
Required range:
1 <= x <= 100Opaque cursor returned by a previous response. Pass it to fetch the next page of results.
Was this page helpful?