ip.fs.kg Back to the console 中文

API · no key required

One site, three endpoints.

No key to request, no signup, no call quota. Hit the root path from a shell and you get plain text, /json gives the full report, and /api/whoami returns exactly the same fields. Everything is read by the edge node straight from your connection, without any third-party API, and nothing is stored server-side.

Quick start

three lines to wire it into a script
bash — copy and go
# just the IP (-L follows the forced-HTTPS 301)
$ curl -L ip.fs.kg
203.0.113.42

# the full report, pick the fields you need
$ curl -sL ip.fs.kg/json | jq '{ip,country,city,asn,org}'
{ "ip": "203.0.113.42", "country": "CN", "city": "Xiamen", "asn": 4134, "org": "Chinanet" }

# drop it into your shell prompt
$ PS1="$(curl -sL ip.fs.kg) $ "

On Windows PowerShell, write curl.exe: curl in PowerShell is an alias for Invoke-WebRequest, which speaks plain http, hits the forced HTTPS redirect and returns 400 The plain HTTP request was sent to HTTPS port.

Endpoints

all GET, all unauthenticated
GET /

The root path. When a command-line client such as curl, wget or httpie asks for it, the answer is one line of plain-text IP with no HTML around it; a browser still gets the full interface. The split is decided by User-Agent and Accept, so neither side gets in the other's way.

response · text/plain
203.0.113.42
GET /json

The full report as application/json. Add ?pretty for two-space indentation when reading it by eye; without it you get one compact line, which suits piping. It exists because it is shorter to type than /api/whoami and does not live under /api/, which robots.txt disallows.

response · application/json
{
  "ip": "203.0.113.42",
  "type": "IPv4",
  "asn": 4134,
  "org": "Chinanet",
  "city": "Xiamen",
  "country": "CN",
  "latitude": 24.4798,
  "longitude": 118.0819,
  "timezone": "Asia/Shanghai",
  "colo": "HKG",
  "tlsVersion": "TLSv1.3",
  "edge": true
}
GET /api/whoami

The same implementation and the same fields as /json. The path differs only because the homepage script consumes it and appends a timestamp to dodge caches. The two are interchangeable.

POST /api/contact this site only

The relay behind the contact form. It only accepts same-origin requests from this site's own pages; third-party calls get a 403, so there is no public usage to document. It is listed here so the endpoint inventory is complete: the body is {name, email, message, page}, success returns {"ok":true}, and rate limiting returns 429.

Response fields

shared by /json and /api/whoami
FieldTypeNotes
ipstringYour public address
typestringIPv4 or IPv6, decided by whether the address contains a colon
asnnumberAutonomous system number, e.g. 4134
orgstringNetwork organisation name. At the edge isp comes from the same source and may be null
ispstringISP name, same value as org
city / regionstringCity / region, may be null
countrystringTwo-letter country code, e.g. CN
country_codestringIdentical to country, kept for older callers
continentstringContinent code, e.g. AS
latitude / longitudestringCity-level approximation. May be a numeric string ("24.47979") — run it through parseFloat yourself
postalstringPostal code
timezonestringIANA zone name, e.g. Asia/Shanghai
isEubooleanWhether the address is inside the EU
colostringThree-letter code of the edge node that handled this request, e.g. HKG
tlsVersionstringNegotiated TLS version, e.g. TLSv1.3
tlsCipherstringNegotiated cipher suite
httpProtocolstringHTTPS or HTTP
acceptLanguagestringFirst value of the Accept-Language request header
edgebooleanAlways true, marking that the data was read at the edge rather than from a third-party API
tsnumberMillisecond timestamp, different on every request, handy for busting intermediate caches

Live response

Below is what this page actually got back from /api/whoami. A runnable example beats a pasted block of fake data — the values you see are your own, right now.

GET /api/whoami
Requesting…

Worth knowing