> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# getEventLabels

> Returns a list of event labels for a pair.

<div data-generated>
  ## GraphQL

  ```
  type Query {
    getEventLabels(
      id: String!
      limit: Int
      cursor: String
      direction: RankingDirection
    ): EventLabelConnection
  }

  type FrontRunLabelData {
    index: Int
    token0DrainedAmount: String!
    token1DrainedAmount: String!
  }

  type SandwichedLabelData {
    token0DrainedAmount: String
    token1DrainedAmount: String
  }

  union EventLabelData = FrontRunLabelData | SandwichedLabelData

  enum EventLabelType {
    FrontRun
    Sandwiched
  }

  type EventLabel {
    data: EventLabelData!
    id: String!
    label: EventLabelType!
    logIndex: Int!
    networkId: Int!
    timestamp: Int!
    transactionIndex: Int!
    transactionHash: String!
  }

  type EventLabelConnection {
    items: [EventLabel]
    cursor: String
  }

  enum RankingDirection {
    ASC
    DESC
  }
  ```
</div>

### Example

<a href="/explore" target="_blank" rel="noopener noreferrer">Test this query in the Explorer →</a>

```graphql theme={null}
{
  getEventLabels(
    id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1"
    limit: 10
  ) {
    items {
      id
      label
      timestamp
      transactionHash
      networkId
      data {
        ... on FrontRunLabelData {
          token0DrainedAmount
          token1DrainedAmount
        }
        ... on SandwichedLabelData {
          sandwichedToken0Drained: token0DrainedAmount
          sandwichedToken1Drained: token1DrainedAmount
        }
      }
    }
    cursor
  }
}
```

### Usage Guidelines

* Pass the pair ID in `address:networkId` format to the `id` argument
* Results are ordered `DESC` by default; pass `direction: ASC` for oldest first
* Use the returned `cursor` with the `cursor` argument to paginate through results

### Related Recipes

* [Events](/recipes/events): Build a token swap list with filtering, pagination, and real-time updates
