IP 주소 조회 API 문서

무료 API 서비스 - 별도의 인증 없이 바로 사용 가능합니다.

API 개요

ip.officialsite.kr API는 클라이언트의 IP 주소와 위치 정보를 JSON 형식으로 제공하는 RESTful API입니다.

  • 실시간 IP 주소 조회
  • 국가 코드 및 국가명 제공
  • JSON 응답 형식
  • CORS 지원
  • 무료 사용, API 키 불필요

API 엔드포인트

GET https://ip.officialsite.kr/api

응답 형식

API는 다음과 같은 JSON 형식으로 응답합니다:

{
  "ip_address": "123.456.789.012",
  "countryCode": "KR",
  "countryName": "대한민국"
}

응답 필드 설명

필드명 타입 설명
ip_address string 클라이언트의 IP 주소
countryCode string ISO 3166-1 alpha-2 국가 코드 (예: KR, US, JP)
countryName string 국가명 (한국어)

사용 예제

JavaScript (Fetch API)

fetch('https://ip.officialsite.kr/api')
  .then(response => response.json())
  .then(data => {
    console.log('내 IP:', data.ip_address);
    console.log('국가:', data.countryName);
  })
  .catch(error => console.error('Error:', error));

jQuery

$.getJSON('https://ip.officialsite.kr/api', function(data) {
  console.log('내 IP:', data.ip_address);
  console.log('국가:', data.countryName);
});

Python

import requests

response = requests.get('https://ip.officialsite.kr/api')
data = response.json()

print(f"내 IP: {data['ip_address']}")
print(f"국가: {data['countryName']}")

cURL

curl https://ip.officialsite.kr/api

CORS 정책

모든 도메인에서 API 호출이 가능하도록 CORS가 설정되어 있습니다. 웹 브라우저에서 직접 API를 호출할 수 있습니다.

제한사항

  • 요청 속도 제한: 없음 (합리적인 사용 권장)
  • HTTPS만 지원
  • IPv4 주소 지원 (IPv6 지원 예정)

오류 응답

서버 오류 발생 시 HTTP 상태 코드와 함께 오류 메시지가 반환됩니다:

{
  "error": "Internal Server Error",
  "message": "서버 처리 중 오류가 발생했습니다."
}

문의사항

API 관련 문의사항이나 기능 요청은 이메일로 연락 주시기 바랍니다.

admin@officialsite.kr

빠른 링크
실시간 테스트