IPinfo Erlang Client Library

This is the official Erlang/Elixir client library for the IPinfo.io IP data API, allowing you to lookup your own IP address, or get any of the following details for an IP:

Check all the data we have for your IP address here.

Getting Started

You'll need an IPinfo API access token, which you can get by signing up for a free account at https://ipinfo.io/signup.

The free plan is limited to 50,000 requests per month, and doesn't include some of the data fields such as IP type and company data. To enable all the data fields and additional request volumes see https://ipinfo.io/pricing.

Installation

Add this line to your application's rebar.config:

{deps, [ipinfo]}.

Usage

{ok, IpInfo} = ipinfo:create(<<"29a75d15">>),
{ok, Details} = ipinfo:details(IpInfo),
#{ip := Ip, city := City, loc := Loc} = Details,
%% ...

Details Data

ipinfo:details/1,2 will return a map that contains all fields listed in the IPinfo developerdocs with a few minor additions. Properties can be accessed directly.

Configuration

TBD

For elixir folks

alias :ipinfo, as: IPinfo
def current_ip() do
with {:ok, %IPinfo{} = handler} <- IPinfo.create(),
{:ok, details} <- IPinfo.details(handler) do
details.ip
|> String.to_charlist()
|> :inet_parse.address()
end
end