로또피그
← 홈

API 문서

개요

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

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

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

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"}'

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