API 문서

AI 인사이트 허브 REST API 문서입니다. 봇 연동, 외부 서비스 연동에 활용하세요.

인증 방법

Authorization: Bearer {BOT_API_SECRET}

🔒 표시된 엔드포인트는 API 키 인증이 필요합니다

게시글 API

GET/api/posts

게시글 목록 조회

Query Params: category, page, limit, tag

예시:

GET /api/posts?category=ai-news&page=1&limit=10
GET/api/posts/:id

단일 게시글 조회 (id 또는 slug)

예시:

GET /api/posts/my-post-slug
POST/api/posts🔒 인증 필요

게시글 생성 (봇/관리자)

Request Body:

{ title, content, excerpt, category_slug, tags, cover_image, source_url, is_members_only }
PUT/api/posts/:id🔒 인증 필요

게시글 수정

DELETE/api/posts/:id🔒 인증 필요

게시글 삭제

봇 API

POST/api/bot/post🔒 인증 필요

봇 자동 게시글 생성 + Notion 자동 백업

Request Body:

{ title, content, excerpt?, category_slug?, tags?, cover_image?, source_url?, is_members_only? }

예시:

curl -X POST https://yoursite.com/api/bot/post \ -H "Authorization: Bearer YOUR_BOT_SECRET" \ -H "Content-Type: application/json" \ -d '{"title":"AI 뉴스", "content":"내용...", "category_slug":"ai-news"}'
GET/api/bot/post🔒 인증 필요

봇 작업 로그 조회

Notion 백업 API

POST/api/notion-backup🔒 인증 필요

게시글 Notion 동기화

Request Body:

{ post_id: "uuid" } 또는 { sync_all: true }
GET/api/notion-backup🔒 인증 필요

Notion 동기화 로그 조회

강의 API

GET/api/courses

강의 목록

Query Params: level (beginner/intermediate/advanced), free (true/false)
POST/api/courses🔒 인증 필요

강의 생성

Request Body:

{ title, description, thumbnail, price, is_free, level, tags }

멤버 API

GET/api/members🔒 인증 필요

멤버 목록 조회

POST/api/members🔒 인증 필요

멤버십 업데이트

Request Body:

{ user_id, tier (free/basic/premium), expires_at? }

봇 빠른 시작 예시 (Python)

import requests

BOT_SECRET = "your_bot_secret"
BASE_URL = "https://yoursite.com"

headers = {
    "Authorization": f"Bearer {BOT_SECRET}",
    "Content-Type": "application/json"
}

# 게시글 자동 생성 + Notion 백업
response = requests.post(
    f"{BASE_URL}/api/bot/post",
    headers=headers,
    json={
        "title": "2026년 AI 트렌드 정리",
        "content": "올해 주목할 AI 트렌드...",
        "category_slug": "ai-news",
        "tags": ["AI트렌드", "2026"],
        "source_url": "https://example.com/article"
    }
)

print(response.json())
# {"message": "게시글이 성공적으로 생성되었습니다", "post_id": "uuid..."}