Code Examples
Copy-paste code examples for every language
Grab Your IP in Any Language
Every example on this page calls the same API. Same base URL. Same JSON response. Same “just works” energy. The only thing that changes is the language you write it in.
The base URL is https://whatismyip.technology/api/me. Every endpoint returns JSON. No API key needed. No signup. No OAuth token you have to refresh every 47 minutes. Just HTTPS and GET requests (except bulk, which is a POST).
All seven endpoints are covered in every language example:
| Endpoint | What it does |
|---|---|
GET /api | Returns your own IP address |
GET /api/{ip} | Full lookup for any IP |
GET /api/{ip}/geo | Geolocation only |
GET /api/{ip}/asn | ASN and network info |
GET /api/{ip}/privacy | VPN, proxy, Tor detection |
GET /api/{ip}/company | Company and abuse contact info |
POST /api/bulk | Look up multiple IPs at once |
Pick your language and start copying.
Available Languages
- curl — The command line classic. Great for quick tests and shell scripts.
- Python — With requests and aiohttp. Sync and async.
- JavaScript — Browser fetch and Node.js. TypeScript types included.
- Go — Struct definitions, JSON unmarshaling, the whole deal.
- PHP — file_get_contents and cURL. Old school and new school.
- Ruby — Net::HTTP with clean, readable code.
Every example works out of the box. Copy it, run it, get IP data back. If it doesn’t work, something is very wrong with the internet and you probably have bigger problems.
In This Section
curl
curl examples for every endpoint of the free IP geolocation API. Copy, paste, run.
Python
Python examples for the free IP geolocation API using requests and aiohttp. Sync and async.
JavaScript
JavaScript examples for the free IP geolocation API. Browser fetch and Node.js, with TypeScript types.
Go
Go examples for the free IP geolocation API. Structs, JSON unmarshaling, and proper error handling.
PHP
PHP examples for the free IP geolocation API. file_get_contents and cURL, both covered.
Ruby
Ruby examples for the free IP geolocation API using Net::HTTP. No gems required.