واجهة API مجانية لعنوان IP

احصل على عنوان IP العام الخاص بك كنص عادي أو JSON من أي سكربت أو طرفية أو تطبيق. بدون مفتاح API وبدون تسجيل، مع تفعيل CORS.

Plain text: /ip

Returns just your public IP address followed by a newline. Ideal for shell scripts.

$ curl toolsforanyone.com/ip
216.73.216.172

Tip: requesting the home page with curl, wget or HTTPie also returns plain text.

JSON with location: /json

Returns your IP address plus geolocation and network details.

$ curl toolsforanyone.com/json
{
  "ip": "203.0.113.42",
  "version": 4,
  "city": "Amsterdam",
  "region": "North Holland",
  "region_code": "NH",
  "country": "Netherlands",
  "country_code": "NL",
  "continent": "Europe",
  "postal": "1012",
  "latitude": 52.37,
  "longitude": 4.89,
  "timezone": "Europe/Amsterdam",
  "utc_offset": "+02:00",
  "asn": 64500,
  "org": "Example Networks B.V.",
  "isp": "Example Networks"
}

Look up a different address with ?ip=: curl "toolsforanyone.com/json?ip=8.8.8.8". Location fields are omitted for private or reserved addresses.

Code examples

Python

import requests
ip = requests.get("https://toolsforanyone.com/ip", timeout=5).text.strip()
info = requests.get("https://toolsforanyone.com/json", timeout=5).json()
print(ip, info.get("country"))

JavaScript (browser or Node.js 18+)

const res = await fetch("https://toolsforanyone.com/json");
const { ip, city, country } = await res.json();
console.log(`${ip} – ${city}, ${country}`);

PowerShell

(Invoke-RestMethod https://toolsforanyone.com/json).ip

wget

wget -qO- toolsforanyone.com/ip

Go

resp, _ := http.Get("https://toolsforanyone.com/ip")
body, _ := io.ReadAll(resp.Body)
fmt.Print(string(body))

Fair use

  • /ip has no practical limit for normal use.
  • /json is limited to about 45 requests per minute per IP address, because each lookup queries a geolocation database. Responses return HTTP 429 when the limit is exceeded.
  • Please cache results instead of polling every few seconds. For high-volume commercial use, contact us.

By using the API you agree to our terms of service.

تم النسخ إلى الحافظة