FETCH-IP.COM
IP Address Detection Service - Documentation
[OVERVIEW]

fetch-ip.com is a simple HTTP service that returns your public IP address in various formats.

All endpoints support both IPv4 and IPv6 addresses and include CORS headers for browser compatibility.

[DOMAIN VARIANTS]

We provide three different domain URLs to control IP version detection:

fetch-ip.com
Returns whatever IP version you used to make the request
# If you connect via IPv4, you get your IPv4 address
# If you connect via IPv6, you get your IPv6 address
$ curl https://fetch-ip.com/
203.0.113.42 # (your actual connecting IP)
v4.fetch-ip.com
IPv4 only - always returns your IPv4 address
# Forces IPv4 detection regardless of connection type
$ curl https://v4.fetch-ip.com/
203.0.113.42
v6.fetch-ip.com
IPv6 only - always returns your IPv6 address
# Forces IPv6 detection regardless of connection type
$ curl https://v6.fetch-ip.com/
2001:db8::1
[ENDPOINTS]
GET /
Returns your IP address as plain text
$ curl https://fetch-ip.com/
203.0.113.42
GET /json
Returns your IP address as JSON with additional metadata
$ curl https://fetch-ip.com/json
{ "ip": "203.0.113.42", "version": "IPv4", "timestamp": "2024-01-15T10:30:45Z", "domain": "fetch-ip.com" }
GET /xml
Returns your IP address as XML with additional metadata
$ curl https://fetch-ip.com/xml
<response> <ip>203.0.113.42</ip> <version>IPv4</version> <timestamp>2024-01-15T10:30:45Z</timestamp> <domain>fetch-ip.com</domain> </response>
[USAGE EXAMPLES]
# Get IP in shell script
IP=$(curl -s https://fetch-ip.com/)
echo "Your IP is: $IP"
# Get IP with metadata in Python
import requests
response = requests.get('https://fetch-ip.com/json')
data = response.json()
print(f"IP: {data['ip']} ({data['version']})")
# Get IP in JavaScript (browser)
fetch('https://fetch-ip.com/json')
.then(response => response.json())
.then(data => console.log('Your IP:', data.ip));
[FEATURES]

• IPv4 and IPv6 support

• Multiple output formats (plain text, JSON, XML)

• CORS enabled for browser requests

• Rate limiting for fair usage