IP API
This is a simple IP lookup API that returns the requester's IP address. The documentation is shown at the root path, while the API is accessed via the /api endpoint.
Endpoint
The API is available at:
https://ip.notanumber.dev/api
Formats
JSON (default)
Make a request to the /api endpoint to get a JSON response.
{
"ip": "8.8.8.8"
}
Plaintext
Append ?plaintext to the URL to get a plaintext response.
8.8.8.8
Usage Examples
Using curl
Get JSON:
curl https://ip.notanumber.dev/api
Get Plaintext:
curl "https://ip.notanumber.dev/api?plaintext"
Using JavaScript (Node.js)
Get JSON:
async function getIp() {
const response = await fetch("https://ip.notanumber.dev/api");
const data = await response.json();
console.log(data.ip);
}
getIp();
Get Plaintext:
async function getIp() {
const response = await fetch("https://ip.notanumber.dev/api?plaintext");
const data = await response.text();
console.log(data);
}
getIp();