Skip to main content

Detect IP Address

Detect the caller's public IP address as seen by EntryGuard. This is useful for debugging which IP will be whitelisted when starting a session.

Request

GET /detect-ip

Authentication

No authentication required. This endpoint is public.

Response

Returns a JSON object containing the detected IP address and its version.

Status Code: 200 OK

Response Body:

FieldTypeDescription
ipstringThe detected IP address
versionintegerIP version (4 for IPv4, 6 for IPv6)
timestampstringISO 8601 timestamp of the detection

Note: The IP address is extracted from the X-Forwarded-For header if the request is behind a proxy, otherwise it uses the direct connection IP.

Example

curl https://api.entryguard.io/api/v1/detect-ip

Response (IPv4):

{
"ip": "203.45.67.89",
"version": 4,
"timestamp": "2024-01-15T10:30:00Z"
}

Response (IPv6):

{
"ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
"version": 6,
"timestamp": "2024-01-15T10:30:00Z"
}