API 레퍼런스

V1 LLM API

LLM 에이전트, 자동화 스크립트, 통합을 위한 읽기 전용 API예요. 노션 워크스페이스의 그래프 데이터에 접근해 검색, 노드 상세 정보 조회, 페이지 콘텐츠 조회, 그래프 탐색을 할 수 있어요. US$1.99 Pro 1주 이용권을 포함한 Pro 및 Max 요금제에서 사용할 수 있어요.

개요

속성 값
기본 URL /v1/graph/
인증 서비스 토큰 (Authorization: Bearer ivg_*)
요금제 Pro 및 Max, US$1.99 Pro 1주 이용권 포함
형식 JSON
요청 한도 단기 요청 한도: 10초당 20건, 15분 구간당 600건
자체 설명형 명세 GET /v1/ (인증 불필요)

요금제

AI 에이전트용 API는 월간 또는 연간 Pro 및 Max 요금제와 US$1.99 Pro 1주 이용권에 포함돼요. Free와 Plus에서는 서비스 토큰을 사용하는 모든 요청에 403이 반환되며, 새 토큰을 생성할 때도 동일하게 403이 반환돼요:

{
  "error": "API for AI agents is part of the Pro and Max plans. This account does not have an active Pro or Max plan. Upgrade at https://ivgraph.com/billing/ and your API keys will work right away.",
  "code": "api_plan_required",
  "upgrade_url": "https://ivgraph.com/billing/"
}
  • 텍스트가 아닌 code를 확인하세요. api_plan_required는 계정의 요금제에 API가 포함되어 있지 않다는 뜻이에요.
  • API가 포함되지 않은 요금제에서는 토큰이 삭제되거나 폐기되지 않고 일시 중지돼요. 계정에 Pro 또는 Max 요금제가 적용되는 즉시 같은 토큰을 다시 사용할 수 있어요.
  • 구독 취소나 체험 기간 종료 시에도 마찬가지로 요금제가 다시 활성화될 때까지 토큰이 일시 중지돼요. 결제 실패로 토큰이 일시 중지되는 것은 계정이 Free로 전환될 때예요. 갱신 결제에 실패하면 Stripe가 결제를 다시 시도하는 동안 결제 기간 시작일부터 최대 15일까지 요금제가 계속 유지되고, US$1.99 Pro 1주 이용권 이후 첫 결제에 실패하면 계정이 바로 Free로 전환돼요.
  • 유효하지 않거나 폐기되었거나 만료된 토큰은 여전히 401을 반환해요. 유효한 토큰에 대해서만 요금제를 확인해요.
  • 어떤 요금제에서든 토큰을 폐기할 수 있어요.

공통 매개변수

모든 엔드포인트에 workspace_id가 필요합니다:

매개변수 유형 필수 여부 설명
workspace_id 문자열 (UUID) 예 노션 워크스페이스의 UUID입니다. 토큰에서 허용하는 workspace_ids에 포함되어 있어야 합니다.

엔드포인트


GET /v1/graph/search/

워크스페이스 전체에서 제목으로 노드를 검색해요. Elasticsearch를 사용할 수 있으면 사용하고, 그렇지 않으면 메모리 내에서 일치하는 항목을 찾아요.

권한 범위: graph:search

매개변수:

매개변수 유형 필수 여부 기본값 설명
q string 필수 — 검색어 (최대 256자)
workspace_id string 필수 — 대상 워크스페이스 UUID
limit int 선택 20 페이지당 결과 수 (최대 50개)
type string 선택 all 필터: page, database 또는 user

요청 예시:

curl -H "Authorization: Bearer ivg_your_token" \
  "https://ivgraph.com/v1/graph/search/?q=project&workspace_id=abc-123&limit=5"
import requests

resp = requests.get(
    "https://ivgraph.com/v1/graph/search/",
    headers={"Authorization": "Bearer ivg_your_token"},
    params={"q": "project", "workspace_id": "abc-123", "limit": 5}
)
data = resp.json()
const resp = await fetch(
  "https://ivgraph.com/v1/graph/search/?q=project&workspace_id=abc-123&limit=5",
  { headers: { Authorization: "Bearer ivg_your_token" } }
);
const data = await resp.json();

