code

API Documentation

Integrate IP geolocation, DNS lookup, and network tools into your applications with our RESTful API.

rocket_launch Introduction

Welcome to the WhatIP.ca API! Our API provides programmatic access to all IP tools, network diagnostics, and geolocation services.

link Base URL: 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

play_arrow Try It Now

Test our IP geolocation API instantly:

// Response will appear here

key Authentication

All authenticated API requests require a Bearer token in the Authorization header.

Getting a Token

Register or login to receive an API token:

POST /auth/register
cURL
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
curl https://whatip.ca/api/auth/me \
  -H "Authorization: Bearer YOUR_TOKEN_HERE"

speed 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
warning

Rate Limit Exceeded: Returns HTTP 429 with reset time in response headers.

location_on IP Geolocation

Lookup geolocation data for any IP address using MaxMind GeoIP2.

POST /api-proxy.php?service=geolocation&endpoint=lookup
Request
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 DNS Lookup

Query DNS records for any domain (A, AAAA, MX, TXT, NS, SOA, etc.)

POST /api-proxy.php?service=dns&endpoint=dns/lookup
Request
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"}'

security Blacklist Check

Check IP addresses against 100+ blacklists and reputation databases.

POST /api-proxy.php?service=security&endpoint=blacklist/ip
Request
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"}'

person Auth Endpoints

Login

POST /auth/login
JavaScript
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

GET /auth/me

Returns authenticated user's profile and subscription details.

Logout

POST /auth/logout

Revokes the current API token.

error Error Codes

The API uses standard HTTP status codes:

Code Meaning
200Success
400Bad Request — Invalid parameters
401Unauthorized — Missing or invalid token
403Forbidden — Insufficient permissions
404Not Found — Resource doesn't exist
429Too Many Requests — Rate limit exceeded
500Internal Server Error

terminal Code Examples

Python

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

JavaScript
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');
help

Need Help? Contact us at support@whatip.ca or visit our Support page.