Code examples

Copy an own-IP request in JavaScript, cURL, Python or Go.

Own-IP request examples

Each example calls the same endpoint. The connecting process determines whose IP address is returned.

Use a JavaScript module or browser console with native fetch and AbortSignal.timeout.

Own-IP request
const response = await fetch(
  "https://api.ipquery.io/?format=json",
  { signal: AbortSignal.timeout(5000) }
);
if (!response.ok) {
  const message = await response.text();
  throw new Error("IPQuery " + response.status + ": " + message);
}
const data = await response.json();
console.log(JSON.stringify(data, null, 2));

The examples use five-second timeouts and the language’s standard HTTP tools. Handle failures in your application; do not substitute an empty IP record.

Full-list access.

For pricing or full-list access, email [email protected].

Selected list
Selected records
Records in this list