Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ http {
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/endpoint-pricing/$ $scheme://$http_host/docs/$1/token-api/endpoints/pricing/ permanent;
# Temporary redirects (302)
rewrite ^/docs/en/querying/graph-client/$ $scheme://$http_host/docs/en/subgraphs/querying/graph-client/README/ redirect;
rewrite ^/docs/en/developing/graph-ts/$ $scheme://$http_host/docs/en/subgraphs/developing/creating/graph-ts/README/ redirect;
Expand Down
38 changes: 38 additions & 0 deletions website/src/components/CodeTabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Children, isValidElement, useState } from 'react';

export function CodeTabs({ children, defaultIndex = 0 }: { children: React.ReactNode; defaultIndex?: number }) {
const tabs = Children.toArray(children).filter(isValidElement);

const [activeIndex, setActiveIndex] = useState(defaultIndex);

return (
<div className="w-full my-6">
{/* tab labels */}
<div className="flex gap-2 border-b border-gray-700 mb-4 overflow-x-auto">
{tabs.map((tab: any, i: number) => {
const label = tab.props.label ?? `Tab ${i + 1}`;
return (
<button
key={i}
onClick={() => setActiveIndex(i)}
className={`px-3 py-1 text-sm rounded-t border-b-2 transition-colors ${
i === activeIndex
? 'border-blue-500 text-blue-500'
: 'border-transparent text-gray-400 hover:text-gray-200'
}`}
>
{label}
</button>
);
})}
</div>

{/* active tab contents */}
<div>{tabs[activeIndex]}</div>
</div>
);
}

export function CodeTab({ children }: { children: React.ReactNode }) {
return <div>{children}</div>;
}
3 changes: 3 additions & 0 deletions website/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NextSeo, type NextSeoProps } from 'next-seo'
import type { NextraThemeLayoutProps } from 'nextra'
import { useFSRoute, useRouter } from 'nextra/hooks'
import { MDXProvider } from 'nextra/mdx'
import { CodeTabs, CodeTab } from "@/components/CodeTabs"
import { normalizePages } from 'nextra/normalize-pages'
import {
type ComponentProps,
Expand Down Expand Up @@ -614,6 +615,8 @@ export default function Layout({ pageOpts, children }: NextraThemeLayoutProps<Fr
table: Table,
VideoEmbed,
wrapper: MDXContent,
CodeTabs,
CodeTab,
}}
>
{children}
Expand Down
8 changes: 4 additions & 4 deletions website/src/pages/ar/token-api/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import titles from './_meta-titles.json'

export default {
'quick-start': '',
'svm-tokens': titles['svm-tokens'] ?? '',
'svm-dexs': titles['svm-dexs'] ?? '',
'evm-tokens': titles['evm-tokens'] ?? '',
'evm-dexs': titles['evm-dexs'] ?? '',
'evm-nfts': titles['evm-nfts'] ?? '',
'svm-tokens': titles['svm-tokens'] ?? '',
'svm-dexs': titles['svm-dexs'] ?? '',
'tvm-tokens': titles['tvm-tokens'] ?? '',
'tvm-dexs': titles['tvm-dexs'] ?? '',
monitoring: titles['monitoring'] ?? '',
'endpoint-pricing': '',
'endpoints': titles['endpoints'] ?? '',
guides: 'Guides',
faq: '',
'upgrade-to-v1': '',
}
4 changes: 4 additions & 0 deletions website/src/pages/ar/token-api/endpoints/_meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
'pricing': '',
'support': '',
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Endpoint Pricing
sidebarTitle: Pricing
---

## Pricing Tiers
Expand Down
24 changes: 24 additions & 0 deletions website/src/pages/ar/token-api/endpoints/support.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Endpoint Feature Matrix
sidebarTitle: Support Matrix
---

import { Check } from '@edgeandnode/gds/icons'

## Chain and Feature Support

| Network | Tokens | Swaps | NFTs |
| ----------------- | :-----------------------: | :-----------------------: | :-----------------------: |
| Ethereum Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| BSC Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| Base Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| Unichain Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| Arbitrum One | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| Optimism Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| Polygon Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| Avalanche C-Chain | <Check alt="Supported" /> | <Check alt="Supported" /> | <Check alt="Supported" /> |
| Solana Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | ❌ Unsupported |
| Tron Mainnet | <Check alt="Supported" /> | <Check alt="Supported" /> | ❌ Unsupported |

A full list of chain support for The Graph services can be found [here](/supported-networks/).

2 changes: 1 addition & 1 deletion website/src/pages/ar/token-api/evm-dexs/_meta.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
swaps: '',
dexes: '',
'pools-ohlc': '',
pools: '',
swaps: '',
}
4 changes: 2 additions & 2 deletions website/src/pages/ar/token-api/evm-tokens/_meta.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export default {
tokens: '',
transfers: '',
holders: '',
tokens: '',
balances: '',
'balances-native': '',
'balances-historical': '',
holders: '',
}
4 changes: 4 additions & 0 deletions website/src/pages/ar/token-api/guides/_meta-titles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"gpt": "Create Custom GPTS",
"upgrade-to-v1": ""
}
4 changes: 4 additions & 0 deletions website/src/pages/ar/token-api/guides/_meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
gpt: '',
'upgrade-to-v1': '',
}
121 changes: 121 additions & 0 deletions website/src/pages/ar/token-api/guides/gpt.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
title: How the Token API Powers Custom GPTs
sidebarTitle: Create Custom GPTs
---

