API リファレンス

グラフ API

グラフ API は、Notion ワークスペースのグラフを返します。このグラフは、ノード(ページ、データベース、ユーザー)と、それらのつながり(エッジ)で構成されます。IVGraph の3D可視化で使用される主要なエンドポイントです。Free プランでは、500ノードを超えるワークスペースは5分間すべて表示され、その後はつながりの多い上位500ノードに絞られます(下記参照)。

認証には IVGraph のログイン(JWT)を使用します。このエンドポイントではサービストークン(ivg_…)は使用できません。AI エージェントは、Pro および Max プランで V1 LLM API を使用します。

GET /api/notion-graph/

認証済みユーザーのワークスペースのグラフを返します。

認証: JWT(デモモードでは認証不要)

パラメータ:

パラメータ 型 必須 デフォルト 説明
demo string いいえ — true に設定するとデモデータを返します(認証不要)
workspace_id UUID いいえ primary 読み込むワークスペースを指定します
connection_id UUID いいえ — Airbyte 接続を指定します
admin_user int いいえ — ユーザー ID を上書きします(スタッフのみ)

リクエスト例:

# Authenticated user's graph
curl -H "Authorization: Bearer <jwt_token>" \
  "https://ivgraph.com/api/notion-graph/"

# Demo mode (no auth)
curl "https://ivgraph.com/api/notion-graph/?demo=true"

# Specific workspace
curl -H "Authorization: Bearer <jwt_token>" \
  "https://ivgraph.com/api/notion-graph/?workspace_id=abc-123"
import requests

resp = requests.get(
    "https://ivgraph.com/api/notion-graph/",
    headers={"Authorization": "Bearer <jwt_token>"}
)
graph = resp.json()
print(f"{graph['stats']['nodes']} nodes, {graph['stats']['links']} edges")
const resp = await fetch("https://ivgraph.com/api/notion-graph/", {
  headers: { Authorization: "Bearer <jwt_token>" }
});
const graph = await resp.json();
console.log(`${graph.stats.nodes} nodes, ${graph.stats.links} edges`);

レスポンス:

{
  "nodes": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "type": "page",
      "title": "Project Alpha",
      "url": "https://www.notion.so/Project-Alpha-550e8400...",
      "icon": {"type": "emoji", "emoji": "\ud83d\ude80"},
      "connections_in": 5,
      "connections_out": 12,
      "connections_total": 17,
      "pagerank": 0.42
    }
  ],
  "links": [
    {
      "id": "edge-uuid",
      "source": "550e8400-e29b-41d4-a716-446655440001",
      "target": "550e8400-e29b-41d4-a716-446655440002",
      "type": "reference"
    }
  ],
  "metadata": {
    "generated_at": "2026-04-10T12:00:00Z",
    "user": "username",
    "connection_id": "conn-uuid",
    "sync_time": "2026-04-10T10:00:00Z"
  },
  "stats": {
    "nodes": 342,
    "links": 1205,
    "total_blocks": 4500
  }
}

グラフがプランのノード上限を超えた場合のレスポンス:

有料プラン(Plus、Pro、Max、Pro week)では、上限を超えても通知とともにグラフ全体が返されます。Free では、グラフを初めて開いてから5分間はグラフ全体が返されます(graph_preview.active が true)。その後は、つながりの多い上位500ノードと、それらを結ぶリンクのみが返されます。node_count は常にノードの総数を示します。Free で上限を超えた場合のレスポンスには、アプリ内に表示される $1.99 の Pro week オファーを示す pro_week も含まれます。

有料プランでノード上限を超えた場合:

{
  "nodes": ["..."],
  "links": ["..."],
  "metadata": {},
  "stats": {},
  "node_limit_exceeded": true,
  "node_limit": 3000,
  "node_count": 3420,
  "nodes_shown": 3420,
  "node_limit_truncated": false
}

Free プランで5分間のプレビューが終了した場合:

{
  "nodes": ["... 500 most connected nodes ..."],
  "links": ["... links between them ..."],
  "metadata": {},
  "stats": {},
  "node_limit_exceeded": true,
  "node_limit": 500,
  "node_count": 742,
  "nodes_shown": 500,
  "node_limit_truncated": true,
  "node_count_by_type": {"page": 690, "database": 40, "user": 12},
  "graph_preview": {"active": false, "started_at": "2026-10-27T09:00:00Z", "ends_at": "2026-10-27T09:05:00Z", "seconds_left": 0, "seconds": 300}
}

接続が存在しない場合のレスポンス:

{
  "nodes": [],
  "links": [],
  "metadata": {"status": "no_connection"},
  "stats": {"nodes": 0, "links": 0, "total_blocks": 0}
}

データスキーマ

ノード

フィールド 型 説明
id UUID Notion のページ/データベース/ユーザーの ID
type string page、database、または user
title string ページのタイトルまたはデータベース名
url string Notion の URL
icon object|null アイコンデータ(下記参照)
connections_in int このノードに入るエッジの数
connections_out int このノードから出るエッジの数
connections_total int エッジの総数
pagerank float PageRank スコア(0.0 — 1.0)

アイコン

フィールド 型 説明
type string emoji、file、または external
emoji string 絵文字(type=emoji の場合)
file.url string ファイルの URL(type=file の場合)
external.url string 外部 URL(type=external の場合)

エッジ

フィールド 型 説明
id UUID エッジの識別子
source UUID 接続元ノードの ID
target UUID 接続先ノードの ID
type string reference、parent、mention、または relation

エッジの種類

種類 説明
reference ページから別のページにリンクしています
parent ページがデータベースまたはページの子になっています
mention ページ内で別のページまたはユーザーがメンションされています
relation データベースのリレーションプロパティ