midnight-indexer:indexer-graphql-api

Document GraphQL queries and WebSocket subscriptions for Midnight indexer data.

37|9|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-indexer-indexer-graphql-api
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: midnight-indexer:indexer-graphql-api
Source: https://github.com/devrelaicom/midnight-expert/tree/main/plugins/midnight-indexer/skills/indexer-graphql-api
Command: npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-indexer-indexer-graphql-api

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

The indexer GraphQL API centralizes access to on-chain state, real-time events, and wallet session management so developers can reliably query blocks, transactions, contract actions, and shielded/unshielded activity without building custom indexer infrastructure.

Core Features & Use Cases

  • HTTP query and mutation endpoint for fetching blocks, transactions, contractAction records, and wallet connect/disconnect flows.
  • WebSocket subscriptions (graphql-transport-ws) for blocks, contractActions, shieldedTransactions, unshieldedTransactions, dustLedgerEvents, and zswapLedgerEvents with offset-based resumption.
  • Practical guidance: endpoint URLs for local/preview/preprod, query limits (max complexity 200, max depth 15, 1 MiB body), GraphQL type definitions, error handling patterns, and example HTTP and TypeScript subscription flows for building DApps and monitoring contracts.

Quick Start

Send a GraphQL POST to /api/v4/graphql to fetch the latest block and open a websocket to /api/v4/graphql/ws to subscribe to contract actions.

Frequently Asked Questions about midnight-indexer:indexer-graphql-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query Midnight indexer data using GraphQL?▼

To query Midnight indexer data using GraphQL, send a POST request to the /api/v4/graphql endpoint to fetch blocks, transactions, and contractAction records over HTTP for local, preview, or preprod networks.

How do I subscribe to real-time Midnight blockchain events via WebSocket?▼

Subscribe to real-time Midnight blockchain events by opening a WebSocket connection to /api/v4/graphql/ws using the graphql-transport-ws protocol to stream blocks, shieldedTransactions, and zswapLedgerEvents with offset-based resumption.

What are the GraphQL query limits for the Midnight indexer API?▼

The Midnight indexer GraphQL API enforces query limits including a maximum query complexity of 200, a maximum depth of 15, and a request body size limit of 1 MiB to prevent excessive resource consumption.

How do I handle wallet connect and disconnect sessions with the Midnight indexer?▼

Handle wallet connect and disconnect sessions by executing GraphQL mutations against the HTTP endpoint, enabling DApps to manage wallet session states and retrieve guidance for session-related error handling.

What should I do if my Midnight indexer GraphQL subscription exceeds query limits?▼

If your Midnight indexer GraphQL subscription exceeds query limits, reduce query complexity below 200, limit depth to 15, ensure the body is under 1 MiB, and implement error handling patterns for session and query limit issues.