로또피그

API 문서

개요

아래 엔드포인트는 API 키 없이 호출할 수 있는 공개 구간입니다. 회원·관리자 전용, 웹훅, 크론 등은 포함하지 않습니다. 응답은 기본적으로 JSON이며, 많은 목록 API에 Cache-Control이 설정되어 있습니다.

기준 URL: https://www.lottopig.kr

Postman: Import → Link → https://www.lottopig.kr/api-docs/openapi.json

모바일 앱 빌드 (AI·에이전트용)

Expo / React Native / Flutter 클라이언트를 만들 때 아래 순서로 붙이면 MVP가 됩니다. 로그인 없이 공개 API만으로 홈·추천·생성·이력·통계가 가능합니다.

  1. 최신 회차 → GET /api/lotto/latest-round + GET /api/lotto/draws?round=
  2. 이번주 추천·제외 → GET /api/lotto/ensemble-recommend?backtestN=0&includeBacktestRows=0 (UI는 next.recommendDisplaySix · next.excluded)
  3. 번호 생성 → POST /api/lotto/combination
  4. 이력·통계 → /api/lotto/history, /api/lotto/statistics?recent=52
  5. (선택) Expo 푸시 → Supabase 로그인 후 Bearer로 POST /api/expo-push/register

저장소 상세 가이드: docs/MOBILE_APP_API.md — AI 채팅에 파일 통째로 넣으면 됩니다. OpenAPI는 코드젠·Postman용.

# 가벼운 추천 스냅샷
curl -sS "https://www.lottopig.kr/api/lotto/ensemble-recommend?backtestN=0&includeBacktestRows=0"

# 조합 5세트
curl -sS -X POST "https://www.lottopig.kr/api/lotto/combination" \
  -H "Content-Type: application/json" \
  -d '{"recommendedNumbers":[3,12,19,22,31,40],"excludeNumbers":[1,2],"count":5,"algorithm":"smart"}'

AI·에이전트용 통합 문서 (토큰)

LLM·RAG·CI에 한 번에 주입하기 좋은 마크다운 단일 문서입니다. 서버 환경 변수 AI_DOCS_TOKEN(8자 이상)을 아는 경우에만 열람할 수 있습니다.

  • 브라우저: /ai-docs 에서 토큰 입력 후 30일 쿠키
  • HTTP: GET https://www.lottopig.kr/api/ai-docs + Authorization: Bearer … (또는 X-Lottopig-AI-Docs-Token)
  • JSON으로 받기: Accept: application/json → { format, version, body }
curl -sS -H "Authorization: Bearer $AI_DOCS_TOKEN" \
  -H "Accept: text/markdown" \
  "https://www.lottopig.kr/api/ai-docs"

GET /api/time

서버 UTC·KST 시각, Unix 타임스탬프.

curl -sS "https://www.lottopig.kr/api/time"

GET /api/lotto/latest-round

최신 완료 회차 번호만 { "round": number }.

curl -sS "https://www.lottopig.kr/api/lotto/latest-round"

GET /api/lotto/draws

  • ?round=1200 — 단건
  • ?limit=30&offset=0 — 페이지 (total, draws)
  • 쿼리 없음 — 기본 최신 200건 (limited: true)
  • ?all=1 — 전체 (대용량)
curl -sS "https://www.lottopig.kr/api/lotto/draws?round=1200"

POST /api/lotto/draws-batch

본문 { "rounds": [1199, 1200] } 최대 80개 회차.

curl -sS -X POST "https://www.lottopig.kr/api/lotto/draws-batch" \
  -H "Content-Type: application/json" \
  -d '{"rounds":[1199,1200,1201]}'

GET /api/lotto/history

cursor, limit, machineNo, numbers, oddCount, lowCount 등 필터·페이지네이션.

curl -sS "https://www.lottopig.kr/api/lotto/history?limit=10"

GET /api/lotto/rounds

전체 배열(최신 우선). 용량이 크므로 필요 시 draws/draws-batch 권장.

curl -sS "https://www.lottopig.kr/api/lotto/rounds" | head -c 500