## Overview

The Token API is a pre-indexed blockchain data service that provides real-time access to token balances, metadata, prices, liquidity, and volume across multiple chains. Developers use its REST endpoints to build wallets, trading dashboards, DeFi analytics, and AI systems without maintaining their own indexing stack. Custom GPTs can connect directly to the Token API's OpenAPI schema.

The Token API enables developers to build **Custom GPTs** to reason over live blockchain data inside ChatGPT that can reason over and respond with live blockchain data directly inside ChatGPT.

## What the Token API Enables in Custom GPTs

When a Custom GPT is wired to the Token API, it gains access to a machine-readable schema and authenticated endpoints. Developers can use this to:

- **Query real-time onchain data**: Balances, token prices, liquidity, and transaction history.
- **Automate domain-specific tasks**: Portfolio tracking, accounting, reconciliation, and market analysis.
- **Power AI agents with verifiable blockchain context**: Use the same data sources dapps rely on.

Because the Token API provides a machine-readable schema and authenticated requests, it serves as a structured data layer that enables GPT-5 agents to combine natural language reasoning with live onchain data from The Graph.

## When to Use the Token API for Custom GPTs

Use the Token API when your GPT needs repeatable, domain-specific behavior grounded in blockchain data. This is most effective when the GPT performs the same type of task frequently or enforces a workflow you define. For one-off or exploratory questions, standard ChatGPT prompts are sufficient.

## Choosing a Use Case

Start with a clear, narrow objective, then expand as needed. Common patterns include:

- **Accounting GPT**: Onchain accounting, tax tagging, and portfolio reconciliation.
- **Trading GPT**: Liquidity, pricing, and volume analysis for trading strategies.
- **Protocol Tracking GPT**: Real-time monitoring of transaction activity and liquidity pools.

A focused initial goal such as “Retrieve token balances and prices for a wallet” makes it easier to configure reliable behavior before adding complex workflows.

## Requirements

| Requirement | Description |
| ---------------------- | -------------------------------------------------------- |
| ChatGPT 5 | Custom GPT creation requires GPT-5 tier or Pro. |
| Token API Subscription | Sign up at [The Graph Market](https://thegraph.market./) |
| Token API Key | Available in your dashboard as the Authentication JWT. |

## Setting Up a Custom GPT

Below is an explanatory outline of what happens during setup. This section provides conceptual understanding.

### Create Custom GPT

1. Visit chat.openai.com/gpts in your browser. 2, Click Create (top right).
2. Under Configure (in the top left panel), set up your GPT's personality and scope.

### Configure Your GPT

You define the GPT's role, scope, and metadata so it knows what it is designed to do. This includes:

- **Name and Description**: Helps users discover your GPT.
- For example: **Name**: Token Tracker GPT **Description**: An onchain analytics assistant that retrieves live token balances, prices, and liquidity data using The Graph's Token API.
- **Instructions**: Tells the GPT what tasks it should perform using the Token API.
- For example: You are a blockchain data assistant retrieving onchain token data from The Graph's Token API. Use endpoints to fetch balances, liquidity, and price history across EVM chains. Present results in tables with token symbols, prices, and USD values.
- **Knowledge**: Optional context files such as wallet references, accounting rules, or code snippets.
- **New Action**: At the bottom, click “Create new action” to connect your GPT to the Token API.

### Connect the Token API

To enable live blockchain queries inside ChatGPT, you connect the GPT to the Token API through:

#### Authentication

1. Set Authentication to API Key → Bearer.
2. Open [The Graph Market](https://thegraph.market./) and copy your Authentication JWT from your dashboard.
3. Paste the token into the ChatGPT prompt where the field shows [HIDDEN].

#### Schema

1. Above the Schema box, click Import from URL.
2. Paste: https://token-api.thegraph.com/openapi
3. Click Import. You'll now see endpoints like:
- `getV1EvmTokens`
- `getV1EvmDexes`
- `getV1EvmBalances`
4. Click Test on one (for example `getV1EvmDexes`) to verify connection.

##### Privacy

1. At the bottom, under Privacy, paste: https://pinax.network/en/legal/privacy

### Privacy

You can attach a privacy policy URL such as: https://pinax.network/en/legal/privacy

## Example Prompt Patterns

These examples help illustrate how a GPT reasons over Token API data.

### Wallet and Portfolio

Get the total USD balance for a wallet across multiple chains, returning token name, symbol, balance, and price.

### Trading Analysis

Compare USDC and DAI liquidity across Uniswap and Curve. Return the top 5 pools by TVL.

### Accounting

List all ERC-20 transfers for this address in the last 30 days. Group by token and total incoming/outgoing volume.

## Best Practices

| Tip | Why It Matters |
| --------------------------------- | ---------------------------------------------------------------------- |
| Scope your GPT narrowly first | Simplifies debugging and validates schema integration. |
| Use clear role instructions | Helps the GPT choose the right endpoints and avoid assumptions. |
| Name endpoints explicitly | Improves routing accuracy when fetching balances, prices, or DEX data. |
| Combine with code | Enables custom parsing or logic for complex workflows. |
| Add Subgraph or Substream context | Provides richer analytics when combined with Token API data. |

## FAQs & Resources

- Builders Office Hours (October 23, 2025)
- Watch the full session: https://x.com/i/broadcasts/1mrGmBzBarNJy
Loading