API
Public · No authentication

IP API

Retrieve the client IP address and proxy forwarding headers for the current request.

Open IP lookup

H2Quick start

Retrieve the client IP address for the current request. This public Connect RPC requires no authentication or API key and returns JSON.

http
POST /rpc/jadren.v1.ToolsService/GetClientIp Content-Type: application/json {}

Examples use the site's origin. For local development, replace it with http://localhost:3000.

H2cURL examples

H3Basic request

bash
curl -s https://jadren.me/rpc/jadren.v1.ToolsService/GetClientIp -H 'Content-Type: application/json' -d '{}'

H3Pretty-print JSON

With jq installed:

bash
curl -s https://jadren.me/rpc/jadren.v1.ToolsService/GetClientIp -H 'Content-Type: application/json' -d '{}' | jq .
bash
curl -s https://jadren.me/rpc/jadren.v1.ToolsService/GetClientIp -H 'Content-Type: application/json' -d '{}' | jq -r '.ip'

H2Response example

Successful requests return 200 OK. Addresses below are illustrative; actual values depend on the forwarding headers received with the request.

json
{ "ip": "203.0.113.10", "xForwardedFor": "203.0.113.10, 192.0.2.20", "xRealIp": "203.0.113.10" }

H3Response fields

FieldTypeMeaning
ipstringClient IP extracted from request headers, or unknown when unavailable
xForwardedForstring, optionalComplete incoming X-Forwarded-For header; omitted if empty or missing
xRealIpstring, optionalIncoming X-Real-IP header; omitted if empty or missing

GetClientIp only returns the IP and forwarding headers. Location, ISP, and other details displayed separately on the IP lookup page are not part of this response.

H2JavaScript example

Use a relative URL from a page on this site:

javascript
const response = await fetch('/rpc/jadren.v1.ToolsService/GetClientIp', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}', }); if (!response.ok) throw new Error(`HTTP ${response.status}`); const data = await response.json(); console.log(data.ip);

H2Address selection

  1. Read the first comma-separated value in X-Forwarded-For and trim its surrounding whitespace.
  2. If that value is empty or the header is absent, use X-Real-IP.
  3. If neither provides a value, return unknown, still with status 200.

When both headers are missing:

json
{ "ip": "unknown" }

H2Local development and reverse proxies

Local requests may show ::1 (IPv6 loopback), 127.0.0.1, or unknown. These reflect the request received by the service and are not necessarily your public internet address.

When deploying behind a reverse proxy, configure the proxy to set forwarding headers correctly. The endpoint reads these headers without additional IP-format or proxy-trust validation. Its output is suitable for display and debugging, rather than serving directly as an identity or access-control decision.

Contents

No headings found