OpenIPApi

Official OpenIPApi SDKs

Download lightweight official clients for JavaScript, Python and PHP.

All SDKs target the same REST API at https://api.openipapi.com, authenticate with the X-API-Key header, and expose the same methods: lookup(ip), me(), batch(ips), asn(asn), validate(ip).

MCP Server — for AI assistants

@openipapi/mcp

Give Claude or any MCP-capable AI assistant direct access to OpenIPApi: IP lookups, batch checks, fraud scores and more, as typed tools. One npx command, no code.

Included tools

lookup_ip · batch_lookup · my_ip · validate_ip · asn_lookup · fraud_score

Setup

// claude_desktop_config.json
{ "mcpServers": { "openipapi": {
  "command": "npx",
  "args": ["-y", "@openipapi/mcp"],
  "env": { "OPENIPAPI_API_KEY": "oip_..." }
} } }

# Claude Code
claude mcp add openipapi \
  -e OPENIPAPI_API_KEY=oip_... \
  -- npx -y @openipapi/mcp

JavaScript / TypeScript

Download: openipapi.js

Install / use

Drop the file into your project (or import directly from /sdk/javascript/openipapi.js in a browser). Works in modern browsers and Node.js 18+. No build step, no third-party deps.

Endpoint compatibility

All five REST endpoints: lookup, me, batch, asn, validate. Plan-gated endpoints still require the relevant plan on your API key.

Example

import { OpenIPApi } from '/sdk/javascript/openipapi.js';

const client = new OpenIPApi('YOUR_KEY');
const data = await client.lookup('8.8.8.8');
console.log(data.threat?.is_vpn);

// Batch lookup
const batch = await client.batch(['8.8.8.8', '1.1.1.1']);

Install / use

Drop the file into your project and import it. Python 3.8+. Uses only the standard library (urllib).

Endpoint compatibility

All five REST endpoints: lookup, me, batch, asn, validate. Plan-gated endpoints still require the relevant plan on your API key.

Example

from openipapi import OpenIPApi

client = OpenIPApi("YOUR_KEY")
data = client.lookup("8.8.8.8")
print(data.get("threat", {}).get("is_vpn"))

# Batch lookup
batch = client.batch(["8.8.8.8", "1.1.1.1"])

Install / use

Drop the file into your project and require it. PHP 8.0+. Uses curl when available, with a stream-context fallback. No Composer required.

Endpoint compatibility

All five REST endpoints: lookup, me, batch, asn, validate. Plan-gated endpoints still require the relevant plan on your API key.

Example

require __DIR__ . '/OpenIPApiClient.php';

$client = new OpenIPApiClient('YOUR_KEY');
$data = $client->lookup('8.8.8.8');
echo !empty($data['threat']['is_vpn']) ? 'yes' : 'no';

// Batch lookup
$batch = $client->batch(['8.8.8.8', '1.1.1.1']);

Direct HTTP fallback

No SDK is required to use OpenIPApi. The API is a thin REST + JSON layer — any HTTP client works:

$ curl https://api.openipapi.com/v1/lookup/8.8.8.8 \
     -H "X-API-Key: YOUR_KEY"

Package registry versions for npm, PyPI and Packagist may be added later.