How to use ipapi.co — a practical guide

If you're here, you probably want working code in five minutes. That's exactly what this guide does.

Five steps to get started

  1. 1
    Call ipapi.co/{ip}/json/ or ipapi.co/json/ (visitor's IP).

Shortest snippet that will actually run

curl "https://ipapi.co/json/"

Common mistakes (the honest list)

Avoid client-side calls — the IP they receive will differ.