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

# GraphQL

> Flexible, analytical queries that JOIN across data products in a single request.

The GraphQL endpoint is the right choice when you want to **shape your response** — picking exactly the fields you need across multiple data products in one request. If REST is "look up this one thing", GraphQL is "answer this one analytical question."

## Endpoint

```
POST https://graphql.chainstream.io/graphql
```

Or use the [GraphQL IDE](https://graphql.chainstream.io) to explore interactively.

## Authentication

Two equivalent paths — pick whichever fits your client:

```bash theme={null}
# API Key (browser, server, most clients)
-H "X-API-KEY: $CHAINSTREAM_API_KEY"
-H "Content-Type: application/json"

# SIWX wallet token (agents / on-host wallets)
-H "Authorization: SIWX <token>"
-H "Content-Type: application/json"
```

GraphQL and REST share the same API Key and subscription quota — no separate purchase.

## First query

```graphql theme={null}
query TopSolanaTokens {
  tokens(chain: SOLANA, orderBy: VOLUME_24H_DESC, limit: 5) {
    address
    symbol
    priceUsd
    marketCap
    recentTrades(limit: 3) {
      timestamp
      sizeUsd
      side
    }
  }
}
```

One request returns tokens, metadata and their recent trades — no N+1 roundtrips.

## When to use

* Analytical queries crossing multiple data products
* Dashboards that need many fields without overfetching
* Reporting / BI workloads
* Server-side rendering where you pre-shape the response

When **not** to: real-time streams (use WebSocket/Kafka) and hot-path reads where REST caching is cheaper.

## Invoke from CLI

The [`chainstream` CLI](/en/docs/access-methods/cli) ships with `graphql schema` (for discovery) and `graphql query` (for execution) — no need to wire up a client library for quick checks or shell automation:

```bash theme={null}
# Discover the 27 cubes
chainstream graphql schema --summary
chainstream graphql schema --type DEXTrades

# Run a query from a file
chainstream graphql query --file ./query.graphql --json
```

## Schema

<CardGroup cols={2}>
  <Card title="Schema overview" icon="diagram-project" href="/en/graphql/schema/schema-overview">
    Types, relationships and conventions.
  </Card>

  <Card title="Getting started" icon="rocket" href="/en/graphql/getting-started/overview">
    Complete first-query walkthrough.
  </Card>
</CardGroup>

## Next

<CardGroup cols={2}>
  <Card title="GraphQL IDE" icon="terminal" href="https://graphql.chainstream.io">
    Explore the schema and run queries interactively.
  </Card>

  <Card title="chainstream-graphql skill" icon="brain" href="/en/docs/ai-agents/agent-skills/chainstream-graphql">
    Structured Agent Skill for GraphQL workflows.
  </Card>

  <Card title="CLI `graphql` subcommand" icon="terminal" href="/en/docs/access-methods/cli#graphql-subcommand">
    `chainstream graphql schema` and `query` reference.
  </Card>

  <Card title="SDKs" icon="box" href="/en/docs/access-methods/sdks">
    Typed GraphQL wrappers via codegen.
  </Card>
</CardGroup>
