Skip to content

Batch API

Status: Active / Owner: Backend / Last Updated: 2026-05-05 (세션 103)

Overview

Sell-Po 배치 API는 keyword tracking, ML inference triggers, daily volume aggregation 을 처리합니다.

Endpoints

POST /api/batch/keywords

키워드 일괄 등록 (최대 100건 / 요청).

Request:

{
  "keywords": ["내성발톱 교정기", "스마트 워치"],
  "workspace_id": "ws_xxx"
}

Response:

{
  "success": true,
  "data": {
    "registered": 2,
    "skipped": 0
  }
}

POST /api/batch/trigger

Wave 4 ML 학습 trigger (수동, 일반적으로 cron 자동).

Request:

{
  "task": "train_classifier"
}

Pre-condition:

  • D+7 데이터 누적 (keyword_rank_history >= 1000 rows)
  • manifest.json status="active" (사후 검증 — scripts/wave4/d7_postcheck.sh)

GET /api/batch/volumes/{keyword}

월간 검색 volume 조회 (monthly_search_volumes 테이블).

Rate Limit

  • 100 req/min per workspace (slowapi 영속)
  • 429 응답 시 Retry-After 헤더 영속

Errors

Code Reason
400 invalid keyword (Pydantic v2 검증 실패)
401 missing/invalid Bearer token
429 rate limit exceeded
500 internal error (type(e).name 만 emit, A09 PII 0)
  • ADR-0123 (Wave 4 ML Default OFF)
  • ADR-0119 (ML threshold gate)
  • scripts/wave4/rollout_step.sh (rollout helper)