code

API Documentation

A free, open REST API and MCP server for IP geolocation, DNS, WHOIS, email and blacklist checks. No account or API key needed.

rocket_launch Introduction

The WhatIP.ca API gives programmatic access to the same tools as the website: your own IP, IP geolocation, DNS, WHOIS, email authentication checks and IP blacklist checks. It is free, needs no account and no API key.

link Base URL: https://whatip.ca/api/v1

Features

  • RESTful API: versioned endpoints (e.g. POST /api/v1/geolocate)
  • JSON in / JSON out: send a JSON body, get a JSON response
  • No authentication: no sign-up, no API key, no headers beyond Content-Type
  • Free: every endpoint, rate limited per IP address
  • OpenAPI: a machine-readable description at GET /api/v1/openapi.json
  • MCP: the same tools for AI assistants at https://whatip.ca/mcp

play_arrow Try It Now

Test our IP geolocation API instantly:

// Response will appear here

lock_open Authentication

None. The API is open: there are no accounts and no API keys. Send requests with a JSON body and a Content-Type: application/json header.

speed Rate Limits

To keep the service free and available for everyone, requests are rate limited per client IP address. When you exceed the limit the API answers 429 Too Many Requests; wait a little and retry. Please cache results where you can and avoid bulk scanning (see the Acceptable Use Policy).

my_location My IP

GET /api/v1/myip

Returns the public IP address the request came from, with its geolocation.

Request
curl https://whatip.ca/api/v1/myip

Response Fields

FieldTypeDescription
ipstringYour public IP address
city.namestringCity name
subdivisions[0].namestringRegion / province / state
country.name, country.codestringCountry name and ISO code
continent.namestringContinent name
location.latitude, location.longitudefloatApproximate coordinates
location.time_zonestringIANA time zone
asn.autonomous_system_numberintegerASN
asn.autonomous_system_organizationstringNetwork owner
traits.organizationstringOrganization, when known

location_on IP Geolocation

Look up the country and network (ASN) of any IPv4 or IPv6 address.

POST /api/v1/geolocate
FieldTypeRequiredDescription
ipstringyesIP address to look up
Request
curl -X POST https://whatip.ca/api/v1/geolocate \
  -H "Content-Type: application/json" \
  -d '{"ip": "8.8.8.8"}'

Response Fields

FieldTypeDescription
country.namestringCountry name
country.codestringISO country code
asn.autonomous_system_numberintegerASN
asn.autonomous_system_organizationstringNetwork owner

dns DNS Lookup

Query DNS records for a domain.

POST /api/v1/dns/lookup
FieldTypeRequiredDescription
domainstringyesDomain name
typestringnoRecord type: A (default), AAAA, MX, TXT, CNAME, NS, SOA
Request
curl -X POST https://whatip.ca/api/v1/dns/lookup \
  -H "Content-Type: application/json" \
  -d '{"domain": "google.com", "type": "A"}'

swap_horiz Reverse DNS

Find the hostname (PTR record) for an IP address.

POST /api/v1/dns/reverse
FieldTypeRequiredDescription
ipstringyesIP address
Request
curl -X POST https://whatip.ca/api/v1/dns/reverse \
  -H "Content-Type: application/json" \
  -d '{"ip": "8.8.8.8"}'

travel_explore WHOIS

Registration data for a domain or an IP network, fetched over RDAP. Send either domain or ip.

POST /api/v1/whois
FieldTypeRequiredDescription
domainstringone ofDomain name
ipstringone ofIP address
Request
curl -X POST https://whatip.ca/api/v1/whois \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com"}'

mark_email_read Email Checks

Check the DNS records that decide whether a domain's mail is delivered. All endpoints take a domain.

POST /api/v1/email/mx
POST /api/v1/email/spf
POST /api/v1/email/dkim
POST /api/v1/email/dmarc
POST /api/v1/email/deliverability
EndpointFieldsDescription
/email/mxdomainMX records
/email/spfdomainSPF record and validation
/email/dkimdomain, selector (optional)DKIM public key for a selector
/email/dmarcdomainDMARC policy
/email/deliverabilitydomainMX, SPF, DKIM and DMARC together, with a deliverability score
Request
curl -X POST https://whatip.ca/api/v1/email/deliverability \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com"}'

security Blacklist Check

Check an IP address against DNS-based blacklists (DNSBLs).

POST /api/v1/security/blacklist
FieldTypeRequiredDescription
ipstringyesIP address
Request
curl -X POST https://whatip.ca/api/v1/security/blacklist \
  -H "Content-Type: application/json" \
  -d '{"ip": "8.8.8.8"}'

description OpenAPI

GET /api/v1/openapi.json

A machine-readable OpenAPI description of every endpoint, for code generators and API clients.

Request
curl https://whatip.ca/api/v1/openapi.json

smart_toy MCP Server

WhatIP.ca also speaks the Model Context Protocol, so AI assistants and agents can call the same tools directly. Add this URL as a remote MCP server in any MCP-capable client. No key is needed.

link MCP URL: https://whatip.ca/mcp

error Error Codes

The API uses standard HTTP status codes:

CodeMeaning
200Success
400Bad Request: missing or invalid parameters
404Not Found: no such endpoint
429Too Many Requests: per-IP rate limit exceeded
500Internal Server Error

terminal Code Examples

Python

Python
import requests

# IP geolocation lookup
response = requests.post(
    'https://whatip.ca/api/v1/geolocate',
    json={'ip': '8.8.8.8'}
)

data = response.json()
print(f"Country: {data['country']['name']}")
print(f"ASN: {data.get('asn', {}).get('autonomous_system_organization')}")

JavaScript

JavaScript
async function getGeoLocation(ip) {
  const res = await fetch('https://whatip.ca/api/v1/geolocate', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ ip })
  });
  const data = await res.json();

  console.log(`Country: ${data.country.name}`);
  console.log(`ASN: ${data.asn?.autonomous_system_organization}`);
}

getGeoLocation('8.8.8.8');
help

Need Help? Contact us or visit our Support page.