API 목록으로
☁️ 날씨무료

OpenWeather API

OpenWeather · OpenWeatherMap API

인증 방식

🔑 API Key

요금

월 100만 건 무료, Pro $40/월~

Base URL

api.openweathermap.org/data/2.5

태그

날씨, OpenWeather

서비스 소개

OpenWeatherMap은 전 세계 200,000개 이상 도시의 날씨 데이터를 제공하는 글로벌 날씨 API입니다. 현재 날씨, 5일 예보, 시간별 예보, 과거 날씨 데이터 등을 제공합니다. 무료 플랜에서 월 100만 건 호출이 가능하여 중소규모 서비스에 충분합니다.

🚀 시작하기

  1. 1

    OpenWeather 가입

    openweathermap.org → Sign Up → 이메일 인증

  2. 2

    API 키 발급

    My API keys → API key 복사 (활성화까지 최대 2시간 소요)

💡 코드 예제

JavaScriptJavaScript (현재 날씨)
const OW_KEY = process.env.OPENWEATHER_API_KEY

async function getCurrentWeather(city: string, lang = 'kr') {
  const res = await fetch(
    `https://api.openweathermap.org/data/2.5/weather?` +
    `q=${encodeURIComponent(city)}&appid=${OW_KEY}&units=metric&lang=${lang}`
  )
  return res.json()
}

async function getForecast(city: string) {
  const res = await fetch(
    `https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=${OW_KEY}&units=metric&lang=kr&cnt=40`
  )
  return (await res.json()).list
}