Client libraries
IPLocate provides official client libraries and SDKs for popular programming languages to help you get started quickly.
Official libraries
For detailed installation instructions and usage examples, see the README for each library on GitHub.
Community libraries & integrations
Want to see a new language here, or developed your own integration? Let us know!
Installation examples
Python
pip install python-iplocate
from iplocate import IPLocateClient
client = IPLocateClient(api_key="YOUR_API_KEY")
result = client.lookup("8.8.8.8")
print(result.country)
Node.js
npm install node-iplocate
# or
yarn add node-iplocate
# or
pnpm add node-iplocate
import IPLocate from 'node-iplocate';
const client = new IPLocate('YOUR_API_KEY');
const result = await client.lookup('8.8.8.8');
console.log(result);
Ruby
gem install iplocate
require 'iplocate'
result = IPLocate.lookup('8.8.8.8', 'YOUR_API_KEY')
puts result['country']
PHP
composer require iplocate/php-iplocate
<?php
require 'vendor/autoload.php';
use IPLocate\IPLocate;
$client = new IPLocate('YOUR_API_KEY');
$result = $client->lookup('8.8.8.8');
echo "IP: {$result->ip}\n";
echo "Country: {$result->country}\n";
Java
Maven pom.xml
<dependency>
<groupId>io.iplocate</groupId>
<artifactId>java-iplocate</artifactId>
<version>1.0.0</version>
</dependency>
Gradle build.gradle
implementation 'io.iplocate:java-iplocate:1.0.0'
Example.java
import io.iplocate.client.IPLocateClient;
import io.iplocate.client.model.IPLocateResponse;
IPLocateClient client = new IPLocateClient("YOUR_API_KEY");
IPLocateResponse result = client.lookup("8.8.8.8");
System.out.println(result.getCountry());
Go
go get github.com/iplocate/go-iplocate
package main
import (
"fmt"
"log"
"github.com/iplocate/go-iplocate"
)
func main() {
client := iplocate.NewClient(nil).WithAPIKey("YOUR_API_KEY")
result, err := client.Lookup("8.8.8.8")
if err != nil {
log.Fatal(err)
}
fmt.Println(result)
}
Contributing
All IPLocate client libraries are open source. Contributions are welcome:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Need a different language?
If you need a client library for a language that's not listed above, you can search GitHub for community-maintained libraries.
Or, you can build your own! Our REST API is simple and well-documented.
Did you know we’ll pay for you to build a client library for a new language? See more on our Build for IPLocate page.