How do I look up my IP address with curl or the API?
Running curl ipnow.kr in a terminal prints your current public IP on a single line, and curl ipnow.kr/json returns detailed information such as location, ISP and User-Agent as JSON. Windows PowerShell can query it the same way with just a few characters.
Last updated
Getting your IP on one line with curl
Running curl ipnow.kr in a terminal prints just your current public IP on one line instead of an HTML page. curl ipnow.kr/ip returns the same single-line IP.
Both endpoints are designed to be captured directly into a variable in a script, which makes them handy for server health checks or confirming a remote server's public IP.
Getting detailed data from the JSON API
Running curl -s ipnow.kr/json returns a JSON response. If jq is installed, curl -s ipnow.kr/json | jq pretty-prints it for easier reading.
The JSON includes fields such as ip, ip_version, country_code, country, region, city, latitude, longitude, asn, isp, as_org, user_agent, browser, browser_version, os, device, is_bot, is_ai, bot_name, accept_language, protocol and time.
Forcing an IPv4 or IPv6 lookup
curl -4 ipnow.kr forces an IPv4 connection to check your IPv4 public address, while curl -6 ipnow.kr forces IPv6. If the two results differ, that device or server is running a dual-stack setup with both address families.
Looking it up in Windows PowerShell
In PowerShell, (Invoke-WebRequest ipnow.kr/ip).Content returns just the IP string, while irm ipnow.kr/json (an alias for Invoke-RestMethod) returns the JSON response already parsed into an object you can work with field by field.
Pulling your IP automatically in a script
In bash, MYIP=$(curl -s ipnow.kr/ip) stores the IP in a variable that a deployment script or firewall rule can use directly.
In JavaScript, you can call fetch("https://ipnow.kr/json").then(r => r.json()).then(data => console.log(data.ip)), and since CORS is allowed for every origin, this works from a browser without being blocked.
How do I look up my IP address with curl or the API?: step by step
- Get just the IPRun
curl ipnow.krorcurl ipnow.kr/ipin a terminal to print the public IP directly. - Get detailed JSONRun
curl -s ipnow.kr/json, and pipe it through| jqfor readable formatting if you have jq installed. - Force IPv4 or IPv6Use
curl -4 ipnow.krorcurl -6 ipnow.krto check only the address family you want. - Query it in PowerShellRun
(Invoke-WebRequest ipnow.kr/ip).Contentorirm ipnow.kr/json. - Wire it into a scriptStore it in a bash variable with
$(curl -s ipnow.kr/ip), or call /json with fetch in JavaScript to pull specific fields.
Frequently asked questions
Will calling fetch from a browser hit a CORS error?
No — ipnow.kr's API allows CORS from every origin (Access-Control-Allow-Origin: *), so it can be called directly from browser JavaScript without a backend proxy.
Do I need an API key to use it?
No. Anyone can call it for free with curl or fetch, with no signup or API key required.
What is the difference between curl ipnow.kr and curl ipnow.kr/json?
curl ipnow.kr and curl ipnow.kr/ip return only the IP address on one line, while curl ipnow.kr/json returns detailed data such as location, ISP and User-Agent in JSON.
Why is a User-Agent field included in the JSON?
It records the User-Agent of the client that made the request (curl, a browser, and so on), so you can tell what environment the lookup came from. See what is a User-Agent for more.