ip4.me / ip6.me API Documentation

Current API version: v1.1

Recommended API urls

Note: Don't forget the trailing slash to avoid unnessary 301 redirects
 
ip4only.me/api/ - IPv4 only query
ip6.me/api/ - Dual stack IPv6 and IPv4 (preference depends on your OS/client)
ip6only.me/api/ - IPv6 only query
 
Some day far in the future ip4.me may have a AAAA record so it is not recommended for "IPv4 only" automated queries. Use ip4only.me instead.

Request options

There are no request options in v1.1

We ask that you do not obsfucate or suppress your user-agent (you aren't fooling anyone as 99.96% of queries are automated). This site has been running dual-stack IPv4/IPv6 and 100% Ad/javascript-free since Janurary 2007 as a public service to the Internet community. Any information you provide about how you are using the service helps us improve it.

Output format

Output consists of several fields separated by commas and may differ from other CSV formats. This format is optimized for easy scripting by users vs. pedantic accuracy.

Key attributes:

  • Commas will never appear within output values. Any commas in source data will be replaced with a space character. This means that commas that might appear in X-Forwarded-For and RFC7239 headers are replaced with spaces.
  • Output values with spaces or quotes are not escaped with quote characters however any quote characters appearing in source data (common in RFC7239) will be passed through as-is.
  • Output fields for which there is no input value will be empty (,,) and no placeholder character or strings are used. For example, if the string "Unknown" appears in an output value that means that string actually appeared in the source data and was passed along to the output field.

Output values derived from HTTP Headers are pre-processed according to the following rules in order:

  • Each source data value is truncated to 255 characters.
  • Space characters in source data are deleted.
  • Commas in source data are converted to spaces
  • Only the following characters are allowed, any other characters are deleted:

    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'"./-+&=_[]:;

If desired, commas within values can be recovered by converting spaces to commas.

Output fields

FieldDescriptionMaximum LengthValid Values
1Remote IP Address Protocol4
IPv4

IPv6
2Remote IP Address39Examples:

192.0.2.1

2001:db8:0:0:8:800:200c:417a
3API Version15Current version:

v1.1
4X-Forwarded-For Header255Examples:

Empty (,,)

10.0.0.1

192.168.1.2 10.1.2.3

2001:db8:0:0:8:800:200c:417a
5Forwarded Header (RFC7239)255Examples:

Empty (,,)

for=192.0.2.60;proto=http;by=203.0.113.43

For="[2001:db8:cafe::17]:4711"
6System Message255May vary. Current default value:

See http://ip6.me/docs for api documentation

Example output

IPv4,192.0.2.60,v1.1,,,See http://ip6.me/docs/ for api documentation

IPv6,2001:db8:0:0:8:800:200c:417a,v1.1,,,See http://ip6.me/docs for api documentation

IPv4,192.0.2.60,v1.1,10.1.2.3,,See http://ip6.me/docs for api documentation

IPv4,192.0.2.60,v1.1,10.1.2.3,for=10.1.2.3,See http://ip6.me/docs for api documentation

Older versions

Prior to v1.1, the retroactively named v1.0 had fields 1 and 2 as above, followed by a system message field and four empty fields. Fields 1 and 2 were not changed in v1.1 for backwards compatibility. It is expected that future versions fields 1-5 will not be changed in a way that breaks backwards compatibility or will use a different URL.

Sample output from API v1.0:

IPv4,192.0.2.60,Remaining fields reserved for future use,,,