> ## Documentation Index
> Fetch the complete documentation index at: https://sonar-cf3aeac7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List trades

> List individual swap trades for a pool or a token, with time filters and cursor pagination.

Returns individual trades (swaps), newest first by default. Each trade is oriented to one token: the `token*` fields describe that token, and the `*Vs` fields describe the other side of the pair.

## Pool or token

`address` can be a pool or a token:

| You pass | Trades come from | `token` is |
| - | - | - |
| A pool address or 32-byte pool id | That pool | The pool's base token. A stablecoin or the native/wrapped coin is normally the quote side, so in a PEPE/WETH pool `token` is PEPE and `tokenVs` is WETH. |
| A token address | The token's **top 2 pools** on that chain, ranked by 24h volume | The token you passed, in every trade |

> [!WARNING]
>
> For a token, trades come **only from its top 2 pools**. Trades in the token's other pools are not returned. To see a specific pool's trades, query that pool's address. Use [Get token markets](https://sonar-cf3aeac7.mintlify.site/api-reference/token/get-token-markets.md) to list a token's pools.

* A known token with no pools returns `200` with an empty array.
* An address that is neither a known pool nor a known token returns `404` (`Token or pool not found`).
* Only regular trades are returned. Swaps classified as MEV, sandwiched, liquidity adds/removals or launchpad bonding are excluded.

### Buy and sell

`type` is from the point of view of `token`:

* `buy`: `token` left the pool, so the trader received `token` and paid `tokenVs`.
* `sell`: `token` entered the pool, so the trader paid `token` and received `tokenVs`.

The same swap can be a `buy` when you query by one token and a `sell` when you query by the other token.

## Query parameters

**address** `string` *required*

Pool address (`0x` + 40 hex), 32-byte pool id (`0x` + 64 hex), or token address (`0x` + 40 hex). Case-insensitive.

**chain** `string` *required*

