Korean tourism content (관광지·문화시설·축제공연·여행코스·레포츠·숙박·쇼핑·음식점) via 한국관광공사 TourAPI 4.0 (apis.data.go.kr/B551011/KorService2). Eight subcommands wrap areaCode2, cat...
Command-line wrapper for 한국관광공사 TourAPI 4.0 (KorService2) — Korea's first-party tourism content API. Curated and maintained by 한국관광공사 (Korea Tourism Organization), it's the data behind VisitKorea, 대한민국 구석구석, and most travel apps in Korea.
Eight subcommands, each wraps one (or one composite) endpoint:
CommandEndpoint(s)Purposescripts/area-code.sh``areaCode217개 광역시도 → 시군구 코드 트리.scripts/category-code.sh``categoryCode23-level cat1/cat2/cat3 service-classification tree.scripts/area.sh``areaBasedList2Browse content by area / sigungu / contentType / category.scripts/nearby.sh``locationBasedList2Radius search (≤20 km) from a (lng, lat) point.scripts/search.sh``searchKeyword2Keyword search with optional area/category filters.scripts/festival.sh``searchFestival2Festivals/events overlapping a date window.scripts/stay.sh``searchStay2Lodging-only browse (hotels, motels, pensions, hanok stays).scripts/detail.sh``detailCommon2 + detailIntro2 + detailInfo2 + detailImage2One-shot full record for a contentId.
All output is JSONL — one row per item — so it pipes directly into jq, csvkit, pandas, or downstream skills.
area --area-code 32 --sigungu-code 1 + nearby --lng <h1> --lat <h1> + festival --start 20260601.festival --start YYYYMMDD --end YYYYMMDD → JSONL → cal.json.search --keyword 강릉 then detail --content-id <id> --include-images for hero imagery + descriptions.nearby --lng X --lat Y --content-type-id 39 to surface restaurants.KorService2. KTO publishes parallel EngService2 / ChsService2 / JpnService2 / GerService2 / FreService2 / SpnService2 / RusService2 endpoints; not in this skill yet.Register at https://www.data.go.kr/ (Korean OpenData portal, free, no business required).
Apply for "한국관광공사_국문 관광정보 서비스_GW" (TourAPI 4.0 / KorService2). Approval is automatic for the dev tier.
Copy your Decoding key (the raw, not URL-encoded form) and export: bash
export TOURAPI_SERVICE_KEY='your_decoded_key_here'
Optional overrides: bash
export TOURAPI_BASE='https://apis.data.go.kr/B551011/KorService2'
export TOURAPI_MOBILE_OS='ETC' # ETC|AND|IOS|WIN|WEB
export TOURAPI_MOBILE_APP='your-app-name' # any short identifier
Dependencies: bash, curl, jq (default on macOS / standard Linux).
contentTypeId (used in --content-type-id):
IDTypeIDType12관광지28레포츠14문화시설32숙박15축제공연행사38쇼핑25여행코스39음식점
Top-level areaCode (run area-code.sh for fresh sigungu codes):
CodeRegionCodeRegionCodeRegion1서울32강원도6부산2인천33충청북도7대구31경기도34충청남도8광주35경상북도36경상남도9대전37전라북도38전라남도10울산39제주특별자치도11세종특별자치시
(Full canonical list always: bash scripts/area-code.sh.)
Top-level cat1: A01=자연 / A02=인문(문화/예술/역사) / A03=레포츠 / A04=쇼핑 / A05=음식 / B02=숙박 / C01=추천코스.
bash
bash scripts/area.sh --area-code 32 --sigungu-code 1 --content-type-id 12 --num 10
bash
bash scripts/nearby.sh --lng 126.9770 --lat 37.5797 --radius 500 --content-type-id 39
bash
bash scripts/festival.sh --start 20260501 --end 20260531 --area-code 39
bash
bash scripts/search.sh --keyword 한옥 --content-type-id 32 --num 30
bash
bash scripts/detail.sh --content-id 264432 --content-type-id 14 --include-images
bash
START=$(date -u +%Y%m%d)
END=$(date -u -v+10d +%Y%m%d 2>/dev/null || date -u -d "+10 days" +%Y%m%d)
bash scripts/festival.sh --start "$START" --end "$END" --num 100 \
| jq -r '[.title, .eventstartdate, .eventenddate, .addr1] | @tsv'
TourAPI returns lowercase field names without delimiters (e.g. mapx, mapy, addr1, addr2, firstimage, firstimage2, tel, eventstartdate, eventenddate, dist). The CLI passes these through verbatim so downstream pipelines keep schema parity with TourAPI's published spec.
exit 64 — bad CLI input (missing required flag, invalid date, unknown contentTypeId).exit 78 — TOURAPI_SERVICE_KEY env var missing.exit 22 — TourAPI returned non-2xx, an XML error envelope, or resultCode != "0000". The full body is echoed to stderr.exit 127 — required binary ( curl, jq) not on PATH.addr1 → 우편번호 + 행정동 코드.mapx/ mapy directly onto Kakao Maps.MIT-0. Data is © 한국관광공사 / 공공데이터포털 — credit per data.go.kr terms when republishing.