The WhatIP API returns the client IP address and country information in JSON format.
GET https://ip.officialsite.kr/api
The API returns JSON in the following format:
{
"ip_address": "123.456.789.012",
"countryCode": "KR",
"countryNameKr": "대한민국",
"countryNameEn": "South Korea"
}
| Field | Type | Description |
|---|---|---|
ip_address |
string | Client IP address |
countryCode |
string | ISO 3166-1 alpha-2 country code, such as KR, US, JP |
countryNameKr |
string | Country name in Korean |
countryNameEn |
string | Country name in English |
fetch('https://ip.officialsite.kr/api')
.then(response => response.json())
.then(data => {
console.log('내 IP:', data.ip_address);
console.log('국가:', data.countryNameKr);
console.log('Country:', data.countryNameEn);
})
.catch(error => console.error('Error:', error));
$.getJSON('https://ip.officialsite.kr/api', function(data) {
console.log('내 IP:', data.ip_address);
console.log('국가:', data.countryNameKr);
console.log('Country:', data.countryNameEn);
});
import requests
response = requests.get('https://ip.officialsite.kr/api')
data = response.json()
print(f"내 IP: {data['ip_address']}")
print(f"국가: {data['countryNameKr']}")
print(f"Country: {data['countryNameEn']}")
curl https://ip.officialsite.kr/api
CORS is enabled so the API can be called directly from web browsers on any domain.
If a server-side error occurs, the API returns an error message with an HTTP status code:
{
"error": "Internal Server Error",
"message": "서버 처리 중 오류가 발생했습니다."
}
For API-related questions or feature requests, please contact us by email.