GraphQL Endpoint
Mainnet:Why GraphQL?
GraphQL offers several advantages over REST/JSON-RPC:- Precise Queries: Request exactly the fields you need
- Single Request: Fetch related data in one query
- Strongly Typed: Schema-based with built-in validation
- Powerful Filtering: Rich query capabilities
- Nested Queries: Retrieve related objects in a single request
- Real-time Updates: Subscriptions for live data
Quick Start
HTTP Request
JavaScript Client
TypeScript SDK
Schema Exploration
Use GraphQL introspection to explore the schema:- Navigate to the GraphQL endpoint in your browser
- Explore the schema in the “Docs” panel
- Test queries interactively
Common Queries
Get Chain Information
Get Current Epoch
Get Object by ID
Get Owned Objects
Get Transaction Block
Query Events
Get Balance
Pagination
GraphQL uses cursor-based pagination:endCursor as the after parameter:
Nested Queries
Fetch related data in a single query:Filtering
Use filters to narrow results:Error Handling
GraphQL returns errors in a standardized format:Rate Limits
The public GraphQL endpoint has rate limits:- Query Depth: Maximum 15 levels deep
- Query Nodes: Maximum 500 nodes per query
- Request Timeout: 30 seconds
- Rate Limit: Subject to fair use policies
- Run your own indexer with GraphQL
- Use a managed RPC provider
- Implement caching and batching
Next Steps
- GraphQL Queries - Detailed query examples
- GraphQL Subscriptions - Real-time updates
- Explore the interactive GraphQL Playground at the endpoint URL