Chain id, as a number (`1`) or with the `evm:` prefix (`evm:1`). See [Chains and identifiers](https://sonar-cf3aeac7.mintlify.site/concepts/chains-and-identifiers.md).

**limit** `integer` (default: 10)

Number of trades to return, from 1 to 100.

**order** `string` (default: desc)

Sort direction by trade time: `desc` (newest first) or `asc` (oldest first).

**from** `integer`

Only trades at or after this time, Unix epoch **milliseconds** (inclusive). Must be less than or equal to `to`; `from` equal to `to` is allowed.

**to** `integer`

Only trades at or before this time, Unix epoch **milliseconds** (inclusive).

**cursor** `string`

Opaque pagination cursor, at most 128 characters. Pass the `cursor` of the last trade from the previous page. See [Pagination](#pagination).

> [!WARNING]
>
> `from` and `to` are in **milliseconds**. ISO date strings are rejected, and a value in seconds is accepted but read as a date in January 1970.

## Pagination

Trades are sorted by time, then by position in the chain (block, transaction, log), then by trade id, so the order is stable. Every trade carries a `cursor` that marks its position.

To get the next page:

1. Take the `cursor` of the **last trade** in the current page.
2. Repeat the **same query** (`address`, `chain`, `order`, `limit`, `from`, `to`) and add `cursor=<that value>`.
3. The next page starts strictly after that trade, in the direction of `order`.
4. Stop when a page has fewer than `limit` trades or is empty.

There is no `hasMore` or `nextCursor` field; the response is a plain array.

* Treat the cursor as opaque: don't build or parse it.
* The cursor is a position, not a saved query. It doesn't remember `order`, `address` or the time window, so always resend the same parameters with it. Sending it with the opposite `order` reads in the other direction from that trade.
* `from` and `to` still apply when you use a cursor, so you can paginate inside a time window.
* For token queries, pagination is consistent across both pools.

```javascript theme={null}
async function* allTrades(address, chain) {
  const base = "https://api.example.com/api/v1/trades";
  const limit = 100;
  let cursor;
  while (true) {
    const params = new URLSearchParams({ address, chain, limit: String(limit) });
    if (cursor) params.set("cursor", cursor);
    const body = await (await fetch(`${base}?${params}`)).json();
    if (body.status !== "success") throw new Error(`${body.code}: ${body.message}`);
    yield* body.data;
    if (body.data.length < limit) return;
    cursor = body.data.at(-1).cursor;
  }
}
```

## Response

**status** `"success"`

Always `success` for a 2xx response.

**data** `Trade[]`

Trades in the requested `order`. An empty array when nothing matches.

**Trade**

**token** `string`

Address of the token the trade is viewed from, lowercase. All `token*` fields describe this token and all `*Vs` fields describe the other side.

**tokenVs** `string`

Address of the other token in the pair, lowercase.

**pair** `string`

Pool address or 32-byte pool id, lowercase.

**poolType** `string | null`

Pool type id, for example `uniswap-v3`.

**date** `number`

Trade time in Unix epoch milliseconds (block time).

**timestamp** `number`

Same value as `date`.

**blockNumber** `number`

Block number of the trade.

**tokenPrice** `number`

USD price of `token` at the time of the trade.

**tokenPriceVs** `number`

USD price of `tokenVs` at the time of the trade.

**tokenAmount** `number`

Amount of `token` traded, adjusted for decimals. Always positive.

**tokenAmountVs** `number`

Amount of `tokenVs` traded, adjusted for decimals. Always positive.

**tokenAmountRaw** `string`

Amount of `token` as a raw integer string in base units. Always positive.

**tokenAmountRawVs** `string`

Amount of `tokenVs` as a raw integer string in base units. Always positive.

**tokenAmountUsd** `number`

USD value of the trade.

**tokenNativePrice** `number`

Price of `token` in the chain's native coin (for example ETH): `tokenPrice` divided by the native coin's USD price at the time of the trade. `0` when the native price is unknown.

**type** `"buy" | "sell"`

Direction from the point of view of `token`. `buy`: `token` left the pool (the trader received `token`). `sell`: `token` entered the pool (the trader gave up `token`).

**operation** `"regular"`

Always `regular`.

**blockchain** `string`

Chain display **name**, for example `Ethereum` or `Base`. This is not a chain id.

**hash** `string`

Transaction hash.

**sender** `string`

Address that initiated the transaction (the trader's wallet), lowercase.

**gasFeesUSD** `number | null`

Gas fee for this trade in USD: the transaction's gas cost, split evenly across the swaps in that transaction. `null` when unknown.

**id** `string`

Unique trade id, as a numeric string.

**cursor** `string`

Opaque cursor for this trade. Pass it as `cursor` to continue after this trade.

**swapSender** `string`

Address that called the pool, often a router contract, lowercase. `""` when unknown. On this endpoint, `sender` falls back to this address when the transaction initiator is unknown.

**totalFeesUSD** `number | null`

Total fees for the trade in USD. Currently the same value as `gasFeesUSD`.

**tokenMarketCapUsd** `number | null`

Market cap of `token` at the trade's price: circulating supply (or total supply when circulating is unknown) times `tokenPrice`. `null` when the token's details are unknown or the value is not positive. Implausible values (very low liquidity relative to market cap, or over \$1M market cap with no liquidity) are also reported as `null`.

**tokenMarketCapUsdVs** `number | null`

Same as `tokenMarketCapUsd`, for `tokenVs` at `tokenPriceVs`.

**tokenInfo** `object | null`

Details of `token`. `null` when its details are not stored.

**properties**

**address** `string`

**name** `string`

**symbol** `string`

**decimals** `number`

**logo** `string | null`

**tokenVsInfo** `object | null`

Details of `tokenVs`, with the same fields as `tokenInfo`.

> [!NOTE]
>
> `tokenNativePrice` uses the native coin's price at the time of each trade: the trade's own price when one side is the native or wrapped native coin, otherwise the latest reference native-coin price at or before the trade.

## Errors

| Status | `code` | When |
| - | - | - |
| 400 | `INVALID_ADDRESS` | `address` is malformed (`address: must be a valid token address or pool id`). |
| 400 | `INVALID_PARAMETERS` | Any other validation failure: bad `chain`, `limit` outside 1 to 100, `order` not `asc`/`desc`, non-numeric `from`/`to`, `from` after `to` (`from: from must be before to`), or an invalid `cursor` (`cursor: invalid cursor`). |
| 404 | `TOKEN_NOT_FOUND` | `address` is neither a known pool nor a known token on `chain`. Message: `Token or pool not found`. A well-formed chain id that ChainQuery doesn't index also gives this 404. |
| 500 | `INTERNAL_ERROR` | Unexpected server error. |

```bash cURL theme={null}
curl "https://api.example.com/api/v1/trades?address=0xa43fe16908251ee70ef74718545e4fe6c5ccec9f&chain=1&limit=2"
```

```bash cURL (next page) theme={null}
curl "https://api.example.com/api/v1/trades?address=0xa43fe16908251ee70ef74718545e4fe6c5ccec9f&chain=1&limit=2&cursor=MTc5NDIxODM4ODAwMC4yMjk5OTk5OS40MS4xMTIuMzkxNDQ2MDE4Nzc"
```

```bash cURL (token, time window) theme={null}
curl "https://api.example.com/api/v1/trades?address=0x6982508145454ce325ddbe47a25d4ec3d2311933&chain=evm:1&order=asc&from=1794211200000&to=1794218400000&limit=100"
```

```javascript JavaScript theme={null}
const params = new URLSearchParams({
  address: "0xa43fe16908251ee70ef74718545e4fe6c5ccec9f",
  chain: "1",
  limit: "2",
});

const res = await fetch(`https://api.example.com/api/v1/trades?${params}`);
const body = await res.json();
if (body.status !== "success") throw new Error(`${body.code}: ${body.message}`);

for (const t of body.data) {
  console.log(t.type, t.tokenAmount, t.tokenInfo?.symbol, `$${t.tokenAmountUsd}`);
}
const nextCursor = body.data.at(-1)?.cursor;
```

```json 200 theme={null}
{
  "status": "success",
  "data": [
    {
      "token": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
      "tokenVs": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "pair": "0xa43fe16908251ee70ef74718545e4fe6c5ccec9f",
      "poolType": "uniswap-v2",
      "date": 1794218400000,
      "blockNumber": 23000000,
      "tokenPrice": 0.0000098421,
      "tokenPriceVs": 3512.07,
      "tokenAmount": 101600000,
      "tokenAmountVs": 0.284721,
      "tokenAmountUsd": 999.96,
      "tokenNativePrice": 2.80236e-9,
      "type": "buy",
      "operation": "regular",
      "blockchain": "Ethereum",
      "hash": "0x9c1f6a2e4b7d38c05a1e92f4d6b3c8a71e0f5d24b9a6c3e8172d4f0a5b6c9e31",
      "sender": "0x5b1e4c7a9d3f20c86e0b4a17d29f63c8e4a0b915",
      "tokenAmountRaw": "101600000000000000000000000",
      "tokenAmountRawVs": "284721000000000000",
      "gasFeesUSD": 0.52,
      "timestamp": 1794218400000,
      "id": "39144604204",
      "cursor": "MTc5NDIxODQwMDAwMC4yMzAwMDAwMC4zLjcuMzkxNDQ2MDQyMDQ",
      "swapSender": "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
      "totalFeesUSD": 0.52,
      "tokenMarketCapUsd": 4140000000,
      "tokenMarketCapUsdVs": 8650000000,
      "tokenInfo": {
        "address": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
        "name": "Pepe",
        "symbol": "PEPE",
        "decimals": 18,
        "logo": "https://cdn.example.com/tokens/pepe.png"
      },
      "tokenVsInfo": {
        "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "name": "Wrapped Ether",
        "symbol": "WETH",
        "decimals": 18,
        "logo": "https://cdn.example.com/tokens/weth.png"
      }
    },
    {
      "token": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
      "tokenVs": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "pair": "0xa43fe16908251ee70ef74718545e4fe6c5ccec9f",
      "poolType": "uniswap-v2",
      "date": 1794218388000,
      "blockNumber": 22999999,
      "tokenPrice": 0.0000098412,
      "tokenPriceVs": 3511.83,
      "tokenAmount": 50000000,
      "tokenAmountVs": 0.140116,
      "tokenAmountUsd": 492.06,
      "tokenNativePrice": 2.80231e-9,
      "type": "sell",
      "operation": "regular",
      "blockchain": "Ethereum",
      "hash": "0x2e7d0b94c1a5f3687e2c9d40b1f8a63e5c7d2049a8b1f6e3c0d5a7294e8b1c06",
      "sender": "0xd41a7f3c08b92e65f1c4a7e0b3d95c28f6e1a0b4",
      "tokenAmountRaw": "50000000000000000000000000",
      "tokenAmountRawVs": "140116000000000000",
      "gasFeesUSD": 0.47,
      "timestamp": 1794218388000,
      "id": "39144601877",
      "cursor": "MTc5NDIxODM4ODAwMC4yMjk5OTk5OS40MS4xMTIuMzkxNDQ2MDE4Nzc",
      "swapSender": "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
      "totalFeesUSD": 0.47,
      "tokenMarketCapUsd": 4139900000,
      "tokenMarketCapUsdVs": 8649400000,
      "tokenInfo": {
        "address": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
        "name": "Pepe",
        "symbol": "PEPE",
        "decimals": 18,
        "logo": "https://cdn.example.com/tokens/pepe.png"
      },
      "tokenVsInfo": {
        "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "name": "Wrapped Ether",
        "symbol": "WETH",
        "decimals": 18,
        "logo": "https://cdn.example.com/tokens/weth.png"
      }
    }
  ]
}
```

```json 404 theme={null}
{
  "status": "error",
  "statusCode": 404,
  "code": "TOKEN_NOT_FOUND",
  "message": "Token or pool not found"
}
```

```json 400 theme={null}
{
  "status": "error",
  "statusCode": 400,
  "code": "INVALID_PARAMETERS",
  "message": "cursor: invalid cursor",
  "details": [
    { "field": "cursor", "message": "invalid cursor" }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.