{
  "openapi": "3.1.0",
  "info": {
    "title": "dklyIPdatabase IP Geolocation API",
    "version": "1.0.0",
    "summary": "IP geolocation, network and security data for any IPv4 or IPv6 address.",
    "description": "Look up approximate location (continent, country, region, city, coordinates), network (ASN, organisation, route), time zone, currency and security signals (VPN, proxy, Tor, hosting) for any IPv4 or IPv6 address.\n\ndklyIPdatabase is a free, non-commercial hobby project: there are no paid plans or payments. Get a free API key at https://ipinfo.dkly.net/dashboard/register.php. Each key has a monthly quota and rate limits (per minute, per hour and per client IP per hour, depending on the plan).\n\nAuthenticate with the `X-API-Key` header (recommended) or the `key` query parameter. Only GET is supported (POST also for `/bulk`); `/dns` returns DNS records and reverse DNS for a domain or IP; CORS is open (`Access-Control-Allow-Origin: *`).\n\nErrors from the keyed API are JSON objects `{\"code\", \"message\", \"resolution\"}` (plus `reference` on 500/503). The keyless endpoints (tag \"Keyless (no API key)\") use `{\"error\": {\"code\", \"message\"}}` instead.\n\nGeolocation is approximate (network/city level), never a street address or a person.",
    "contact": {
      "name": "dklyIPdatabase",
      "url": "https://ipinfo.dkly.net/privacy"
    },
    "license": {
      "name": "Terms of Service",
      "url": "https://ipinfo.dkly.net/terms"
    },
    "termsOfService": "https://ipinfo.dkly.net/terms"
  },
  "externalDocs": {
    "description": "API documentation",
    "url": "https://ipinfo.dkly.net/documentation/"
  },
  "servers": [
    {
      "url": "https://ipinfo.dkly.net/api",
      "description": "Keyed API"
    }
  ],
  "tags": [
    {
      "name": "Lookup",
      "description": "IP lookups with an API key."
    },
    {
      "name": "DNS",
      "description": "DNS records and reverse DNS with an API key."
    },
    {
      "name": "Keyless (no API key)",
      "description": "Convenience endpoints without a key: 60 lookups per hour per visitor IP (fixed clock-hour window) plus a burst limit of 20 requests per minute across the keyless endpoints. Responses carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix time of the next hour); a 429 has Retry-After. Short response format, Cache-Control: no-store, CORS open."
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "ApiKeyQuery": []
    }
  ],
  "paths": {
    "/": {
      "get": {
        "tags": [
          "Lookup"
        ],
        "operationId": "lookupIp",
        "summary": "Look up an IP (or your own IP)",
        "description": "Returns data for the IP in the `ip` query parameter. Without `ip`, the caller's own public IP is looked up. The path `/` is served by `/api/index.php`, so `https://ipinfo.dkly.net/api/?ip=8.8.8.8` and `https://ipinfo.dkly.net/api/index.php?ip=8.8.8.8` are equivalent.",
        "parameters": [
          {
            "name": "ip",
            "in": "query",
            "required": false,
            "description": "IPv4 or IPv6 address. Omit to look up the caller's IP.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "ipv4": {
                "value": "8.8.8.8"
              },
              "ipv6": {
                "value": "2001:4860:4860::8888"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Lookup"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/index.php/{ip}": {
      "get": {
        "tags": [
          "Lookup"
        ],
        "operationId": "lookupIpPath",
        "summary": "Look up an IP given in the path",
        "description": "Path form of the lookup (the IP is read from PATH_INFO), e.g. `https://ipinfo.dkly.net/api/index.php/8.8.8.8`. If an `ip` query parameter is also given, it takes precedence.",
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "description": "IPv4 or IPv6 address.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "ipv4": {
                "value": "8.8.8.8"
              },
              "ipv6": {
                "value": "2001:4860:4860::8888"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Lookup"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/{ip}": {
      "get": {
        "tags": [
          "Lookup"
        ],
        "operationId": "lookupIpShortPath",
        "summary": "Look up an IP given in the path (short URL)",
        "description": "Same as `/?ip={ip}`, e.g. `https://ipinfo.dkly.net/api/8.8.8.8` or `https://ipinfo.dkly.net/api/2001:4860:4860::8888`. If an `ip` query parameter is also given, it takes precedence.",
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "description": "IPv4 or IPv6 address.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "ipv4": {
                "value": "8.8.8.8"
              },
              "ipv6": {
                "value": "2001:4860:4860::8888"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Lookup"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/json": {
      "get": {
        "tags": [
          "Keyless (no API key)"
        ],
        "operationId": "keylessOwnIp",
        "summary": "Your own IP, short JSON (no key)",
        "servers": [
          {
            "url": "https://ipinfo.dkly.net",
            "description": "Keyless endpoints on the main site"
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Short lookup of the caller's IP.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ShortLookup"
                    },
                    {
                      "$ref": "#/components/schemas/ShortBogon"
                    }
                  ]
                },
                "examples": {
                  "google-dns": {
                    "summary": "8.8.8.8",
                    "value": {
                      "ip": "8.8.8.8",
                      "hostname": null,
                      "city": "Mountain View",
                      "region": "California",
                      "country": "United States",
                      "country_code": "US",
                      "continent": "North America",
                      "postal": "94043",
                      "latitude": 37.40552,
                      "longitude": -122.07746,
                      "timezone": "America/Los_Angeles",
                      "asn": 15169,
                      "org": "Google LLC",
                      "route": "8.8.8.0/24",
                      "connection_type": "hosting",
                      "security": {
                        "vpn": false,
                        "proxy": false,
                        "tor": false,
                        "hosting": true
                      },
                      "readme": "https://ipinfo.dkly.net/documentation/"
                    }
                  },
                  "private": {
                    "summary": "Private / reserved address",
                    "value": {
                      "ip": "10.0.0.1",
                      "bogon": true,
                      "note": "Private or reserved address: no public location."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortError"
                },
                "example": {
                  "error": {
                    "code": "INVALID_IP",
                    "message": "Enter an IPv4 address like 8.8.8.8 or an IPv6 address like 2001:4860:4860::8888."
                  }
                }
              }
            }
          },
          "429": {
            "description": "More than 60 lookups in the current clock hour, or more than 20 keyless requests in the current minute, from this visitor IP.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the next minute (burst limit) or the next hour (hourly limit).",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortError"
                },
                "example": {
                  "error": {
                    "code": "RATE_LIMITED",
                    "message": "You can look up 60 IP addresses per hour on this page. Create a free account to get an API key with a higher limit."
                  }
                }
              }
            }
          },
          "503": {
            "description": "Lookup temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortError"
                },
                "example": {
                  "error": {
                    "code": "SERVICE_UNAVAILABLE",
                    "message": "We could not look up this IP right now. Please try again in a minute."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/{ip}/json": {
      "get": {
        "tags": [
          "Keyless (no API key)"
        ],
        "operationId": "keylessLookup",
        "summary": "Any IP, short JSON (no key)",
        "servers": [
          {
            "url": "https://ipinfo.dkly.net",
            "description": "Keyless endpoints on the main site"
          }
        ],
        "security": [],
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "description": "IPv4 or IPv6 address.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "ipv4": {
                "value": "8.8.8.8"
              },
              "ipv6": {
                "value": "2001:4860:4860::8888"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Short lookup of the given IP.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ShortLookup"
                    },
                    {
                      "$ref": "#/components/schemas/ShortBogon"
                    }
                  ]
                },
                "examples": {
                  "google-dns": {
                    "summary": "8.8.8.8",
                    "value": {
                      "ip": "8.8.8.8",
                      "hostname": null,
                      "city": "Mountain View",
                      "region": "California",
                      "country": "United States",
                      "country_code": "US",
                      "continent": "North America",
                      "postal": "94043",
                      "latitude": 37.40552,
                      "longitude": -122.07746,
                      "timezone": "America/Los_Angeles",
                      "asn": 15169,
                      "org": "Google LLC",
                      "route": "8.8.8.0/24",
                      "connection_type": "hosting",
                      "security": {
                        "vpn": false,
                        "proxy": false,
                        "tor": false,
                        "hosting": true
                      },
                      "readme": "https://ipinfo.dkly.net/documentation/"
                    }
                  },
                  "private": {
                    "summary": "Private / reserved address",
                    "value": {
                      "ip": "10.0.0.1",
                      "bogon": true,
                      "note": "Private or reserved address: no public location."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortError"
                },
                "example": {
                  "error": {
                    "code": "INVALID_IP",
                    "message": "Enter an IPv4 address like 8.8.8.8 or an IPv6 address like 2001:4860:4860::8888."
                  }
                }
              }
            }
          },
          "429": {
            "description": "More than 60 lookups in the current clock hour, or more than 20 keyless requests in the current minute, from this visitor IP.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the next minute (burst limit) or the next hour (hourly limit).",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortError"
                },
                "example": {
                  "error": {
                    "code": "RATE_LIMITED",
                    "message": "You can look up 60 IP addresses per hour on this page. Create a free account to get an API key with a higher limit."
                  }
                }
              }
            }
          },
          "503": {
            "description": "Lookup temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortError"
                },
                "example": {
                  "error": {
                    "code": "SERVICE_UNAVAILABLE",
                    "message": "We could not look up this IP right now. Please try again in a minute."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/me": {
      "get": {
        "tags": [
          "Keyless (no API key)"
        ],
        "operationId": "keylessPlainIp",
        "summary": "Your IP as plain text (curl / wget)",
        "description": "Request `https://ipinfo.dkly.net/me` with a command-line User-Agent (curl, wget, HTTPie, PowerShell, python-requests, Go, node-fetch, ...) and no `text/html` in `Accept` to get just your IP followed by a newline. This uses only the per-minute burst budget, not an hourly lookup. The site root (`curl ipinfo.dkly.net`) instead prints a short human-readable summary (IP, hostname, location, coordinates, time zone, network, route, type, privacy flags and hints); it is not listed as a separate path because `/` is the keyed API path here. Browsers get the HTML site.",
        "servers": [
          {
            "url": "https://ipinfo.dkly.net",
            "description": "Keyless endpoints on the main site"
          }
        ],
        "security": [],
        "parameters": [
          {
            "name": "User-Agent",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "curl/8.5.0"
          }
        ],
        "responses": {
          "200": {
            "description": "Caller's IP as text.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "203.0.113.7\n"
              }
            }
          }
        }
      }
    },
    "/bulk": {
      "get": {
        "tags": [
          "Lookup"
        ],
        "operationId": "bulkLookupGet",
        "summary": "Bulk lookup (comma-separated, up to 10 IPs)",
        "description": "Look up to 10 IPs in one request. Each IP actually looked up counts as one request against the key's monthly quota and rate limits; the whole batch must fit before any lookup is done. Invalid and private/reserved IPs return per-item errors and use no quota. `results` keeps input order.",
        "parameters": [
          {
            "name": "ips",
            "in": "query",
            "required": true,
            "description": "Comma-separated IPv4/IPv6 addresses, at most 10 unique.",
            "schema": {
              "type": "string"
            },
            "example": "8.8.8.8,1.1.1.1"
          }
        ],
        "responses": {
          "200": {
            "description": "Results for every IP. Per-item failures do not fail the batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkResponse"
                }
              }
            }
          },
          "400": {
            "description": "No IPs, more than 10 unique IPs, or a malformed body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "no-ips": {
                    "value": {
                      "code": "NO_IPS",
                      "message": "No IP addresses provided",
                      "resolution": "Send a JSON body like {\"ips\": [\"8.8.8.8\", \"1.1.1.1\"]} or use ?ips=8.8.8.8,1.1.1.1"
                    }
                  },
                  "too-many": {
                    "value": {
                      "code": "TOO_MANY_IPS",
                      "message": "Too many IP addresses: at most 10 unique IPs per request",
                      "resolution": "Split the list into batches of 10 IPs or fewer"
                    }
                  },
                  "bad-json": {
                    "value": {
                      "code": "INVALID_REQUEST",
                      "message": "Request body is not valid JSON",
                      "resolution": "Send a JSON body like {\"ips\": [\"8.8.8.8\", \"1.1.1.1\"]} with Content-Type: application/json"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "description": "Only GET, POST (and OPTIONS preflight) are accepted on /bulk.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "put": {
                    "value": {
                      "code": "METHOD_NOT_ALLOWED",
                      "message": "Only GET and POST methods are allowed for bulk lookups",
                      "resolution": "Use POST /api/bulk with a JSON body {\"ips\": [...]} or GET /api/bulk?ips=ip1,ip2"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The key has no room for the whole batch (each IP looked up counts as one request) or a rate limit is already reached. Nothing was looked up.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "value": {
                      "code": "QUOTA_EXCEEDED",
                      "message": "Not enough monthly quota left for this batch (5 lookups requested, 2 remaining)",
                      "resolution": "Send fewer IPs, wait until next month or upgrade your plan"
                    }
                  },
                  "rate": {
                    "value": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Rate limit exceeded per minute: this batch needs 5 lookups, 3 left in the current window",
                      "resolution": "Wait a moment or send fewer IPs per request"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "tags": [
          "Lookup"
        ],
        "operationId": "bulkLookup",
        "summary": "Bulk lookup (JSON body, up to 10 IPs)",
        "description": "Look up to 10 IPs in one request. Each IP actually looked up counts as one request against the key's monthly quota and rate limits; the whole batch must fit before any lookup is done. Invalid and private/reserved IPs return per-item errors and use no quota. `results` keeps input order.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Results for every IP. Per-item failures do not fail the batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkResponse"
                }
              }
            }
          },
          "400": {
            "description": "No IPs, more than 10 unique IPs, or a malformed body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "no-ips": {
                    "value": {
                      "code": "NO_IPS",
                      "message": "No IP addresses provided",
                      "resolution": "Send a JSON body like {\"ips\": [\"8.8.8.8\", \"1.1.1.1\"]} or use ?ips=8.8.8.8,1.1.1.1"
                    }
                  },
                  "too-many": {
                    "value": {
                      "code": "TOO_MANY_IPS",
                      "message": "Too many IP addresses: at most 10 unique IPs per request",
                      "resolution": "Split the list into batches of 10 IPs or fewer"
                    }
                  },
                  "bad-json": {
                    "value": {
                      "code": "INVALID_REQUEST",
                      "message": "Request body is not valid JSON",
                      "resolution": "Send a JSON body like {\"ips\": [\"8.8.8.8\", \"1.1.1.1\"]} with Content-Type: application/json"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "description": "Only GET, POST (and OPTIONS preflight) are accepted on /bulk.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "put": {
                    "value": {
                      "code": "METHOD_NOT_ALLOWED",
                      "message": "Only GET and POST methods are allowed for bulk lookups",
                      "resolution": "Use POST /api/bulk with a JSON body {\"ips\": [...]} or GET /api/bulk?ips=ip1,ip2"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The key has no room for the whole batch (each IP looked up counts as one request) or a rate limit is already reached. Nothing was looked up.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "value": {
                      "code": "QUOTA_EXCEEDED",
                      "message": "Not enough monthly quota left for this batch (5 lookups requested, 2 remaining)",
                      "resolution": "Send fewer IPs, wait until next month or upgrade your plan"
                    }
                  },
                  "rate": {
                    "value": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Rate limit exceeded per minute: this batch needs 5 lookups, 3 left in the current window",
                      "resolution": "Wait a moment or send fewer IPs per request"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/dns": {
      "get": {
        "tags": [
          "DNS"
        ],
        "operationId": "dnsLookup",
        "summary": "DNS / reverse DNS lookup (query parameter)",
        "description": "DNS records for a domain (A, AAAA, CNAME, MX, NS, TXT with SPF/DKIM/verification tags, DMARC, SOA, CAA), or reverse DNS (PTR) with a forward-confirmation (FCrDNS) check for an IPv4/IPv6 address. Each call counts as one request against the key's quota and rate limits, including 400 responses. DNS only (no connection to the host), no geolocation of the returned addresses. Results are cached up to 5 minutes; an 8-second time budget applies (see `partial`).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Domain / host name or IPv4 / IPv6 address. URLs, host:port, trailing dots, upper case and IDN are normalised.",
            "schema": {
              "type": "string",
              "maxLength": 300
            },
            "examples": {
              "domain": {
                "value": "example.com"
              },
              "ipv4": {
                "value": "8.8.8.8"
              }
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Domains only: comma-separated record types (case-insensitive), any of A, AAAA, CNAME, MX, NS, TXT, DMARC, SOA, CAA. Default: all. Ignored for IP addresses.",
            "schema": {
              "type": "string"
            },
            "example": "A,MX,TXT"
          }
        ],
        "responses": {
          "200": {
            "description": "DNS result. A name that does not exist returns 200 with empty `records` and `nxdomain: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DnsResponse"
                },
                "examples": {
                  "domain": {
                    "summary": "example.com",
                    "value": {
                      "query": "example.com",
                      "type": "domain",
                      "records": {
                        "A": [
                          {
                            "ip": "104.20.23.154",
                            "ttl": 273
                          },
                          {
                            "ip": "172.66.147.243",
                            "ttl": 273
                          }
                        ],
                        "AAAA": [
                          {
                            "ip": "2606:4700:10::6814:179a",
                            "ttl": 167
                          },
                          {
                            "ip": "2606:4700:10::ac42:93f3",
                            "ttl": 167
                          }
                        ],
                        "MX": [
                          {
                            "priority": 0,
                            "target": "",
                            "ttl": 75
                          }
                        ],
                        "NS": [
                          {
                            "target": "elliott.ns.cloudflare.com",
                            "ttl": 6771
                          },
                          {
                            "target": "hera.ns.cloudflare.com",
                            "ttl": 6771
                          }
                        ],
                        "TXT": [
                          {
                            "value": "_k2n1y4vw3qtb4skdx9e7dxt97qrmmq9",
                            "kind": null,
                            "ttl": 300
                          },
                          {
                            "value": "v=spf1 -all",
                            "kind": "SPF",
                            "ttl": 300
                          }
                        ],
                        "DMARC": [
                          {
                            "name": "_dmarc.example.com",
                            "value": "v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s",
                            "ttl": 300
                          }
                        ],
                        "SOA": [
                          {
                            "mname": "elliott.ns.cloudflare.com",
                            "rname": "dns.cloudflare.com",
                            "serial": 2421050422,
                            "refresh": 10000,
                            "retry": 2400,
                            "expire": 604800,
                            "minimum_ttl": 1800,
                            "ttl": 90
                          }
                        ]
                      },
                      "ptr": null,
                      "forward_confirmed": null,
                      "partial": false,
                      "nxdomain": false
                    }
                  },
                  "reverse": {
                    "summary": "8.8.8.8 (reverse DNS)",
                    "value": {
                      "query": "8.8.8.8",
                      "type": "ip",
                      "records": {
                        "PTR": [
                          {
                            "name": "dns.google",
                            "ttl": 1371,
                            "forward": [
                              "8.8.4.4",
                              "8.8.8.8"
                            ],
                            "confirmed": true
                          }
                        ]
                      },
                      "ptr": "dns.google",
                      "forward_confirmed": true,
                      "reverse_name": "8.8.8.8.in-addr.arpa",
                      "partial": false
                    }
                  },
                  "nxdomain": {
                    "summary": "Name that does not exist",
                    "value": {
                      "query": "nonexistent-zzqx-12345.com",
                      "type": "domain",
                      "records": {},
                      "ptr": null,
                      "forward_confirmed": null,
                      "partial": false,
                      "nxdomain": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid query, private/reserved IP, or unsupported record type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "value": {
                      "code": "INVALID_QUERY",
                      "message": "Not a valid domain name or IP address: not_valid!!",
                      "resolution": "Pass a host name like example.com, an IPv4 address like 8.8.8.8 or an IPv6 address like 2001:4860:4860::8888"
                    }
                  },
                  "private": {
                    "value": {
                      "code": "PRIVATE_ADDRESS",
                      "message": "192.168.1.1 is a private or reserved address and has no public reverse DNS",
                      "resolution": "Look up a public IPv4 or IPv6 address"
                    }
                  },
                  "types": {
                    "value": {
                      "code": "INVALID_TYPES",
                      "message": "Unsupported record type(s): FOO",
                      "resolution": "Use a comma-separated list of: A, AAAA, CNAME, MX, NS, TXT, DMARC, SOA, CAA"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "description": "Only GET (and OPTIONS preflight) is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "code": "METHOD_NOT_ALLOWED",
                  "message": "Only GET method is allowed for DNS lookups",
                  "resolution": "Use GET /api/dns?q=example.com or GET /api/dns/{domain-or-ip}"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/dns/{query}": {
      "get": {
        "tags": [
          "DNS"
        ],
        "operationId": "dnsLookupPath",
        "summary": "DNS / reverse DNS lookup (path form)",
        "description": "DNS records for a domain (A, AAAA, CNAME, MX, NS, TXT with SPF/DKIM/verification tags, DMARC, SOA, CAA), or reverse DNS (PTR) with a forward-confirmation (FCrDNS) check for an IPv4/IPv6 address. Each call counts as one request against the key's quota and rate limits, including 400 responses. DNS only (no connection to the host), no geolocation of the returned addresses. Results are cached up to 5 minutes; an 8-second time budget applies (see `partial`). Path form: `https://ipinfo.dkly.net/api/dns/example.com`; IPv6 addresses work unescaped, e.g. `/api/dns/2001:4860:4860::8888`.",
        "parameters": [
          {
            "name": "query",
            "in": "path",
            "required": true,
            "description": "Domain / host name or IPv4 / IPv6 address.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "domain": {
                "value": "example.com"
              },
              "ipv6": {
                "value": "2001:4860:4860::8888"
              }
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Domains only: comma-separated record types (case-insensitive), any of A, AAAA, CNAME, MX, NS, TXT, DMARC, SOA, CAA. Default: all. Ignored for IP addresses.",
            "schema": {
              "type": "string"
            },
            "example": "A,MX,TXT"
          }
        ],
        "responses": {
          "200": {
            "description": "DNS result. A name that does not exist returns 200 with empty `records` and `nxdomain: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DnsResponse"
                },
                "examples": {
                  "domain": {
                    "summary": "example.com",
                    "value": {
                      "query": "example.com",
                      "type": "domain",
                      "records": {
                        "A": [
                          {
                            "ip": "104.20.23.154",
                            "ttl": 273
                          },
                          {
                            "ip": "172.66.147.243",
                            "ttl": 273
                          }
                        ],
                        "AAAA": [
                          {
                            "ip": "2606:4700:10::6814:179a",
                            "ttl": 167
                          },
                          {
                            "ip": "2606:4700:10::ac42:93f3",
                            "ttl": 167
                          }
                        ],
                        "MX": [
                          {
                            "priority": 0,
                            "target": "",
                            "ttl": 75
                          }
                        ],
                        "NS": [
                          {
                            "target": "elliott.ns.cloudflare.com",
                            "ttl": 6771
                          },
                          {
                            "target": "hera.ns.cloudflare.com",
                            "ttl": 6771
                          }
                        ],
                        "TXT": [
                          {
                            "value": "_k2n1y4vw3qtb4skdx9e7dxt97qrmmq9",
                            "kind": null,
                            "ttl": 300
                          },
                          {
                            "value": "v=spf1 -all",
                            "kind": "SPF",
                            "ttl": 300
                          }
                        ],
                        "DMARC": [
                          {
                            "name": "_dmarc.example.com",
                            "value": "v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s",
                            "ttl": 300
                          }
                        ],
                        "SOA": [
                          {
                            "mname": "elliott.ns.cloudflare.com",
                            "rname": "dns.cloudflare.com",
                            "serial": 2421050422,
                            "refresh": 10000,
                            "retry": 2400,
                            "expire": 604800,
                            "minimum_ttl": 1800,
                            "ttl": 90
                          }
                        ]
                      },
                      "ptr": null,
                      "forward_confirmed": null,
                      "partial": false,
                      "nxdomain": false
                    }
                  },
                  "reverse": {
                    "summary": "8.8.8.8 (reverse DNS)",
                    "value": {
                      "query": "8.8.8.8",
                      "type": "ip",
                      "records": {
                        "PTR": [
                          {
                            "name": "dns.google",
                            "ttl": 1371,
                            "forward": [
                              "8.8.4.4",
                              "8.8.8.8"
                            ],
                            "confirmed": true
                          }
                        ]
                      },
                      "ptr": "dns.google",
                      "forward_confirmed": true,
                      "reverse_name": "8.8.8.8.in-addr.arpa",
                      "partial": false
                    }
                  },
                  "nxdomain": {
                    "summary": "Name that does not exist",
                    "value": {
                      "query": "nonexistent-zzqx-12345.com",
                      "type": "domain",
                      "records": {},
                      "ptr": null,
                      "forward_confirmed": null,
                      "partial": false,
                      "nxdomain": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid query, private/reserved IP, or unsupported record type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "value": {
                      "code": "INVALID_QUERY",
                      "message": "Not a valid domain name or IP address: not_valid!!",
                      "resolution": "Pass a host name like example.com, an IPv4 address like 8.8.8.8 or an IPv6 address like 2001:4860:4860::8888"
                    }
                  },
                  "private": {
                    "value": {
                      "code": "PRIVATE_ADDRESS",
                      "message": "192.168.1.1 is a private or reserved address and has no public reverse DNS",
                      "resolution": "Look up a public IPv4 or IPv6 address"
                    }
                  },
                  "types": {
                    "value": {
                      "code": "INVALID_TYPES",
                      "message": "Unsupported record type(s): FOO",
                      "resolution": "Use a comma-separated list of: A, AAAA, CNAME, MX, NS, TXT, DMARC, SOA, CAA"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "405": {
            "description": "Only GET (and OPTIONS preflight) is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "code": "METHOD_NOT_ALLOWED",
                  "message": "Only GET method is allowed for DNS lookups",
                  "resolution": "Use GET /api/dns?q=example.com or GET /api/dns/{domain-or-ip}"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Recommended."
      },
      "ApiKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "key",
        "description": "Used when no X-API-Key header is sent."
      }
    },
    "schemas": {
      "IpLookup": {
        "type": "object",
        "description": "Full lookup result. Fields that are unknown for an IP are null (or empty objects/arrays). The first lookup of an IP that is not cached yet is passed through from the upstream data source and may carry extra fields not listed here; clients should ignore unknown fields.",
        "required": [
          "ip",
          "type"
        ],
        "properties": {
          "ip": {
            "type": "string",
            "description": "The IP address that was looked up.",
            "examples": [
              "8.8.8.8"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "IPv4",
              "IPv6"
            ]
          },
          "hostname": {
            "type": [
              "string",
              "null"
            ],
            "description": "Reverse DNS hostname, when known."
          },
          "carrier": {
            "$ref": "#/components/schemas/Carrier"
          },
          "company": {
            "$ref": "#/components/schemas/Company"
          },
          "connection": {
            "$ref": "#/components/schemas/Connection"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "location": {
            "$ref": "#/components/schemas/Location"
          },
          "security": {
            "$ref": "#/components/schemas/Security"
          },
          "time_zone": {
            "$ref": "#/components/schemas/TimeZone"
          }
        }
      },
      "Carrier": {
        "type": "object",
        "description": "Mobile carrier (only set for mobile networks).",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Carrier name."
          },
          "mcc": {
            "type": [
              "string",
              "null"
            ],
            "description": "Mobile country code."
          },
          "mnc": {
            "type": [
              "string",
              "null"
            ],
            "description": "Mobile network code."
          }
        }
      },
      "Company": {
        "type": "object",
        "description": "Organisation that holds the IP.",
        "properties": {
          "domain": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company domain."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company name."
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company type, typically one of isp, business, hosting, education, government, unknown."
          }
        }
      },
      "Connection": {
        "type": "object",
        "description": "Network the IP belongs to.",
        "properties": {
          "asn": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Autonomous system number (without the AS prefix)."
          },
          "domain": {
            "type": [
              "string",
              "null"
            ],
            "description": "Network / AS domain."
          },
          "organization": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISP or organisation name."
          },
          "route": {
            "type": [
              "string",
              "null"
            ],
            "description": "Announced prefix (CIDR), e.g. 8.8.8.0/24."
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Connection type, typically one of isp, business, hosting, education, government, unknown."
          }
        }
      },
      "CurrencyAffix": {
        "type": "object",
        "properties": {
          "prefix": {
            "type": [
              "string",
              "null"
            ]
          },
          "suffix": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Currency": {
        "type": "object",
        "description": "Currency of the country. May be an empty object when the country is unknown.",
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 code."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "name_native": {
            "type": [
              "string",
              "null"
            ]
          },
          "plural": {
            "type": [
              "string",
              "null"
            ]
          },
          "plural_native": {
            "type": [
              "string",
              "null"
            ]
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ]
          },
          "symbol_native": {
            "type": [
              "string",
              "null"
            ]
          },
          "format": {
            "type": "object",
            "properties": {
              "decimal_separator": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "group_separator": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "negative": {
                "$ref": "#/components/schemas/CurrencyAffix"
              },
              "positive": {
                "$ref": "#/components/schemas/CurrencyAffix"
              }
            }
          }
        }
      },
      "Language": {
        "type": "object",
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 639-1 code."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "native": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Country": {
        "type": "object",
        "properties": {
          "area": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Area in km²."
          },
          "borders": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "ISO codes of bordering countries (may be empty)."
          },
          "calling_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "International calling code without +."
          },
          "capital": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 code. \"ZZ\" when unknown."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "population": {
            "type": [
              "integer",
              "null"
            ]
          },
          "population_density": {
            "type": [
              "number",
              "null"
            ]
          },
          "flag": {
            "type": "object",
            "properties": {
              "emoji": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "emoji_unicode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "emojitwo": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Flag image URL.",
                "format": "uri"
              },
              "noto": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Flag image URL.",
                "format": "uri"
              },
              "twemoji": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Flag image URL.",
                "format": "uri"
              },
              "wikimedia": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Flag image URL.",
                "format": "uri"
              }
            }
          },
          "languages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Language"
            }
          },
          "tld": {
            "type": [
              "string",
              "null"
            ],
            "description": "Country top-level domain, e.g. .us"
          }
        }
      },
      "Location": {
        "type": "object",
        "description": "Approximate location (network/city level).",
        "properties": {
          "continent": {
            "type": "object",
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Two-letter continent code (\"ZZ\" when unknown)."
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "country": {
            "$ref": "#/components/schemas/Country"
          },
          "region": {
            "type": "object",
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 3166-2 code, e.g. US-CA."
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "postal": {
            "type": [
              "string",
              "null"
            ]
          },
          "latitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "longitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "language": {
            "$ref": "#/components/schemas/Language"
          },
          "in_eu": {
            "type": "boolean",
            "description": "Country is an EU member state."
          }
        }
      },
      "Security": {
        "type": "object",
        "description": "Threat and anonymity signals.",
        "properties": {
          "is_abuser": {
            "type": "boolean",
            "description": "Known abuse source."
          },
          "is_attacker": {
            "type": "boolean",
            "description": "Known attack source."
          },
          "is_bogon": {
            "type": "boolean",
            "description": "Private, reserved or unallocated address."
          },
          "is_cloud_provider": {
            "type": "boolean",
            "description": "Belongs to a hosting / cloud provider."
          },
          "is_proxy": {
            "type": "boolean",
            "description": "Proxy detected."
          },
          "is_relay": {
            "type": "boolean",
            "description": "Relay (e.g. iCloud Private Relay)."
          },
          "is_tor": {
            "type": "boolean",
            "description": "Tor network."
          },
          "is_tor_exit": {
            "type": "boolean",
            "description": "Tor exit node."
          },
          "is_vpn": {
            "type": "boolean",
            "description": "VPN detected."
          },
          "is_anonymous": {
            "type": "boolean",
            "description": "Any anonymity signal (VPN, proxy, Tor, relay)."
          },
          "is_threat": {
            "type": "boolean",
            "description": "Any threat signal."
          }
        }
      },
      "TimeZone": {
        "type": "object",
        "description": "Time zone of the location. May be an empty object when unknown.",
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "IANA time zone, e.g. America/Los_Angeles."
          },
          "abbreviation": {
            "type": [
              "string",
              "null"
            ]
          },
          "current_time": {
            "type": "string",
            "format": "date-time",
            "description": "Time the response was generated (ISO 8601)."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "offset": {
            "type": [
              "integer",
              "null"
            ],
            "description": "UTC offset in seconds."
          },
          "in_daylight_saving": {
            "type": "boolean",
            "description": "Daylight saving time is in effect."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message",
          "resolution"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "INVALID_IP",
              "BOGON_IP",
              "INVALID_REQUEST",
              "API_KEY_MISSING",
              "API_KEY_INVALID",
              "API_KEY_DISABLED",
              "API_KEY_EXPIRED",
              "IP_NOT_ALLOWED",
              "ORIGIN_NOT_ALLOWED",
              "METHOD_NOT_ALLOWED",
              "RATE_LIMIT_EXCEEDED",
              "QUOTA_EXCEEDED",
              "INTERNAL_ERROR",
              "SERVICE_UNAVAILABLE",
              "NO_IPS",
              "TOO_MANY_IPS",
              "PAYLOAD_TOO_LARGE",
              "INVALID_QUERY",
              "INVALID_TYPES",
              "PRIVATE_ADDRESS"
            ]
          },
          "message": {
            "type": "string"
          },
          "resolution": {
            "type": "string"
          },
          "reference": {
            "type": "string",
            "description": "Only on 500/503: reference code to quote when contacting support.",
            "pattern": "^[0-9A-F]{8}$"
          }
        }
      },
      "ShortLookup": {
        "type": "object",
        "description": "Short lookup result of the keyless endpoints.",
        "properties": {
          "ip": {
            "type": "string"
          },
          "hostname": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "continent": {
            "type": [
              "string",
              "null"
            ]
          },
          "postal": {
            "type": [
              "string",
              "null"
            ]
          },
          "latitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "longitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "IANA time zone."
          },
          "asn": {
            "type": [
              "integer",
              "null"
            ]
          },
          "org": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISP / organisation."
          },
          "route": {
            "type": [
              "string",
              "null"
            ]
          },
          "connection_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "security": {
            "type": "object",
            "properties": {
              "vpn": {
                "type": "boolean"
              },
              "proxy": {
                "type": "boolean"
              },
              "tor": {
                "type": "boolean",
                "description": "Tor network or Tor exit node."
              },
              "hosting": {
                "type": "boolean",
                "description": "Cloud provider or hosting connection."
              }
            }
          },
          "readme": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ShortBogon": {
        "type": "object",
        "description": "Returned (HTTP 200) by the keyless endpoints for private or reserved addresses.",
        "properties": {
          "ip": {
            "type": "string"
          },
          "bogon": {
            "type": "boolean",
            "const": true
          },
          "note": {
            "type": "string"
          }
        }
      },
      "ShortError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_IP",
                  "RATE_LIMITED",
                  "SERVICE_UNAVAILABLE"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "BulkRequest": {
        "type": "object",
        "required": [
          "ips"
        ],
        "properties": {
          "ips": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string"
            },
            "description": "IPv4 or IPv6 addresses. Trimmed and de-duplicated; at most 10 unique entries."
          }
        },
        "example": {
          "ips": [
            "8.8.8.8",
            "1.1.1.1",
            "2606:4700:4700::1111"
          ]
        }
      },
      "BulkItemError": {
        "type": "object",
        "required": [
          "error"
        ],
        "description": "Per-item error. INVALID_IP and BOGON_IP use no quota; INTERNAL_ERROR / SERVICE_UNAVAILABLE include a reference.",
        "properties": {
          "ip": {
            "type": "string",
            "description": "Only on BOGON_IP."
          },
          "bogon": {
            "type": "boolean",
            "description": "true for private or reserved addresses (BOGON_IP)."
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_IP",
                  "BOGON_IP",
                  "INTERNAL_ERROR",
                  "SERVICE_UNAVAILABLE"
                ]
              },
              "message": {
                "type": "string"
              },
              "reference": {
                "type": "string",
                "pattern": "^[0-9A-F]{8}$",
                "description": "Only on INTERNAL_ERROR / SERVICE_UNAVAILABLE."
              }
            }
          }
        }
      },
      "BulkResponse": {
        "type": "object",
        "required": [
          "count",
          "results"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "Number of unique IPs in results."
          },
          "results": {
            "type": "object",
            "description": "Keyed by IP, in the order sent. Each value is a full lookup object (same as a single lookup) or a per-item error.",
            "additionalProperties": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/IpLookup"
                },
                {
                  "$ref": "#/components/schemas/BulkItemError"
                }
              ]
            }
          }
        },
        "example": {
          "count": 3,
          "results": {
            "8.8.8.8": {
              "ip": "8.8.8.8",
              "type": "IPv4",
              "connection": {
                "asn": 15169,
                "organization": "Google LLC"
              },
              "location": {
                "country": {
                  "code": "US",
                  "name": "United States"
                }
              }
            },
            "not-an-ip": {
              "error": {
                "code": "INVALID_IP",
                "message": "Invalid IP address: not-an-ip"
              }
            },
            "10.0.0.1": {
              "ip": "10.0.0.1",
              "bogon": true,
              "error": {
                "code": "BOGON_IP",
                "message": "10.0.0.1 is a private or reserved address and has no geolocation data"
              }
            }
          }
        }
      },
      "DnsResponse": {
        "type": "object",
        "required": [
          "query",
          "type",
          "records",
          "ptr",
          "forward_confirmed",
          "partial"
        ],
        "description": "Result of GET /dns. Same shape as the keyless `https://ipinfo.dkly.net/dns/{query}.json`, without the per-address country/network enrichment.",
        "properties": {
          "query": {
            "type": "string",
            "description": "Normalised query: lower-case host name (IDN as punycode) or canonical IP address."
          },
          "type": {
            "type": "string",
            "enum": [
              "domain",
              "ip"
            ]
          },
          "records": {
            "type": "object",
            "description": "One list per record type that exists. Domains: A, AAAA, CNAME, MX, NS, TXT, DMARC, SOA, CAA. IPs: PTR.",
            "properties": {
              "A": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DnsAddressRecord"
                }
              },
              "AAAA": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DnsAddressRecord"
                }
              },
              "CNAME": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "ttl": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Time to live in seconds."
                    }
                  }
                }
              },
              "MX": {
                "type": "array",
                "description": "Sorted by priority. An empty target is a null MX (the domain accepts no mail).",
                "items": {
                  "type": "object",
                  "properties": {
                    "priority": {
                      "type": "integer"
                    },
                    "target": {
                      "type": "string"
                    },
                    "ttl": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Time to live in seconds."
                    }
                  }
                }
              },
              "NS": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "ttl": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Time to live in seconds."
                    }
                  }
                }
              },
              "TXT": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "string",
                      "description": "Record text, multi-string records joined."
                    },
                    "kind": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "SPF",
                        "DKIM",
                        "Verification",
                        "MTA-STS",
                        null
                      ]
                    },
                    "ttl": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Time to live in seconds."
                    }
                  }
                }
              },
              "DMARC": {
                "type": "array",
                "description": "v=DMARC1 TXT record at _dmarc.{domain}.",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "ttl": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Time to live in seconds."
                    }
                  }
                }
              },
              "SOA": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "mname": {
                      "type": "string"
                    },
                    "rname": {
                      "type": "string"
                    },
                    "serial": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "refresh": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "retry": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "expire": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "minimum_ttl": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "ttl": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Time to live in seconds."
                    }
                  }
                }
              },
              "CAA": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "flags": {
                      "type": "integer"
                    },
                    "tag": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "ttl": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Time to live in seconds."
                    }
                  }
                }
              },
              "PTR": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DnsPtrRecord"
                }
              }
            }
          },
          "ptr": {
            "type": [
              "string",
              "null"
            ],
            "description": "IPs: first reverse DNS name, null if none. Domains: always null."
          },
          "forward_confirmed": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "IPs: true when a PTR name resolves back to the IP (FCrDNS), false when none does, null when there is no PTR record. Domains: always null."
          },
          "reverse_name": {
            "type": "string",
            "description": "IPs only: the in-addr.arpa / ip6.arpa name that was queried."
          },
          "failed": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Record types whose query timed out or failed. Only present when not empty."
          },
          "partial": {
            "type": "boolean",
            "description": "True when the 8-second time budget ran out and the remaining types were skipped."
          },
          "nxdomain": {
            "type": "boolean",
            "description": "Domains only: true when the name has none of A, AAAA, CNAME, MX, NS, TXT, SOA, CAA (almost always: the name does not exist). Status is still 200."
          }
        }
      },
      "DnsAddressRecord": {
        "type": "object",
        "properties": {
          "ip": {
            "type": "string"
          },
          "ttl": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Time to live in seconds."
          }
        }
      },
      "DnsPtrRecord": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "ttl": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Time to live in seconds."
          },
          "forward": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Addresses the name resolves to (A for IPv4, AAAA for IPv6)."
          },
          "confirmed": {
            "type": "boolean",
            "description": "forward contains the queried IP."
          }
        }
      }
    },
    "responses": {
      "Lookup": {
        "description": "Lookup result. Header `X-Cache-Status: STALE` is set when the upstream source was unavailable and the last cached data was served.",
        "headers": {
          "X-Cache-Status": {
            "description": "Only present, with value STALE, when stale cached data was served.",
            "schema": {
              "type": "string",
              "enum": [
                "STALE"
              ]
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/IpLookup"
            },
            "examples": {
              "google-dns": {
                "summary": "8.8.8.8",
                "value": {
                  "ip": "8.8.8.8",
                  "type": "IPv4",
                  "hostname": null,
                  "carrier": {
                    "name": null,
                    "mcc": null,
                    "mnc": null
                  },
                  "company": {
                    "domain": "google.com",
                    "name": "Google LLC",
                    "type": "isp"
                  },
                  "connection": {
                    "asn": 15169,
                    "domain": "google.com",
                    "organization": "Google LLC",
                    "route": "8.8.8.0/24",
                    "type": "hosting"
                  },
                  "currency": {
                    "code": "USD",
                    "name": "US Dollar",
                    "name_native": "US Dollar",
                    "plural": null,
                    "plural_native": null,
                    "symbol": "$",
                    "symbol_native": "$",
                    "format": {
                      "decimal_separator": ".",
                      "group_separator": ",",
                      "negative": {
                        "prefix": null,
                        "suffix": null
                      },
                      "positive": {
                        "prefix": null,
                        "suffix": null
                      }
                    }
                  },
                  "location": {
                    "continent": {
                      "code": "NA",
                      "name": "North America"
                    },
                    "country": {
                      "area": 9629091,
                      "borders": [],
                      "calling_code": "1",
                      "capital": "Washington D.C.",
                      "code": "US",
                      "name": "United States",
                      "population": 341784857,
                      "population_density": 35.32,
                      "flag": {
                        "emoji": "🇺🇸",
                        "emoji_unicode": "U+1F1FA U+1F1F8",
                        "emojitwo": "https://ipinfo.dkly.net/flags/emojitwo/us.svg",
                        "noto": "https://ipinfo.dkly.net/flags/noto/us.png",
                        "twemoji": "https://ipinfo.dkly.net/flags/twemoji/us.svg",
                        "wikimedia": "https://ipinfo.dkly.net/flags/wikimedia/us.svg"
                      },
                      "languages": [],
                      "tld": ".us"
                    },
                    "region": {
                      "code": "US-CA",
                      "name": "California"
                    },
                    "city": "Mountain View",
                    "postal": "94043",
                    "latitude": 37.40552,
                    "longitude": -122.07746,
                    "language": {
                      "code": "en",
                      "name": "English",
                      "native": "English"
                    },
                    "in_eu": false
                  },
                  "security": {
                    "is_abuser": false,
                    "is_attacker": false,
                    "is_bogon": false,
                    "is_cloud_provider": true,
                    "is_proxy": false,
                    "is_relay": false,
                    "is_tor": false,
                    "is_tor_exit": false,
                    "is_vpn": false,
                    "is_anonymous": false,
                    "is_threat": false
                  },
                  "time_zone": {
                    "id": "America/Los_Angeles",
                    "abbreviation": "PST",
                    "current_time": "2026-12-02T14:38:05+00:00",
                    "name": "Pacific Standard Time",
                    "offset": -25200,
                    "in_daylight_saving": true
                  }
                }
              }
            }
          }
        }
      },
      "BadRequest": {
        "description": "Invalid IP address.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "invalid-ip": {
                "value": {
                  "code": "INVALID_IP",
                  "message": "Invalid IP address: 999.1.1.1",
                  "resolution": "Provide a valid IPv4 or IPv6 address"
                }
              },
              "bogon": {
                "summary": "Private or reserved IP (not counted against the quota)",
                "value": {
                  "code": "BOGON_IP",
                  "message": "10.0.0.1 is a private or reserved address and has no geolocation data",
                  "resolution": "Look up a public IP address. Private ranges (e.g. 10.0.0.0/8, 192.168.0.0/16) and reserved ranges are not routed on the internet.",
                  "ip": "10.0.0.1",
                  "bogon": true
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "API key missing, invalid, disabled or expired.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "missing": {
                "value": {
                  "code": "API_KEY_MISSING",
                  "message": "API key is required",
                  "resolution": "Provide an API key via X-API-Key header or key query parameter"
                }
              },
              "invalid": {
                "value": {
                  "code": "API_KEY_INVALID",
                  "message": "Invalid API key",
                  "resolution": "Check your API key and try again"
                }
              },
              "disabled": {
                "value": {
                  "code": "API_KEY_DISABLED",
                  "message": "API key is disabled",
                  "resolution": "Contact support to reactivate your API key"
                }
              },
              "expired": {
                "value": {
                  "code": "API_KEY_EXPIRED",
                  "message": "API key has expired",
                  "resolution": "Contact support to renew your API key"
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "The key is restricted: the request IP is not in the key's whitelist (IP_NOT_ALLOWED) or the origin is not allowed (ORIGIN_NOT_ALLOWED).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "ip-not-allowed": {
                "value": {
                  "code": "IP_NOT_ALLOWED",
                  "message": "Your IP address is not allowed",
                  "resolution": "Contact support to update your IP whitelist"
                }
              },
              "origin-not-allowed": {
                "value": {
                  "code": "ORIGIN_NOT_ALLOWED",
                  "message": "Your origin/referer is not allowed",
                  "resolution": "Contact support to update your allowed origins"
                }
              }
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "Only GET (and OPTIONS preflight) is accepted.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "post": {
                "value": {
                  "code": "METHOD_NOT_ALLOWED",
                  "message": "Only GET method is allowed",
                  "resolution": "Use GET request to lookup IP addresses"
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Per-minute, per-hour or per-client-IP-per-hour rate limit of the key exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "per-minute": {
                "value": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Rate limit exceeded (per minute)",
                  "resolution": "Wait a moment before making more requests"
                }
              },
              "per-hour": {
                "value": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Rate limit exceeded (per hour)",
                  "resolution": "Wait before making more requests"
                }
              },
              "per-ip-hour": {
                "value": {
                  "code": "RATE_LIMIT_EXCEEDED",
                  "message": "Rate limit exceeded for your IP (per hour)",
                  "resolution": "Wait before making more requests from this IP"
                }
              },
              "quota-exceeded": {
                "summary": "Monthly quota used up",
                "value": {
                  "code": "QUOTA_EXCEEDED",
                  "message": "Monthly quota exceeded",
                  "resolution": "Wait until next month or upgrade your plan"
                }
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "Unexpected server error. Includes a `reference` code; details are only logged server-side.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "internal": {
                "value": {
                  "code": "INTERNAL_ERROR",
                  "message": "Something went wrong on our side while looking up this IP.",
                  "resolution": "Please try again later. If it keeps happening, contact support with this reference.",
                  "reference": "3F9A1C07"
                }
              }
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "Upstream data source temporarily unavailable and the IP is not cached.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "unavailable": {
                "value": {
                  "code": "SERVICE_UNAVAILABLE",
                  "message": "Lookups are temporarily unavailable. Please try again in a few minutes.",
                  "resolution": "Retry later. Cached IPs keep working; if it keeps happening, contact support with this reference.",
                  "reference": "B71E04D2"
                }
              }
            }
          }
        },
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait (300).",
            "schema": {
              "type": "integer",
              "examples": [
                300
              ]
            }
          }
        }
      }
    }
  }
}