GET /api/round/{id}

회차 단건 (레거시 경로, draws?round= 와 동일 계열).

curl -sS "https://www.lottopig.kr/api/round/1200"

GET /api/lotto/statistics

선택 쿼리 ?recent=100 — 최근 N회만 반영해 집계.

curl -sS "https://www.lottopig.kr/api/lotto/statistics?recent=52"

GET /api/lotto/ensemble-recommend

다음 회 추천A와 제외 5, 그리고 백테스트 메타. ?machine=latest, ?backtestN= 범위, ?includeBacktestRows=0이면 적중 수만 읽고 backtest 배열은 비움(표 상세는 아래 backtest API).

curl -sS "https://www.lottopig.kr/api/lotto/ensemble-recommend?backtestN=0"

GET /api/lotto/ensemble-recommend/backtest

백테스트 회차별 상세(당첨·추천·제외 공) 페이지. ?offset=0&limit=60

curl -sS "https://www.lottopig.kr/api/lotto/ensemble-recommend/backtest?offset=0&limit=20"

GET /api/lotto/ensemble-guided-sets

백테스트 «추천 적중·제외 적중» 분포를 PMF로 쓰고 6/45 세트를 생성합니다. ?sets=10 (기본 10, 최대 50), ?machine=latest, 캐시 히트 시 ?backtestSlice=2500 으로 분포용 회차 수 조절.

curl -sS "https://www.lottopig.kr/api/lotto/ensemble-guided-sets?sets=5"

POST /api/lotto/combination

추천·제외 번호와 알고리즘·전략으로 조합 생성. 필드 상세는 OpenAPI JSON의 CombinationPostBody 참고.

curl -sS -X POST "https://www.lottopig.kr/api/lotto/combination" \
  -H "Content-Type: application/json" \
  -d '{"recommendedNumbers":[3,12,19,22,31,40],"excludeNumbers":[1,2],"count":3,"algorithm":"smart"}'

엑셀분석 JSON

/excel-analysis/* 전체 탭(궁수·출현간격·용지 등)은 SSR만 있고 매트릭스 공개 API는 없습니다. 앱용 JSON:

  • GET /api/home/excel-analysis?tab=ai-rec — 홈 시트 그룹 1개
  • GET /api/lotto/excel-analysis/ai-recommend-history?limit=10
  • GET /api/lotto/excel-analysis/ai-exclude-history?count=5&limit=10
curl -sS "https://www.lottopig.kr/api/home/excel-analysis?tab=ai-rec"
curl -sS "https://www.lottopig.kr/api/lotto/excel-analysis/ai-recommend-history?limit=5"

패턴 · 표시용 추천

  • GET /api/lotto/combination-recommend
  • GET /api/lotto/variable-pattern
  • GET /api/lotto/weekly-pattern-summary
  • GET /api/lotto/ultimate-recommend · GET /api/lotto/backtest
curl -sS "https://www.lottopig.kr/api/lotto/variable-pattern"

GET /api/community/recent-posts

공개 캐러셀용 최근 구매인증(최대 20). 회원전용 보드는 본문·번호·이미지 null. 조회수: POST /api/community/{id}/view. 글쓰기·댓글은 REST 거의 없음(Supabase/웹뷰).

curl -sS "https://www.lottopig.kr/api/community/recent-posts"

공유 · 판매점

  • POST /api/share · GET /api/share/{shortId}
  • GET /api/lotto/retailers?drwNo= · /retailers/legend · /shops · /shops/list

GET /api/site-popups/active

현재 노출 팝업 1건 또는 { popup: null }.

curl -sS "https://www.lottopig.kr/api/site-popups/active"

푸시 (Bearer 필요)

Supabase 로그인 후 Authorization: Bearer <access_token>. Expo: POST /api/expo-push/register 본문 { expoPushToken, platform }. FCM: POST /api/native-push/register.

로또피그는 공식 기관이 아니며, API 결과는 참고용입니다. 상업적 대량 이용 전 support@lottopig.kr로 문의해 주세요.