agentsvc.io

services / ip-lookup

utilityoperational · 40 ms

IP Geolocation

Resolve any IPv4 or IPv6 address to location and network data. Returns country, country_code, city, region, postal, lat/lon, timezone, ISP, org, and ASN. Use for fraud detection, geolocation enrichment, or access log analysis.

Run free trial ↗3 free calls per day with the example input. Paid: $0.002 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/ip-lookup", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"ip":"8.8.8.8"}),
});
const { data, payment } = await res.json();  // payment.transaction = on-chain receipt

Input

FieldTypeDescription
ip *stringIPv4 or IPv6 address to look up (e.g. '8.8.8.8' or '2001:4860:4860::8888')

Output

FieldTypeDescription
ipstringThe queried IP address
countrystringFull country name
country_codestringISO 3166-1 alpha-2 country code
regionstringRegion/state name
citystringCity name
postalstringPostal/ZIP code
latnumberLatitude
lonnumberLongitude
timezonestringIANA timezone (e.g. America/New_York)
ispstringInternet Service Provider name
orgstringOrganization name
asnstringAutonomous System Number (e.g. AS15169)

Example response (data)

{
  "ip": "8.8.8.8",
  "country": "United States",
  "country_code": "US",
  "region": "Virginia",
  "city": "Ashburn",
  "postal": "20149",
  "lat": 39.0438,
  "lon": -77.4874,
  "timezone": "America/New_York",
  "isp": "Google LLC",
  "org": "Google Public DNS",
  "asn": "AS15169"
}