# Get Token Events — Codex

> Returns on-chain trading events (swaps, mints, burns) for a token or pair address. Each event includes event type, USD price, timestamp, transaction hash, and maker address. Filter by event type, wallet address, price range, timestamp…

- Key: `codex-get-token-events`
- Type: Action (Read-only)
- Version: 0.0.2
- App: Codex (`codex`) — https://pipedream.com/apps/codex.md
- This page (HTML): https://pipedream.com/apps/codex/actions/get-token-events
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/codex/actions/get-token-events/get-token-events.mjs

## Description

Returns on-chain trading events (swaps, mints, burns) for a token or pair address. Each event includes event type, USD price, timestamp, transaction hash, and maker address. Filter by event type, wallet address, price range, timestamp window, and more. Use **Get Networks** to resolve the numeric `networkId` if needed. Supports cursor-based pagination — pass the `cursor` from the previous response to fetch the next page. [See the documentation](https://docs.codex.io/api-reference/queries/gettokenevents)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `address` | `string` | Yes | Token or pair contract address to fetch events for. |
| `networkId` | `integer` | Yes | Numeric blockchain network ID. Use Get Networks to list all supported networks and their IDs (e.g., 1 = Ethereum, 137 = Polygon). |
| `eventType` | `string` | No | Filter by the on-chain event type. |
| `eventDisplayType` | `string[]` | No | Filter by one or more display-level event types. |
| `quoteToken` | `string` | No | Filter by which token is treated as the quote token in the pair. |
| `maker` | `string` | No | Filter events to a specific wallet address (the transaction initiator). |
| `timestampFrom` | `integer` | No | Start of the time window as a Unix timestamp in seconds. |
| `timestampTo` | `integer` | No | End of the time window as a Unix timestamp in seconds. |
| `priceUsd` | `string` | No | Filter events by token price in USD. Provide a JSON object with comparison operators: gt, gte, lt, lte. Example: {"gte": 0.5, "lte": 2.0}. |
| `priceUsdTotal` | `string` | No | Filter events by total trade value in USD. Provide a JSON object with comparison operators: gt, gte, lt, lte. Example: {"gt": 1000}. |
| `priceBaseToken` | `string` | No | Filter events by price denominated in the base token. Provide a JSON object with comparison operators: gt, gte, lt, lte. Example: {"gt": 0.001}. |
| `amountNonLiquidityToken` | `string` | No | Filter events by the non-liquidity token amount. Provide a JSON object with comparison operators: gt, gte, lt, lte. Example: {"gte": 100}. |
| `symbolType` | `string` | No | Filter by whether the address resolves to a token or pool symbol. |
| `direction` | `string` | No | Sort order for results. DESC returns the most recent events first (default); ASC returns oldest first. |
| `limit` | `integer` | No | Maximum number of results to return. |
| `cursor` | `string` | No | Pagination cursor from a previous response's cursor field. Omit for the first page. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "codex",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "codex-get-token-events",
  arguments: {
    address: "Token Address",
    networkId: 10,
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "codex-get-token-events",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    codex: { authProvisionId: "apn_xxxxxxx" },
    address: "Token Address",
    networkId: 10,
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "codex-get-token-events",
    "configured_props": {
      "codex": { "authProvisionId": "apn_xxxxxxx" },
      "address": "Token Address",
      "networkId": 10
    }
  }'
```

---

- App: https://pipedream.com/apps/codex.md · All apps: https://pipedream.com/apps
