Skip to content

Swap History

GET /swaps | Auth: Required

Retrieve a paginated list of your past swaps. Optionally filter by status.

Request

Query Parameters

FieldTypeRequiredDefaultDescription
statusstringNo--Filter by swap status: "submitted", "pending", "completed", or "failed"
limitintegerNo20Number of results per page (max 100)
offsetintegerNo0Number of results to skip for pagination

Example Request

GET /swaps?status=completed&limit=10&offset=0

Response

FieldTypeDescription
successbooleanWhether the request succeeded
swapsarrayList of swap objects
paginationobjectPagination metadata

Swap Object

FieldTypeDescription
swap_idintegerUnique swap identifier
statusstring"submitted", "pending", "completed", or "failed"
tx_hashstring \nullTransaction hash
from_tokenstringSource token symbol
to_tokenstringDestination token symbol

Pagination Object

FieldTypeDescription
totalintegerTotal number of matching swaps
limitintegerCurrent page size
offsetintegerCurrent offset
has_morebooleanWhether more results exist beyond this page

Example Response

{

"hl-key">"success": true,

"hl-key">"swaps": [

{

"hl-key">"swap_id": 4821,

"hl-key">"status": "completed",

"hl-key">"tx_hash": "0x8a3c...f29e",

"hl-key">"from_token": "ETH",

"hl-key">"to_token": "USDC"

},

{

"hl-key">"swap_id": 4755,

"hl-key">"status": "failed",

"hl-key">"tx_hash": "0x91b7...a3c2",

"hl-key">"from_token": "USDC",

"hl-key">"to_token": "DAI"

}

],

"hl-key">"pagination": {

"hl-key">"total": 42,

"hl-key">"limit": 10,

"hl-key">"offset": 0,

"hl-key">"has_more": true

}

}

Errors

StatusErrorCause
400"Invalid status filter"The status value is not one of the accepted statuses
400"limit must be between 1 and 100"The limit parameter is out of range
401"Unauthorized"Missing or invalid API key

Code Examples

curl

-kw">curl -str">"https://api.suwappu.bot/v1/agent/swaps?status=completed&limit=10&offset=0" \

-H -str">"Authorization: Bearer suwappu_sk_your_api_key"

Python

import requests

response = requests.get(

class="hl-str">"https:class="hl-commentclass="hl-str">">//api.suwappu.bot/v1/agent/swaps",

headers={class="hl-str">"Authorization": class="hl-str">"Bearer suwappu_sk_your_api_key"},

params={class="hl-str">"status": class="hl-str">"completed", class="hl-str">"limit": 10, class="hl-str">"offset": 0},

)

data = response.json()

if data[class="hl-str">"success"]:

for swap in data[class="hl-str">"swaps"]:

print(fclass="hl-str">"Swap {swap[class="hl-str">'swap_id']}: {swap[class="hl-str">'from_token']} → {swap[class="hl-str">'to_token']} ({swap[class="hl-str">'status']})")

if data[class="hl-str">"pagination"][class="hl-str">"has_more"]:

print(fclass="hl-str">"More results available (total: {data[class="hl-str">'pagination'][class="hl-str">'total']})")

TypeScript

const params = new URLSearchParams({

status: class="hl-str">"completed",

limit: class="hl-str">"10",

offset: class="hl-str">"0",

});

const response = await fetch(

https:class=class="hl-str">"hl-comment">//api.suwappu.bot/v1/agent/swaps?${params},

{

headers: {

Authorization: class="hl-str">"Bearer suwappu_sk_your_api_key",

},

}

);

const data = await response.json(); if (data.success) {

for (const swap of data.swaps) {

console.log(

Swap ${swap.swap_id}: ${swap.from_token} → ${swap.to_token} (${swap.status})

);

}

if (data.pagination.has_more) {

console.log(More results available (total: ${data.pagination.total}));

}

}