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

# onEventsCreated

> Live-streamed swap, mint, burn, and pool-balance-changed events for a single pair.

<Note>
  Subscriptions use `wss://graphql.mobula.io/graphql` with the `graphql-transport-ws` protocol. `wss://graphql.mobula.io/graphql/subscriptions` is also supported for backwards compatibility.
</Note>

### Returns

<ResponseField name="onEventsCreated" type="AddEventsOutput!">
  Batched event payload scoped to the subscribed pair. See [AddEventsOutput](/api-reference/graphql/types/AddEventsOutput).
</ResponseField>

### Arguments

<ResponseField name="id" type="String">
  Pair ID in the form `address:networkId`. Provide this **or** the `address` + `networkId` pair.
</ResponseField>

<ResponseField name="address" type="String">
  Pair contract address. Required when `id` is not provided.
</ResponseField>

<ResponseField name="networkId" type="Int">
  Network ID. Required when `id` is not provided.
</ResponseField>

<ResponseField name="quoteToken" type="QuoteToken">
  Override the quote side. When set, `eventDisplayType` (Buy/Sell) and the per-unit pricing fields on `SwapEventData` are recomputed against this quote. Defaults to `token0`. See [QuoteToken](/api-reference/graphql/types/QuoteToken).
</ResponseField>

<ResponseField name="commitmentLevel" type="[EventCommitmentLevel!]">
  Allow-list of commitment levels to receive. Defaults to `[Confirmed]`. Today only `Confirmed` events are produced; passing `[Processed]` only will receive nothing. See [EventCommitmentLevel](/api-reference/graphql/types/EventCommitmentLevel).
</ResponseField>

### Example — by id

```graphql theme={null}
subscription {
  onEventsCreated(id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1") {
    address
    networkId
    quoteToken
    events {
      id
      eventType
      eventDisplayType
      maker
      timestamp
      transactionHash
      data {
        __typename
        ... on SwapEventData {
          amount0 amount1 amount0In amount0Out amount1In amount1Out
          priceUsd priceUsdTotal amountNonLiquidityToken
        }
      }
    }
  }
}
```

### Example — by address + networkId, with explicit quoteToken

```graphql theme={null}
subscription {
  onEventsCreated(
    address: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
    networkId: 1
    quoteToken: token1
  ) {
    quoteToken
    events {
      id
      eventDisplayType
      data { __typename ... on SwapEventData { priceUsd priceUsdTotal } }
    }
  }
}
```
