Skip to main content

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.

Returns

Arguments

Overview

The createWebhooks mutation creates one or more webhooks that push real-time events from Codex to an HTTP endpoint you control. For filter conditions, payload shapes, and message verification details for each webhook type, see the Webhooks concept page.

Available webhook types

Codex supports the following webhook types. Each is documented in detail on the Webhooks concept page:

Quick example

A minimal mutation that creates a TOKEN_PAIR_EVENT webhook firing on any swap over $10,000 on a specific pair:
mutation {
  createWebhooks(
    input: {
      tokenPairEventWebhooksInput: {
        webhooks: {
          name: "Big swaps on WETH/USDC"
          callbackUrl: "https://your-endpoint.com/webhook"
          securityToken: "your-security-token"
          alertRecurrence: INDEFINITE
          conditions: {
            pairAddress: { eq: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" }
            networkId: { oneOf: [1] }
            swapValue: { gte: "10000" }
          }
        }
      }
    }
  ) {
    tokenPairEventWebhooks {
      id
      name
    }
  }
}

Usage Guidelines

  • Your endpoint must return a 2xx response within 3 seconds, or the message will be retried
  • Use bucketKey to group related webhooks. The individual bucketId and bucketSortKey fields are deprecated
  • Use publishingType: BATCH for high-volume webhooks like TOKEN_PAIR_EVENT to reduce HTTP requests to your endpoint
  • For MARKET_CAP_EVENT webhooks, combine market cap thresholds with volumeUsd and liquidityUsd filters (using gt, gte, lt, lte, eq operators) to ensure quality results
  • Verify every webhook message using the hash field. See Hash verification for the check
  • Use the Codex Explorer to build webhook mutations visually before wiring up production

Troubleshooting Tips

Check that your endpoint returns a 2xx response within 3 seconds. If your endpoint is slow, you may be getting duplicate messages from retries. You can inspect webhook status in the Codex Dashboard.
Double-check that the networkId on your condition matches the network the token or pair lives on. See supported networks for the full list of network IDs.
Use the deduplicationId field on each message to deduplicate on your side. Retries reuse the same deduplicationId.
Use the Codex Explorer to build the mutation visually and send a test message to your endpoint.