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

# onPairMetadataUpdated

> Live-streamed stat updates for a given token within a pair. onPairMetadataUpdated subscription reference: arguments and payload fields.

## GraphQL

```
type Subscription {
  # Requires a Growth or Enterprise plan.
  onPairMetadataUpdated(
    id: String
    quoteToken: QuoteToken
    statsType: TokenPairStatisticsType
    useNonLiquidityTokenAsQuoteToken: Boolean
  ): PairMetadata
}

enum QuoteToken {
  token0
  token1
}

enum TokenPairStatisticsType {
  FILTERED
  UNFILTERED
}

enum ContractLabelSubType {
  Generic
  HighTax
  HoneyPot
  Imitator
}

enum ContractLabelType {
  Scam
  Verified
}

type ContractLabel {
  createdAt: Int!
  subType: ContractLabelSubType!
  type: ContractLabelType!
}

type PairMetadataToken {
  address: String!
  decimals: Int
  name: String!
  networkId: Int!
  pooled: String!
  price: String!
  symbol: String!
  labels: [ContractLabel]
}

type SocialLinks {
  bitcointalk: String
  blog: String
  coingecko: String
  coinmarketcap: String
  discord: String
  email: String
  facebook: String
  github: String
  instagram: String
  linkedin: String
  reddit: String
  slack: String
  telegram: String
  twitch: String
  twitter: String
  website: String
  wechat: String
  whitepaper: String
  youtube: String
  tiktok: String
}

type TokenInfo {
  id: String!
  address: String!
  circulatingSupply: String
  cmcId: Int
  gridAssetId: String
  bluechipRating: String
  isScam: Boolean
  name: String
  networkId: Int!
  symbol: String!
  totalSupply: String
  imageThumbHash: String
  imageThumbUrl: String
  imageSmallUrl: String
  imageLargeUrl: String
  imageBannerUrl: String
  videoExternalUrl: String
  description: String
}

type OrganizationUrl {
  url: String!
  type: String
}

type OrganizationSocial {
  url: String!
  type: String
}

type AssetDeployment {
  id: String!
  networkId: Int!
  address: String!
  standard: String
  assetId: String!
  rootId: String!
  token: EnhancedToken
}

type Asset {
  id: String!
  name: String
  description: String
  ticker: String
  type: String
  status: String
  icon: String
  rootId: String!
  assetDeployments: [AssetDeployment!]!
}

type Organization {
  name: String!
  foundingDate: String
  descriptionShort: String
  descriptionLong: String
  tagLine: String
  type: String
  sector: String
  urls: [OrganizationUrl!]!
  socials: [OrganizationSocial!]!
  logo: String
  icon: String
  header: String
  rootId: String!
  assets: [Asset!]!
}

type ExplorerTokenData {
  id: String!
  blueCheckmark: Boolean
  description: String
  divisor: String
  tokenPriceUSD: String
  tokenType: String
}

type Exchange {
  id: String!
  address: String!
  color: String
  name: String
  exchangeVersion: String
  iconUrl: String
  networkId: Int!
  tradeUrl: String
}

enum WalletCategory {
  NORMIE
  TOKEN_CREATOR
  EXCHANGE
  DEFI_EXCHANGE
  PAIR
  PAIR_TOKEN_HOLDER
  POOL_AUTHORITY
  STAKING_VAULT
  NOTORIOUS
  BURN
  LOCKER
}

type WalletFunding {
  fundedByAddress: String!
  fundedByLabel: String
  fundedAt: Int!
  tokenAddress: String!
  networkId: Int!
  amount: String!
  transactionHash: String!
}

type WalletPolymarketProfile {
  proxyWallet: String!
  xUsername: String
  displayName: String
  pseudonym: String
  profileImageUrl: String
  verifiedBadge: Boolean
  displayUsernamePublic: Boolean
  fetchedAt: Int!
}

type Wallet {
  address: String!
  category: WalletCategory
  firstSeenTimestamp: Int
  firstFunding: WalletFunding
  identityLabels: [String!]
  avatarUrl: String
  displayName: String
  twitterId: String
  twitterUsername: String
  telegramId: String
  telegramUsername: String
  website: String
  discordId: String
  discordUsername: String
  githubId: String
  githubUsername: String
  farcasterId: String
  farcasterUsername: String
  description: String
  ethosScore: Int
  ethosLevel: String
  ethosVerified: Boolean
  tradeSourceIds: [String!]
  identitySource: String
  identityUpdatedAt: Int
  polymarket: WalletPolymarketProfile
  tokensCreatedCount: Int
  tokensMigratedCount: Int
}

enum FeeMode {
  CREATOR_FEE
  CASHBACK
  HOLDER_REWARDS
}

type LaunchpadData {
  launchpadName: String
  graduationPercent: Float
  poolAddress: String
  completedAt: Int
  completed: Boolean
  completedSlot: Int
  migratedSlot: Int
  migratedAt: Int
  migrated: Boolean
  migratedPoolAddress: String
  launchpadProtocol: String
  launchpadIconUrl: String
  feeModes: [FeeMode!]
  holderRewardFeeBps: Int
  holderRewardQuoteMint: String
  category: String
}

type TokenExtrema {
  id: String!
  address: String!
  networkId: Int!
  athPrice: String!
  athPriceTimestamp: Int!
  atlPrice: String!
  atlPriceTimestamp: Int!
  athFdv: String!
  athFdvTimestamp: Int!
  atlFdv: String!
  atlFdvTimestamp: Int!
  athCircMc: String!
  athCircMcTimestamp: Int!
  atlCircMc: String!
  atlCircMcTimestamp: Int!
}

type CoinCommunity {
  id: String!
  createdAt: Int!
  postCount: Int!
  memberCount: Int!
  likeCount: Int!
  lastPostAt: Int
}

type Token2022ScaledUiAmountConfig {
  authority: String
  multiplier: Float!
  newMultiplierEffectiveTimestamp: String
  newMultiplier: Float
}

type Token2022TransferFee {
  epoch: String!
  transferFeeBasisPoints: Int!
  maximumFee: String!
}

type Token2022TransferFeeConfig {
  transferFeeConfigAuthority: String
  olderTransferFee: Token2022TransferFee!
  newerTransferFee: Token2022TransferFee!
}

type Token2022Extensions {
  scaledUiAmountConfig: Token2022ScaledUiAmountConfig
  transferFeeConfig: Token2022TransferFeeConfig
}

type B20Extensions {
  multiplier: String
  multiplierObservedAt: String
  pausedTransfer: Boolean
  pausedMint: Boolean
  pausedBurn: Boolean
  supplyCap: String
}

type RobinhoodStockTokenExtensions {
  uid: String!
  multiplier: String
  multiplierObservedAt: String
  newMultiplier: String
  newMultiplierEffectiveAt: String
  oraclePaused: Boolean
}

type XStockTokenExtensions {
  multiplier: String
  multiplierObservedAt: String
  newMultiplier: String
  newMultiplierEffectiveAt: String
}

type TokenExtensions {
  token2022: Token2022Extensions
  b20: B20Extensions
  robinhoodStockToken: RobinhoodStockTokenExtensions
  xStock: XStockTokenExtensions
}

type Erc7572CustomInfo {
  type: String!
  featuredImage: String
  collaborators: [String!]
}

enum CategoryType {
  CANONICAL
  NARRATIVE
}

enum CategoryStatus {
  DRAFT
  ACTIVE
  ARCHIVED
}

type Category {
  id: String!
  name: String!
  shortName: String
  slug: String!
  description: String
  type: CategoryType!
  status: CategoryStatus!
  parentId: String
  memberCount: Int
}

enum RiskVerdict {
  SCAM
  HIGH_RISK
  CAUTION
  NEUTRAL
  VERIFIED
  VERIFIED_CONTESTED
}

enum RiskAnalysisCoverage {
  NOT_ANALYZED
  INCONCLUSIVE
  ANALYZED
  STALE
}

enum RiskReasonCode {
  PROOF_HONEYPOT_SIM
  PROOF_NON_TRANSFERABLE
  PROOF_TRANSFER_FEE_100
  PROOF_DEFAULT_FROZEN
  PROOF_POOL_TRAP_SIM
  AUTH_MINT
  AUTH_FREEZE
  AUTH_PERMANENT_DELEGATE
  AUTH_TRANSFER_HOOK
  AUTH_PAUSABLE
  AUTH_OWNER_NOT_RENOUNCED
  AUTH_CAN_TRANSFER_OWNERSHIP
  TAX_BUY_HIGH
  TAX_SELL_HIGH
  TAX_HONEYPOT_UNCONFIRMED
  TAX_PAUSED
  TAX_POOL_TRAP
  TAX_POOL_TRAP_HOOK_SHARED
  LIQ_MINIMAL
  LIQ_UNKNOWN
  LIQ_RUG_CLIFF
  LIQ_UNLOCKED
  LIQ_DRAINING
  HOLD_TOP10_CONCENTRATED
  HOLD_DEV_HEAVY
  HOLD_SNIPER_HEAVY
  HOLD_BUNDLER_HEAVY
  HOLD_INSIDER_HEAVY
  HOLD_INSIDER_DUMPED
  FLOW_ONE_WAY
  FLOW_WALLET_FARM
  FLOW_WASH_DOMINATED
  FLOW_BUNDLED_LAUNCH
  FLOW_MECHANICAL_TRADING
  FLOW_RING_DOMINATED
  REP_SERIAL_RUGGER
  REP_RISKY_CREATOR
  REP_SCAMMER_FUNDED
  REP_IMITATOR_SYMBOL
  REP_IMITATOR_NAME
  REP_IMITATOR_IMAGE
  LABEL_MANUAL_SCAM
  LABEL_VERIFIED
}

type TokenRisk {
  verdict: RiskVerdict
  score: Float
  flaggedAt: Int
  analyzedAt: Int
  coverage: RiskAnalysisCoverage
  reasons: [RiskReasonCode!]
  buyTax: Float
  sellTax: Float
}

type TokenIssuer {
  id: String!
  displayName: String
}

type EnhancedToken {
  id: String!
  address: String!
  cmcId: Int
  decimals: Int!
  isScam: Boolean
  name: String
  networkId: Int!
  symbol: String
  socialLinks: SocialLinks
  info: TokenInfo
  gridAssetId: String
  bluechipRating: String
  organization: Organization
  asset: Asset
  exchanges: [Exchange!]
  creatorAddress: String
  creator: Wallet
  creatorBalanceNBT: String
  createBlockNumber: Int
  createTransactionHash: String
  createdAt: Int
  mintable: String
  freezable: String
  isFreezableValid: Boolean
  isMintableValid: Boolean
  launchpad: LaunchpadData
  top10HoldersPercent: Float
  profanity: Boolean
  extrema: TokenExtrema
  coinCommunity: CoinCommunity
  extensions: TokenExtensions
  tokenStandardCustomData: Erc7572CustomInfo
  categories: [Category!]
  risk: TokenRisk
  issuer: TokenIssuer
}

type TokenWalletActivity {
  bundlerCount: Int!
  bundlerHeldPercentage: Float!
  devHeldPercentage: Float!
  insiderCount: Int!
  insiderHeldPercentage: Float!
  sniperCount: Int!
  sniperHeldPercentage: Float!
  suspiciousCount: Int!
  suspiciousHeldPercentage: Float!
}

type CurrencyUnits {
  currency0: String!
  currency1: String!
  decimals0: Int!
  decimals1: Int!
}

type PairMetadata {
  exchangeId: String
  fee: Int
  id: String!
  quoteToken: QuoteToken
  networkId: Int
  liquidity: String!
  liquidityToken: String
  nonLiquidityToken: String
  pairAddress: String!
  statsType: TokenPairStatisticsType!
  price: String!
  priceNonQuoteToken: String!
  priceChange5m: Float
  priceChange1: Float
  priceChange4: Float
  priceChange12: Float
  priceChange24: Float
  tickSpacing: Int
  token0: PairMetadataToken!
  token1: PairMetadataToken!
  volume1: String
  volume4: String
  volume12: String
  volume24: String
  volume5m: String
  highPrice5m: String
  highPrice1: String
  highPrice4: String
  highPrice12: String
  highPrice24: String
  lowPrice5m: String
  lowPrice1: String
  lowPrice12: String
  lowPrice24: String
  lowPrice4: String
  enhancedToken0: EnhancedToken
  enhancedToken1: EnhancedToken
  walletActivity: TokenWalletActivity
  createdAt: Int
  top10HoldersPercent: Float
  currencyUnits: CurrencyUnits
}
```

