API Documentation

Integrate IP lookup features into your applications with our simple REST API

Getting Started

Follow these steps to start using the API

1. Create an Account

Sign up for a free account to get your API key.

2. Use Your API Key

Include your key as a query parameter (?api_key=YOUR_KEY) or as a bearer token in the authorization header.

3. Make Requests

Start making requests to our endpoints following the docs below.

Rate Limiting

Be aware of rate limits for uninterrupted service

Free accounts are limited to:

  • 3 requests per 10 minutes
  • Rate limit counter resets every 10 minutes
  • Exceeded limits return a 429 status code

Rate Limit Exceeded Response:

{
  "message": "Rate limit exceeded. Max 3 requests per 10 min.",
  "resetAt": "2023-09-15T14:30:00.000Z"
}

API Endpoints

IP Lookup

Get detailed information about an IP address

Endpoint

GET /api/ip

Authentication

Provide your API key using one of these methods:

  • Query Parameter: ?api_key=YOUR_API_KEY
  • Authorization Header: Authorization: Bearer YOUR_API_KEY

Response Example

{
  "ip": "203.0.113.195",
  "version": "IPv4",
  "city": "New York",
  "region": "New York",
  "country": "United States",
  "countryCode": "US",
  "isp": "Example ISP",
  "org": "Example Organization",
  "asn": "AS12345",
  "vpn": false,
  "proxy": false,
  "hosting": false,
  "latitude": 40.7128,
  "longitude": -74.0060,
  "timezone": "America/New_York"
}

Code Examples

Integration examples in popular languages

JavaScript (fetch)

fetch('https://whatmyip.io/api/ip?api_key=YOUR_API_KEY')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

Python (requests)

import requests

url = "https://whatmyip.io/api/ip"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

response = requests.get(url, headers=headers)
data = response.json()
print(data)

cURL

curl -X GET "https://whatmyip.io/api/ip" \
  -H "Authorization: Bearer YOUR_API_KEY"