jsonip is a free unlimited IP address and geolocation API
- jsonip.com returns a client's IP address (IPv4 or IPv6) in a JSON object.
- Use JSONP or CORS with jsonip.com so your web application is able to get a user's IP address directly in the browser.
- Use the API to update dynamic DNS if your IP address has changed.
API Help
-
Accessing this info on the api
-
Direct requestsVisit in a browser or make requests to jsonip.com directly.
-
CORS (Cross Origin Resource Sharing)To execute CORS requests, the originating request must be sent with the Origin header.
The api will respond with the "Access-Control-Allow-Origin: *" header.
Visit https://developer.mozilla.org/en-US/docs/Web/HTTP/CORSto understand how it works.
The JavaScript Fetch api will do this when "mode: cors" is enabled.fetch('https://jsonip.com', { mode: 'cors'} ) .then((resp) => resp.json()) .then((ip) => { console.log(ip); });
-
JSONPTo use JSONP, set your callback function as https://jsonip.com/myfunc or https://jsonip.com/?callback=myfunc.
myfunc({"ip":"123.456.789.012"})
-
IPv4 OnlyTo only get an IPv4 address, make requests to https://ipv4.jsonip.com.
If the client only has an IPv4 address, they will be unable to connect to https://ipv6.jsonip.com. -
IPv6 OnlyTo only get an IPv6 address, make requests to https://ipv6.jsonip.com.
Most clients that are assigned IPv6 addresses have a fallback IPv4 address.
However, if the client only has an IPv4 address, they will be unable to connect to https://ipv6.jsonip.com. -
HTTP Only (No SSL/TLS)By default all requests to jsonip.com are secured via https. For example, a request to http://jsonip.com returns a 301 redirect to https://jsonip.com.
If you need to access the api via http (non-secure), use http://no-tls.jsonip.com.