응답:

{
  "query": "project",
  "total": 3,
  "results": [
    {"id": "550e8400-e29b-41d4-a716-446655440001", "type": "page", "title": "Project Alpha", "score": 0.95},
    {"id": "550e8400-e29b-41d4-a716-446655440002", "type": "database", "title": "Projects Tracker", "score": 0.72},
    {"id": "550e8400-e29b-41d4-a716-446655440003", "type": "page", "title": "Project Notes", "score": 0.61}
  ]
}

오류:

상태 의미
400 q 또는 workspace_id가 누락되었거나, 쿼리가 너무 길거나, 허용되지 않는 문자가 포함되어 있습니다
401 서비스 토큰이 누락되었거나 유효하지 않습니다
403 요금제에 API가 포함되어 있지 않거나(api_plan_required), 토큰에 graph:search 범위 권한이 없거나, 워크스페이스가 허용 목록에 없습니다
404 이 워크스페이스에 동기화된 데이터가 없습니다
429 요청 한도를 초과했습니다

GET /v1/graph/nodes/{node_id}/

제목, 유형, URL, 아이콘, 연결 수, 페이지랭크, 속성 등 안전한 필드가 모두 포함된 단일 노드를 가져와요.

권한 범위: graph:read

매개변수:

매개변수 유형 필수 여부 설명
node_id UUID 필수 노드 ID(URL 경로에 포함)
workspace_id string 필수 대상 워크스페이스 UUID

요청 예시:

curl -H "Authorization: Bearer ivg_your_token" \
  "https://ivgraph.com/v1/graph/nodes/550e8400-e29b-41d4-a716-446655440001/?workspace_id=abc-123"
import requests

node_id = "550e8400-e29b-41d4-a716-446655440001"
resp = requests.get(
    f"https://ivgraph.com/v1/graph/nodes/{node_id}/",
    headers={"Authorization": "Bearer ivg_your_token"},
    params={"workspace_id": "abc-123"}
)
node = resp.json()["node"]
const nodeId = "550e8400-e29b-41d4-a716-446655440001";
const resp = await fetch(
  `https://ivgraph.com/v1/graph/nodes/${nodeId}/?workspace_id=abc-123`,
  { headers: { Authorization: "Bearer ivg_your_token" } }
);
const { node } = await resp.json();

응답:

{
  "node": {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "type": "page",
    "title": "Project Alpha",
    "url": "https://www.notion.so/Project-Alpha-550e8400e29b41d4a716446655440001",
    "icon": {"type": "emoji", "emoji": "\ud83d\ude80"},
    "connections_in": 5,
    "connections_out": 12,
    "connections_total": 17,
    "pagerank": 0.42,
    "properties": {}
  }
}

오류:

상태 의미
400 node_id 형식이 잘못되었거나 workspace_id가 누락되었습니다
401 서비스 토큰이 누락되었거나 유효하지 않습니다
403 요금제에 API가 포함되어 있지 않거나(api_plan_required), 토큰에 graph:read 권한 범위가 없거나, 허용되지 않은 워크스페이스입니다
404 노드를 찾을 수 없거나 워크스페이스에 동기화된 데이터가 없습니다
429 요청 한도를 초과했습니다

GET /v1/graph/content/{page_id}/

페이지 콘텐츠를 마크다운과 일반 텍스트로 가져오세요. 콘텐츠는 Airbyte를 통해 동기화된 노션 블록에서 추출돼요.

권한 범위: graph:read

매개변수:

매개변수 유형 필수 여부 설명
page_id UUID 필수 페이지 ID(URL 경로에 포함)
workspace_id string 필수 대상 워크스페이스 UUID

요청 예시:

curl -H "Authorization: Bearer ivg_your_token" \
  "https://ivgraph.com/v1/graph/content/550e8400-e29b-41d4-a716-446655440001/?workspace_id=abc-123"
import requests

