Introduction
Welcome to the WhatIP.ca API! Our API provides programmatic access to all IP tools, network diagnostics, and geolocation services.
https://whatip.ca/api
Features
- RESTful API — Simple, predictable endpoints
- JSON Responses — Easy to parse and integrate
- Bearer Token Auth — Secure API authentication
- Rate Limiting — Fair usage policies
- Free Tier — 100 requests per day
- Pro Tier — 10,000 requests per day
Try It Now
Test our IP geolocation API instantly:
Authentication
All authenticated API requests require a Bearer token in the Authorization header.
Getting a Token
Register or login to receive an API token:
curl -X POST https://whatip.ca/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"password": "SecurePass123",
"password_confirmation": "SecurePass123"
}'
Using Your Token
curl https://whatip.ca/api/auth/me \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Rate Limits
API rate limits depend on your subscription plan:
| Plan | Requests/Day | Burst Limit |
|---|---|---|
| Free | 100 | 10/minute |
| Pro Monthly | 10,000 | 100/minute |
| Pro Annual | 10,000 | 100/minute |
Rate Limit Exceeded: Returns HTTP 429 with reset time in response headers.
IP Geolocation
Lookup geolocation data for any IP address using MaxMind GeoIP2.
curl -X POST https://whatip.ca/api-proxy.php?service=geolocation&endpoint=lookup \
-H "Content-Type: application/json" \
-d '{"ip": "8.8.8.8"}'
Response Fields
| Field | Type | Description |
|---|---|---|
country.name |
string | Country name |
country.code |
string | ISO country code |
city.name |
string | City name |
location.latitude |
float | Latitude coordinate |
location.longitude |
float | Longitude coordinate |
DNS Lookup
Query DNS records for any domain (A, AAAA, MX, TXT, NS, SOA, etc.)
curl -X POST https://whatip.ca/api-proxy.php?service=dns&endpoint=dns/lookup \
-H "Content-Type: application/json" \
-d '{"domain": "google.com", "type": "A"}'
Blacklist Check
Check IP addresses against 100+ blacklists and reputation databases.
curl -X POST https://whatip.ca/api-proxy.php?service=security&endpoint=blacklist/ip \
-H "Content-Type: application/json" \
-d '{"ip": "8.8.8.8"}'
Auth Endpoints
Login
const response = await fetch('https://whatip.ca/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'john@example.com',
password: 'SecurePass123'
})
});
const data = await response.json();
console.log(data.token); // Save this token
Get Current User
Returns authenticated user's profile and subscription details.
Logout
Revokes the current API token.
Error Codes
The API uses standard HTTP status codes:
| Code | Meaning |
|---|---|
200 | Success |
400 | Bad Request — Invalid parameters |
401 | Unauthorized — Missing or invalid token |
403 | Forbidden — Insufficient permissions |
404 | Not Found — Resource doesn't exist |
429 | Too Many Requests — Rate limit exceeded |
500 | Internal Server Error |
Code Examples
Python
import requests
# IP Geolocation lookup
response = requests.post(
'https://whatip.ca/api-proxy.php',
params={'service': 'geolocation', 'endpoint': 'lookup'},
json={'ip': '8.8.8.8'}
)
data = response.json()
print(f"Country: {data['country']['name']}")
print(f"City: {data['city']['name']}")
Node.js
const axios = require('axios');
async function getGeoLocation(ip) {
const { data } = await axios.post(
'https://whatip.ca/api-proxy.php?service=geolocation&endpoint=lookup',
{ ip }
);
console.log(`Country: ${data.country.name}`);
console.log(`City: ${data.city.name}`);
}
getGeoLocation('8.8.8.8');
Need Help? Contact us at support@whatip.ca or visit our Support page.