### Example Subscription

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

```graphql theme={null}
subscription {
  onPairMetadataUpdated(
    id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1"
  ) {
    id
    pairAddress
    networkId
    liquidity
    statsType
    price
    priceNonQuoteToken
    priceChange5m
    priceChange1
    priceChange24
    volume5m
    volume1
    volume24
    token0 {
      address
      name
      symbol
      price
      pooled
      networkId
    }
    token1 {
      address
      name
      symbol
      price
      pooled
      networkId
    }
  }
}
```

### Example Response

```json theme={null}
{
  "data": {
    "onPairMetadataUpdated": {
      "id": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1",
      "pairAddress": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
      "networkId": 1,
      "liquidity": "150000000",
      "statsType": "UNFILTERED",
      "price": "3245.67",
      "priceNonQuoteToken": "0.000308",
      "priceChange5m": 0.0012,
      "priceChange1": 0.0089,
      "priceChange24": -0.0234,
      "volume5m": "125000",
      "volume1": "2500000",
      "volume24": "45000000",
      "token0": {
        "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "name": "USD Coin",
        "symbol": "USDC",
        "price": "1.00",
        "pooled": "75000000",
        "networkId": 1
      },
      "token1": {
        "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "name": "Wrapped Ether",
        "symbol": "WETH",
        "price": "3245.67",
        "pooled": "23100",
        "networkId": 1
      }
    }
  }
}
```