page_id = "550e8400-e29b-41d4-a716-446655440001"
resp = requests.get(
    f"https://ivgraph.com/v1/graph/content/{page_id}/",
    headers={"Authorization": "Bearer ivg_your_token"},
    params={"workspace_id": "abc-123"}
)
content = resp.json()
print(content["markdown"])
const pageId = "550e8400-e29b-41d4-a716-446655440001";
const resp = await fetch(
  `https://ivgraph.com/v1/graph/content/${pageId}/?workspace_id=abc-123`,
  { headers: { Authorization: "Bearer ivg_your_token" } }
);
const { markdown, plain_text } = await resp.json();

응답:

{
  "page_id": "550e8400-e29b-41d4-a716-446655440001",
  "title": "Project Alpha",
  "markdown": "# Project Alpha\n\nThis is the main project page.\n\n## Goals\n\n- Launch beta by Q2\n- Reach 100 users",
  "plain_text": "Project Alpha\nThis is the main project page.\nGoals\nLaunch beta by Q2\nReach 100 users",
  "has_content": true
}

오류:

상태 의미
400 page_id 형식이 올바르지 않거나 workspace_id가 누락됨
401 서비스 토큰이 누락되었거나 유효하지 않음
403 요금제에 API가 포함되지 않거나(api_plan_required), 토큰에 graph:read 권한 범위가 없거나, 허용되지 않은 워크스페이스임
404 페이지를 찾을 수 없거나 워크스페이스에 동기화된 데이터가 없음
429 요청 빈도 제한 초과

GET /v1/graph/neighbors/{node_id}/

BFS 탐색으로 지정된 깊이까지의 이웃 노드와 간선을 반환해요. 특정 노드 주변의 국소적인 그래프 구조를 살펴볼 때 유용해요.

범위: graph:neighbors

매개변수:

매개변수 유형 필수 여부 기본값 설명
node_id UUID 예 — 탐색을 시작할 노드 ID(URL 경로에 포함)
workspace_id string 예 — 대상 워크스페이스 UUID
depth int 아니요 1 탐색 깊이(최대 3)
limit int 아니요 20 반환할 인접 노드의 최대 수(최대 50)
direction string 아니요 both 간선 방향: in, out 또는 both

요청 예시:

curl -H "Authorization: Bearer ivg_your_token" \
  "https://ivgraph.com/v1/graph/neighbors/550e8400-e29b-41d4-a716-446655440001/?workspace_id=abc-123&depth=2&limit=10"
import requests

node_id = "550e8400-e29b-41d4-a716-446655440001"
resp = requests.get(
    f"https://ivgraph.com/v1/graph/neighbors/{node_id}/",
    headers={"Authorization": "Bearer ivg_your_token"},
    params={"workspace_id": "abc-123", "depth": 2, "limit": 10}
)
data = resp.json()
print(f"Found {data['total']} neighbors")
const nodeId = "550e8400-e29b-41d4-a716-446655440001";
const resp = await fetch(
  `https://ivgraph.com/v1/graph/neighbors/${nodeId}/?workspace_id=abc-123&depth=2&limit=10`,
  { headers: { Authorization: "Bearer ivg_your_token" } }
);
const { neighbors, edges, total } = await resp.json();

응답:

{
  "node_id": "550e8400-e29b-41d4-a716-446655440001",
  "depth": 2,
  "total": 4,
  "neighbors": [
    {"id": "550e8400-e29b-41d4-a716-446655440010", "type": "page", "title": "Sprint Planning"},
    {"id": "550e8400-e29b-41d4-a716-446655440011", "type": "database", "title": "Tasks"},
    {"id": "550e8400-e29b-41d4-a716-446655440012", "type": "page", "title": "Design Doc"},
    {"id": "550e8400-e29b-41d4-a716-446655440013", "type": "user", "title": "Alice"}
  ],
  "edges": [
    {"source": "550e8400-e29b-41d4-a716-446655440001", "target": "550e8400-e29b-41d4-a716-446655440010", "type": "reference"},
    {"source": "550e8400-e29b-41d4-a716-446655440001", "target": "550e8400-e29b-41d4-a716-446655440011", "type": "parent"},
    {"source": "550e8400-e29b-41d4-a716-446655440010", "target": "550e8400-e29b-41d4-a716-446655440012", "type": "mention"},
    {"source": "550e8400-e29b-41d4-a716-446655440012", "target": "550e8400-e29b-41d4-a716-446655440013", "type": "mention"}
  ]
}

