> ## 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.

# onEventLabelCreated

> Live-streamed event labels for a token. Reference for the onEventLabelCreated subscription in the Codex API: arguments, payload fields, and usage.

## GraphQL

```
type Subscription {
  # Requires a Growth or Enterprise plan.
  onEventLabelCreated(
    id: String
  ): EventLabel
}

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!
}
```

### Example

[Test this query in the Explorer →](https://docs.codex.io/explore.md)

```graphql theme={null}
subscription {
  onEventLabelCreated(id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1") {
    id
    label
    networkId
    timestamp
    transactionHash
    data {
      ... on FrontRunLabelData {
        index
        token0DrainedAmount
        token1DrainedAmount
      }
      ... on SandwichedLabelData {
        sandwichedToken0Drained: token0DrainedAmount
        sandwichedToken1Drained: token1DrainedAmount
      }
    }
  }
}
```


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