API Documentation

Welcome to the dklyIPdatabase API documentation. Our API provides accurate IP geolocation data including country, region, city, timezone, currency, ISP information, and security threat detection.

Base URL

https://ipinfo.dkly.net/api/

Authentication Required

All API requests require a valid API key. You can obtain your API key by creating an account.

Authentication

The dklyIPdatabase API uses API keys to authenticate requests. You can include your API key in requests using either a header or query parameter.

Method 1: Header Authentication (Recommended)

Pass your API key in the X-API-Key header:

GET /api/?ip=8.8.8.8 HTTP/1.1 Host: ipinfo.dkly.net X-API-Key: your_api_key_here

Method 2: Query Parameter

Alternatively, include the API key as a query parameter:

GET https://ipinfo.dkly.net/api/?key=your_api_key_here&ip=8.8.8.8

Tip: Using header authentication is recommended for production applications as it keeps your API key out of URLs and server logs.

Managing API Keys

Generating API Keys

After creating an account, navigate to the Dashboard to generate your API key. Each account can have multiple API keys for different applications.

Regenerating Keys

If you believe your API key has been compromised, you can regenerate it from the dashboard. The old key will be immediately invalidated.

Revoking Keys

You can disable any API key at any time from the dashboard. Disabled keys will return an authentication error when used.

Quota Limits

Your monthly API quota depends on your subscription plan. You can monitor your usage in the dashboard. Quotas reset on the 1st of each month.

Plan Monthly Requests Rate Limit
free 35,000 60/min
pro 100,000 60/min
pro_plus 200,000 60/min
enterprise Unlimited 60/min
developer 155,000 60/min
developer_plus Unlimited 60/min

Security Best Practices

  • Never share your API key publicly or commit it to version control
  • Use environment variables to store API keys in your applications
  • Set up IP whitelisting for server-side applications
  • Use origin restrictions for client-side applications
  • Rotate keys periodically for enhanced security

For Open Source Developers

Building an open source project? You may be eligible for our Developer Plan with additional quota at no cost.

To apply, send us an email with:

  • Your GitHub repository URL
  • Brief description of your project
  • Expected API usage
Request Developer Plan

API Endpoints

GET

Single IP Lookup

Retrieve detailed geolocation and network information for a specific IP address.

ENDPOINT URL

GET /api/?key=your_api_key_here&ip={ip_address}

Parameters

Parameter Type Required Description
ip string Yes IPv4 or IPv6 address to lookup
key string Yes* Your API key (if not using header)

Example Request

curl -X GET "https://ipinfo.dkly.net/api/?key=your_api_key_here&ip=8.8.8.8"

Example Response

{
  "ip": "8.8.8.8",
  "type": "IPv4",
  "hostname": "dns.google",
  "connection": {
    "asn": 15169,
    "organization": "Google LLC",
    "type": "hosting"
  },
  "location": {
    "continent": {
      "code": "NA",
      "name": "North America"
    },
    "country": {
      "code": "US",
      "name": "United States",
      "flag": {
        "emoji": "🇺🇸"
      }
    },
    "region": {
      "code": "CA",
      "name": "California"
    },
    "city": "Mountain View",
    "postal": "94043",
    "latitude": 37.4056,
    "longitude": -122.0775
  },
  "time_zone": {
    "id": "America/Los_Angeles",
    "abbreviation": "PST",
    "offset": -28800
  },
  "security": {
    "is_vpn": false,
    "is_proxy": false,
    "is_tor": false,
    "is_threat": false
  }
}
GET

Origin IP Lookup

Automatically detect and return information for the requester's IP address. This is useful for client-side applications that need to identify the user's location.

ENDPOINT URL

GET /api/?key=your_api_key_here

Parameters

Parameter Type Required Description
key string Yes* Your API key (if not using header)

Example Request

curl -X GET "https://ipinfo.dkly.net/api/?key=your_api_key_here"

Note: The response format is identical to the Single IP Lookup endpoint. The IP address in the response will be the requester's public IP address.

Response Format

All API responses are returned in JSON format. The response includes comprehensive information organized into logical sections.

Response Fields

Basic Info
  • ip - IP address
  • type - IPv4 or IPv6
  • hostname - Reverse DNS
Connection
  • asn - AS number
  • organization - ISP/Org name
  • type - Connection type
Location
  • continent - Continent info
  • country - Country details
  • region - State/province
  • city - City name
  • postal - Postal code
  • latitude/longitude - Coordinates
Time Zone
  • id - Timezone ID
  • abbreviation - Short code
  • offset - UTC offset (sec)
Currency
  • code - Currency code
  • name - Currency name
  • symbol - Currency symbol
Security
  • is_vpn - VPN detection
  • is_proxy - Proxy detection
  • is_tor - Tor exit node
  • is_threat - Known threat

Error Handling

When an error occurs, the API returns a JSON response with an error code, message, and suggested resolution.

Error Response Format

{
  "code": "ERROR_CODE",
  "message": "Human-readable error description",
  "resolution": "Suggested action to fix the error"
}

Common Error Codes

HTTP Code Description
400 INVALID_IP The provided IP address format is invalid
401 API_KEY_MISSING No API key provided in request
401 API_KEY_INVALID The API key does not exist
401 API_KEY_DISABLED The API key has been disabled
401 API_KEY_EXPIRED The API key has expired
403 IP_NOT_ALLOWED Request IP not in whitelist
403 ORIGIN_NOT_ALLOWED Request origin not allowed
429 RATE_LIMIT_EXCEEDED Too many requests, slow down
429 QUOTA_EXCEEDED Monthly quota has been exceeded
405 METHOD_NOT_ALLOWED Only GET requests are allowed
500 INTERNAL_ERROR Server error, try again later

Example Error Response

{
  "code": "QUOTA_EXCEEDED",
  "message": "Monthly quota exceeded",
  "resolution": "Wait until next month or upgrade your plan"
}

Code Examples

cURL

Single IP Lookup

# Using header authentication
curl -X GET "https://ipinfo.dkly.net/api/?ip=8.8.8.8" \
     -H "X-API-Key: your_api_key_here" \
     -H "Accept: application/json"

# Using query parameter
curl -X GET "https://ipinfo.dkly.net/api/?key=your_api_key_here&ip=8.8.8.8"

Origin IP Lookup (Your IP)

curl -X GET "https://ipinfo.dkly.net/api/?key=your_api_key_here"

PHP

Using cURL

<?php

function lookupIP($ip, $apiKey) {
    $url = "https://ipinfo.dkly.net/api/?key=" . $apiKey . "&ip=" . urlencode($ip);

    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 10
    ]);

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($httpCode !== 200) {
        throw new Exception("API request failed with status: " . $httpCode);
    }

    return json_decode($response, true);
}

// Usage
$apiKey = "your_api_key_here";
$ipData = lookupIP("8.8.8.8", $apiKey);

echo "IP: " . $ipData['ip'] . "\n";
echo "Country: " . $ipData['location']['country']['name'] . "\n";
echo "City: " . $ipData['location']['city'] . "\n";

?>

Using file_get_contents

<?php

$apiKey = "your_api_key_here";
$ip = "8.8.8.8";

$url = "https://ipinfo.dkly.net/api/?key=" . $apiKey . "&ip=" . urlencode($ip);
$response = file_get_contents($url);
$data = json_decode($response, true);

print_r($data);

?>

Need Help?

If you have questions or need assistance, we're here to help.