Content Orchestration API

v1 · Base URL: https://content-orchestration.vercel.app

Authentication: Authorization: Bearer {CONTENT_OS_API_KEY} (환경변수 미설정 시 인증 스킵)

System

GET/api/v1/healthNo Auth

DB 연결 상태 및 응답 지연 확인. 인증 불필요.

Response
{ "success": true, "data": { "status": "ok", "db": "connected", "latency_ms": 12 } }
GET/api/v1/stats

전체 캠페인/채널/콘텐츠 통계 요약.

Response
{ "success": true, "data": { "campaigns": { "total": 1, "active": 1 }, "channels": { "total": 4, "connected": 1 }, "contents": { "total": 20, "published": 4, "draft": 4, "unwritten": 4 } } }
POST/api/seedNo Auth

샘플 데이터 삽입 (멱등성 보장 — 이미 존재하면 스킵).

Response
{ "success": true, "message": "시드 완료: 캠페인 1개, 채널 4개, 콘텐츠 20개", "seeded": true }

Campaigns

GET/api/v1/campaigns

캠페인 목록 (콘텐츠 통계 포함).

Response
{ "success": true, "data": [{ "id": "...", "name": "AI 설계자 세일즈 PLF", "status": "active", "stats": { "total": 20, "published": 4 } }] }
POST/api/v1/campaigns

새 캠페인 생성.

Request Body
{ "name": "캠페인 이름", "description": "설명", "goal": "목표", "type": "campaign", "start_date": 1740787200000, "end_date": 1743206400000 }
Response
{ "success": true, "data": { "id": "uuid" } }
GET/api/v1/campaigns/:id

캠페인 단건 조회 (통계 포함).

Response
{ "success": true, "data": { "id": "...", "name": "...", "stats": { ... } } }
PUT/api/v1/campaigns/:id

캠페인 수정. status 값: active | paused | completed | archived

Request Body
{ "name": "새 이름", "status": "completed" }
Response
{ "success": true, "data": { ... } }
GET/api/v1/campaigns/:id/contents

캠페인 콘텐츠 목록. Query: status, channel_id

Response
{ "success": true, "data": { "campaign": {...}, "contents": [...], "grouped_by_channel": {...} } }

Channels

GET/api/v1/channels

채널 목록.

Response
{ "success": true, "data": [{ "id": "...", "name": "리치부캐 인스타그램", "platform": "instagram" }] }
POST/api/v1/channels

채널 추가. platform: instagram | youtube | newsletter | blog | facebook | x

Request Body
{ "name": "채널명", "platform": "instagram", "account_name": "@account", "connection_type": "getlate", "connection_status": "disconnected" }
Response
{ "success": true, "data": { "id": "uuid" } }
GET/api/v1/channels/:id

채널 단건 조회.

Response
{ "success": true, "data": { ... } }
PUT/api/v1/channels/:id

채널 수정. connection_status: connected | disconnected | error

Request Body
{ "connection_status": "connected" }
Response
{ "success": true, "data": { ... } }
GET/api/v1/channels/:id/contents

채널 콘텐츠 목록. Query: status, campaign_id

Response
{ "success": true, "data": { "channel": {...}, "contents": [...], "grouped_by_campaign": {...} } }

Contents

GET/api/v1/contents

콘텐츠 목록. Query: campaign_id, channel_id, status, q(검색어)

Response
{ "success": true, "data": { "contents": [...], "total": 20 } }
POST/api/v1/contents

콘텐츠 슬롯 생성. status 기본값: unwritten

Request Body
{ "title": "콘텐츠 제목", "campaign_id": "uuid", "channel_id": "uuid", "content_body": "본문 (선택)", "scheduled_at": 1741132800000, "status": "unwritten" }
Response
{ "success": true, "data": { "id": "uuid" } }
GET/api/v1/contents/:id

콘텐츠 단건 조회.

Response
{ "success": true, "data": { ... } }
PUT/api/v1/contents/:id

콘텐츠 본문/제목 수정. 상태 변경은 /transition 사용.

Request Body
{ "title": "수정 제목", "content_body": "작성된 본문 내용" }
Response
{ "success": true, "data": { ... } }
POST/api/v1/contents/:id/transition

상태 전환 (워크플로우 핵심). 허용 전환: unwritten->draft, draft->review, review->approved|draft, approved->scheduled, scheduled->published

Request Body
{ "to": "review" }
Body Examples
  • 검토요청: { "to": "review" }
  • 반려: { "to": "draft", "rejected_reason": "수정 필요 사항" }
  • 승인: { "to": "approved", "approved_by": "VP/CEO" }
  • 예약: { "to": "scheduled", "scheduled_at": 1741132800000 }
  • 발행완료: { "to": "published" }
Response
{ "success": true, "data": { "content": {...}, "transition": { "from": "draft", "to": "review" } } }

AI 에이전트 통합 예시 (curl)

# 1. 헬스체크
curl https://content-orchestration.vercel.app/api/v1/health

# 2. 샘플 데이터 시드 (최초 1회)
curl -X POST https://content-orchestration.vercel.app/api/seed

# 3. 캠페인 목록 조회
curl -H "Authorization: Bearer YOUR_KEY" https://content-orchestration.vercel.app/api/v1/campaigns

# 4. 콘텐츠 슬롯 생성 (AI가 작성할 슬롯)
curl -X POST https://content-orchestration.vercel.app/api/v1/contents \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"새 인스타그램 포스트","campaign_id":"CAMPAIGN_ID","channel_id":"CHANNEL_ID","status":"unwritten"}'

# 5. 콘텐츠 본문 작성 (AI가 생성한 본문 업데이트)
curl -X PUT https://content-orchestration.vercel.app/api/v1/contents/CONTENT_ID \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content_body":"AI가 작성한 본문 내용..."}'

# 6. 검토 요청
curl -X POST https://content-orchestration.vercel.app/api/v1/contents/CONTENT_ID/transition \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"review"}'

# 7. 발행 예약
curl -X POST https://content-orchestration.vercel.app/api/v1/contents/CONTENT_ID/transition \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"scheduled","scheduled_at":1741132800000}'