$ curl ifconfig.co {{ .IP }} $ http -b ifconfig.co {{ .IP }} $ wget -qO- ifconfig.co {{ .IP }} $ fetch -qo- https://ifconfig.co {{ .IP }}{{ if .IsLookupCountryEnabled }}
$ http ifconfig.co/country {{ .Country }}{{ end }} {{ if .IsLookupCityEnabled }}
$ http ifconfig.co/city {{ .City }}{{ end }}
$ http ifconfig.co/json { {{ if .IsLookupCityEnabled }} "city": "{{ .City }}",{{ end }}{{ if .IsLookupCountryEnabled }} "country": "{{ .Country }}",{{ end }}{{ if .IsLookupAddrEnabled }} "hostname": "{{ .Hostname }}",{{ end }} "ip": "{{ .IP }}", "ip_decimal": {{ .IPDecimal }} }
Setting the Accept header to application/json also works.
Always returns the IP address including a trailing newline, regardless of user agent.
$ http ifconfig.co/ip {{ .IP }}{{ if .IsLookupPortEnabled }}
$ http ifconfig.co/port/8080 { "ip": "{{ .IP }}", "port": 8080, "reachable": false }{{ end }}
Yes, as long as the rate limit is respected. Please limit automated requests to 1 request per minute. No guarantee is made for requests that exceed this limit. They may be rate-limited (with a 429 response code) or dropped entirely.
IPv6 is currently not supported. You are however free to host your own service with IPv6 support, see next question.
Yes, the source code and documentation is available on GitHub.