오류:

상태 의미
400 node_id 형식이 잘못되었거나 workspace_id가 누락되었습니다
401 서비스 토큰이 누락되었거나 유효하지 않습니다
403 요금제에 API가 포함되어 있지 않거나(api_plan_required), 토큰에 graph:neighbors 권한 범위가 없거나, 허용되지 않은 워크스페이스입니다
404 노드를 찾을 수 없거나 워크스페이스에 동기화된 데이터가 없습니다
429 요청 속도 제한을 초과했습니다

POST /v1/graph/traverse/

BFS로 두 노드 사이의 최단 경로를 찾아요. 경로를 노드가 순서대로 나열된 목록으로 반환하며, 최대 깊이 내에 경로가 없으면 null을 반환해요.

범위: graph:neighbors

요청 본문(JSON):

매개변수 유형 필수 여부 기본값 설명
start_id UUID 예 — 시작 노드
target_id UUID 예 — 대상 노드
workspace_id string 예 — 대상 워크스페이스 UUID
max_depth int 아니요 3 최대 탐색 깊이(최대 3)

요청 예시:

curl -X POST "https://ivgraph.com/v1/graph/traverse/" \
  -H "Authorization: Bearer ivg_your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "start_id": "550e8400-e29b-41d4-a716-446655440001",
    "target_id": "550e8400-e29b-41d4-a716-446655440012",
    "workspace_id": "abc-123"
  }'
import requests

resp = requests.post(
    "https://ivgraph.com/v1/graph/traverse/",
    headers={
        "Authorization": "Bearer ivg_your_token",
        "Content-Type": "application/json"
    },
    json={
        "start_id": "550e8400-e29b-41d4-a716-446655440001",
        "target_id": "550e8400-e29b-41d4-a716-446655440012",
        "workspace_id": "abc-123"
    }
)
path = resp.json()["path"]
const resp = await fetch("https://ivgraph.com/v1/graph/traverse/", {
  method: "POST",
  headers: {
    Authorization: "Bearer ivg_your_token",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    start_id: "550e8400-e29b-41d4-a716-446655440001",
    target_id: "550e8400-e29b-41d4-a716-446655440012",
    workspace_id: "abc-123"
  })
});
const { path, path_length } = await resp.json();

응답(경로 찾음):

{
  "start": "550e8400-e29b-41d4-a716-446655440001",
  "target": "550e8400-e29b-41d4-a716-446655440012",
  "path_length": 2,
  "path": [
    {"id": "550e8400-e29b-41d4-a716-446655440001", "type": "page", "title": "Project Alpha"},
    {"id": "550e8400-e29b-41d4-a716-446655440010", "type": "page", "title": "Sprint Planning"},
    {"id": "550e8400-e29b-41d4-a716-446655440012", "type": "page", "title": "Design Doc"}
  ]
}

응답(경로 없음):

{
  "start": "550e8400-e29b-41d4-a716-446655440001",
  "target": "550e8400-e29b-41d4-a716-446655440099",
  "path_length": null,
  "path": []
}

오류:

상태 의미
400 start_id/target_id/workspace_id가 누락되었거나 유효하지 않습니다
401 서비스 토큰이 누락되었거나 유효하지 않습니다
403 요금제에 API가 포함되어 있지 않거나(api_plan_required), 토큰에 graph:neighbors 권한 범위가 없거나, 허용되지 않은 워크스페이스입니다
404 시작 노드 또는 대상 노드를 찾을 수 없거나, 동기화된 데이터가 없습니다
429 요청 한도를 초과했습니다

스스로를 설명하는 명세

GET /v1/은 전체 API 명세를 JSON으로 반환해요. 인증은 필요하지 않아요.

curl "https://ivgraph.com/v1/"

모든 엔드포인트, 매개변수, 응답 스키마, 요청 속도 제한, 권한 범위, API가 포함된 요금제 정보가 담긴 기계가 읽을 수 있는 JSON을 반환해요. LLM 에이전트가 프로그래밍 방식으로 API를 탐색할 때 유용해요.