### Usage Guidelines

* Subscribe using the pair ID in format `pairAddress:networkId` (e.g., `0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1`)
* Use `quoteToken` parameter (`token0` or `token1`) to specify which token's perspective to use for price data
* Use `useNonLiquidityTokenAsQuoteToken: true` to automatically select the non-liquidity token as the quote token
* Updates are pushed in real-time as trades occur on the pair
* Price change fields (`priceChange5m`, `priceChange1`, etc.) are in decimal format (0.01 = 1%)
* Volume fields represent USD value traded in the specified time window
* Use `statsType` to see if stats are `FILTERED` (bot-filtered) or `UNFILTERED`

### Troubleshooting Tips

> [accordion] How do I get the pair ID for a token?
>
> Use the `filterPairs` or `listPairsForToken` query to find the pair address and network ID for your token. The subscription ID format is `pairAddress:networkId`.

> [accordion] Why am I not receiving updates?
>
> Updates are only pushed when trades occur on the pair. Low-activity pairs may have infrequent updates. Ensure your WebSocket connection is properly established and you're subscribed to an active pair.

> [accordion] What's the difference between token0 and token1?
>
> Token ordering is determined by the pair contract. Use the `quoteToken` parameter to specify which token you want as the base for price calculations, or use `useNonLiquidityTokenAsQuoteToken: true` to automatically select the non-stable/non-major token.

> [accordion] How do I handle WebSocket reconnections?
>
> Implement reconnection logic in your client. When reconnecting, you'll need to re-subscribe to the pairs you were monitoring. Consider using a library like `graphql-ws` that handles reconnections automatically.

> [accordion] Can I subscribe to multiple pairs at once?
>
> Yes, you can open multiple subscriptions for different pairs over the same WebSocket connection. Each subscription operates independently and will receive updates for its specific pair.

### Related Recipes

* [Detailed Token Page](https://docs.codex.io/recipes/detailed-token-page.md): Build a comprehensive token detail page with price, holders, trades, and real-time updates


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