NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server →

URL Lookup API

The URL Lookup API provides location information for any valid URL or domain name.

Online
(4.4)

From 7,993 users

3,600+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
228ms259ms288ms610ms1005ms

Didn't find what you were looking for? Suggest an improvement

https://api.api-ninjas.com/v1/urllookup

Returns the location of the IP address hosting the URL domain. The response contains both the geographical coordinates (latitude/longitude) as well as the city and country.

Parameters

  • url  required

    Valid URL to check. It supports schemes (e.g. http://example.com) as well as schemeless (e.g. example.com) formats. For top-level domains other than .com, a premium subscription is required.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

The /v1/urllookup endpoint returns a JSON object with the following fields, or an error if the request is unsuccessful.

  • url

    The URL that was looked up.

  • country

    Country name.

  • country_code

    2-letter ISO 3166 alpha-2 country code.

  • region

    State, province, or administrative region name.

  • region_code

    Region code (e.g., state code).

  • city

    City name.

  • zip

    ZIP or postal code.

  • lat

    Latitude coordinate.

  • lon

    Longitude coordinate.

  • timezone

    Timezone (e.g., America/New_York).

  • isp

    Internet Service Provider name.

Live Demo

Live demo · no API key required
Query parameters
url

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/urllookup?url=example.com
Sample response
{
"is_valid": true,
"country": "United States",
"country_code": "US",
"region_code": "MA",
"region": "Massachusetts",
"city": "Norwell",
"zip": "02061",
"lat": 42.1591,
"lon": -70.8163,
"timezone": "America/New_York",
"isp": "MCI Communications Services, Inc. d/b/a Verizon Business",
"url": "example.com"
}

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/urllookup?url=https%3A%2F%2Fexample.com" \ -H "X-Api-Key: YOUR_API_KEY"

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the URL Lookup API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • It resolves the URL to the IP address hosting it and returns geolocation details including country, country_code, region, region_code, city, zip, lat, lon, timezone, and the hosting isp. If you need the same data starting from an IP address instead of a URL, try the IP Lookup API.
  • The required url parameter accepts both full URLs with a scheme (e.g. http://example.com) and schemeless domains (e.g. example.com). Note that looking up top-level domains other than .com requires a premium subscription.
  • It is useful for fraud detection, content localization, and identifying where a website is hosted using its city, country, and isp fields. For related domain intelligence you can pair it with the DNS Lookup API or the Whois API.