{
  "openapi": "3.1.0",
  "info": {
    "title": "Nondik IP intelligence API",
    "version": "1.0.0",
    "description": "Location, network type, VPN / Tor / iCloud Private Relay / hosting detection and a risk score for any IPv4 or IPv6 address.\n\nAuthenticate with your key in the `X-API-Key` header (or `Authorization: Bearer <key>`). Keys in the URL are rejected because URLs end up in logs.\n\nEvery plan returns every field; plans differ by volume. Location data includes IP Geolocation by DB-IP (https://db-ip.com) and GeoNames (https://www.geonames.org), both CC-BY 4.0.",
    "contact": {
      "url": "https://nondik.net"
    }
  },
  "servers": [
    {
      "url": "https://api.nondik.net"
    }
  ],
  "security": [
    {
      "apiKey": []
    },
    {
      "bearer": []
    }
  ],
  "paths": {
    "/v1/{ip}": {
      "get": {
        "operationId": "lookup",
        "summary": "Look up an IP address",
        "description": "Costs 1 lookup.",
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "IPv4 or IPv6 address.",
            "example": "8.8.8.8"
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated fields to return, with dots for nested fields, e.g. `location.country_code,privacy`. `ip` is always returned.",
            "example": "location.country_code,privacy.vpn,risk"
          }
        ],
        "responses": {
          "200": {
            "description": "Lookup result.",
            "headers": {
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Used": {
                "$ref": "#/components/headers/X-Quota-Used"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Period": {
                "$ref": "#/components/headers/X-Quota-Period"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              },
              "X-Quota-Warning": {
                "$ref": "#/components/headers/X-Quota-Warning"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lookup"
                }
              }
            }
          },
          "400": {
            "description": "Not an IP address (`invalid_ip`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (`missing_key`, `invalid_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Key or account disabled (`key_disabled`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Quota used up (`quota_exceeded`). The free trial stops at 1,000 lookups; paid plans stop at 120% of the monthly quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Temporary error (`internal_error`); retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Data is loading (`data_unavailable`); retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "lookupSelf",
        "summary": "Look up the caller's own IP address",
        "description": "Costs 1 lookup.",
        "parameters": [
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated fields to return, with dots for nested fields, e.g. `location.country_code,privacy`. `ip` is always returned.",
            "example": "location.country_code,privacy.vpn,risk"
          }
        ],
        "responses": {
          "200": {
            "description": "Lookup result.",
            "headers": {
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Used": {
                "$ref": "#/components/headers/X-Quota-Used"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Period": {
                "$ref": "#/components/headers/X-Quota-Period"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              },
              "X-Quota-Warning": {
                "$ref": "#/components/headers/X-Quota-Warning"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lookup"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (`missing_key`, `invalid_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Key or account disabled (`key_disabled`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Quota used up (`quota_exceeded`). The free trial stops at 1,000 lookups; paid plans stop at 120% of the monthly quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Temporary error (`internal_error`); retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Data is loading (`data_unavailable`); retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/batch": {
      "post": {
        "operationId": "lookupBatch",
        "summary": "Look up many addresses",
        "description": "Pro plan and above. Up to 256 addresses (1,000 on Enterprise). Costs 1 lookup per valid address; invalid entries are returned with an error and not charged.",
        "parameters": [
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated fields to return, with dots for nested fields, e.g. `location.country_code,privacy`. `ip` is always returned.",
            "example": "location.country_code,privacy.vpn,risk"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ips"
                ],
                "properties": {
                  "ips": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 1000
                  }
                }
              },
              "example": {
                "ips": [
                  "8.8.8.8",
                  "2a00:1450::1"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per input, in order.",
            "headers": {
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Used": {
                "$ref": "#/components/headers/X-Quota-Used"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Period": {
                "$ref": "#/components/headers/X-Quota-Period"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              },
              "X-Quota-Warning": {
                "$ref": "#/components/headers/X-Quota-Warning"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/Lookup"
                          },
                          {
                            "$ref": "#/components/schemas/BatchError"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad body (`invalid_request`) or too many addresses (`batch_too_large`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (`missing_key`, `invalid_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan without batch (`plan_restriction`), or key disabled (`key_disabled`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Quota used up (`quota_exceeded`). The free trial stops at 1,000 lookups; paid plans stop at 120% of the monthly quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Temporary error (`internal_error`); retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Data is loading (`data_unavailable`); retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "operationId": "account",
        "summary": "Plan, quota and usage for your key",
        "description": "Free (not counted).",
        "responses": {
          "200": {
            "description": "Account status.",
            "headers": {
              "X-Quota-Limit": {
                "$ref": "#/components/headers/X-Quota-Limit"
              },
              "X-Quota-Used": {
                "$ref": "#/components/headers/X-Quota-Used"
              },
              "X-Quota-Remaining": {
                "$ref": "#/components/headers/X-Quota-Remaining"
              },
              "X-Quota-Period": {
                "$ref": "#/components/headers/X-Quota-Period"
              },
              "X-Quota-Reset": {
                "$ref": "#/components/headers/X-Quota-Reset"
              },
              "X-Quota-Warning": {
                "$ref": "#/components/headers/X-Quota-Warning"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (`missing_key`, `invalid_key`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Key or account disabled (`key_disabled`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "security": [],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "503": {
            "description": "No data loaded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "operationId": "openapi",
        "summary": "This document",
        "security": [],
        "responses": {
          "200": {
            "description": "OpenAPI 3.1 document.",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "headers": {
      "X-Quota-Limit": {
        "description": "Lookups included in the plan for this period.",
        "schema": {
          "type": "integer"
        }
      },
      "X-Quota-Used": {
        "description": "Lookups used this period, including this request (may lag other servers by up to a minute).",
        "schema": {
          "type": "integer"
        }
      },
      "X-Quota-Remaining": {
        "description": "Lookups left in the plan quota (0 when in the overage allowance).",
        "schema": {
          "type": "integer"
        }
      },
      "X-Quota-Period": {
        "description": "`lifetime` for the free trial, otherwise the month as `YYYY-MM` (UTC).",
        "schema": {
          "type": "string"
        }
      },
      "X-Quota-Reset": {
        "description": "When the monthly quota resets (absent for the free trial).",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "X-Quota-Warning": {
        "description": "Present when usage is over the plan quota but inside the 20% allowance.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_ip",
                  "invalid_request",
                  "batch_too_large",
                  "missing_key",
                  "invalid_key",
                  "key_disabled",
                  "plan_restriction",
                  "not_found",
                  "method_not_allowed",
                  "quota_exceeded",
                  "internal_error",
                  "data_unavailable"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "BatchError": {
        "type": "object",
        "required": [
          "ip",
          "error"
        ],
        "properties": {
          "ip": {
            "type": "string"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Lookup": {
        "type": "object",
        "required": [
          "ip",
          "found",
          "location",
          "network",
          "privacy",
          "crawler",
          "risk",
          "threats",
          "data_date"
        ],
        "properties": {
          "ip": {
            "type": "string",
            "description": "The address looked up (IPv4-mapped IPv6 is returned as IPv4)."
          },
          "found": {
            "type": "boolean",
            "description": "False when no source covers the address."
          },
          "bogon": {
            "type": "boolean",
            "description": "Present and true for private, reserved or special-purpose addresses."
          },
          "location": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Location"
              }
            ]
          },
          "network": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Network"
              }
            ]
          },
          "privacy": {
            "$ref": "#/components/schemas/Privacy"
          },
          "crawler": {
            "type": [
              "string",
              "null"
            ],
            "description": "Verified crawler (from the operator's published ranges): googlebot, bingbot, gptbot."
          },
          "risk": {
            "$ref": "#/components/schemas/Risk"
          },
          "threats": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Threat lists the address is on."
          },
          "data_date": {
            "type": "string",
            "format": "date",
            "description": "Date of the data release used."
          }
        },
        "example": {
          "ip": "3.4.12.4",
          "found": true,
          "location": {
            "country_code": "IE",
            "region": "Leinster",
            "city": "Dublin",
            "latitude": 53.33306,
            "longitude": -6.24889,
            "timezone": "Europe/Dublin",
            "accuracy_km": 50,
            "source": "cloud-region"
          },
          "network": {
            "prefix": "3.4.12.4/32",
            "asn": 16509,
            "org": "Amazon.com, Inc.",
            "type": "cloud",
            "cloud": {
              "provider": "aws",
              "region": "eu-west-1",
              "service": "AMAZON"
            }
          },
          "privacy": {
            "anonymous": false,
            "vpn": false,
            "tor": false,
            "relay": false,
            "hosting": true
          },
          "crawler": null,
          "risk": {
            "score": 60,
            "level": "medium",
            "reasons": [
              "hosting_network"
            ]
          },
          "threats": [],
          "data_date": "2026-11-25"
        }
      },
      "Location": {
        "type": "object",
        "required": [
          "country_code"
        ],
        "properties": {
          "country_code": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2."
          },
          "region": {
            "type": "string"
          },
          "region_code": {
            "type": "string",
            "description": "ISO 3166-2 when known."
          },
          "city": {
            "type": "string"
          },
          "postal": {
            "type": "string"
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "timezone": {
            "type": "string",
            "description": "IANA time zone."
          },
          "accuracy_km": {
            "type": "integer",
            "description": "Approximate radius of the estimate (provisional per source)."
          },
          "source": {
            "type": "string",
            "description": "Where the location came from: geofeed-*, apple-private-relay, cloud-region, dbip-city-lite, registry."
          }
        }
      },
      "Network": {
        "type": "object",
        "required": [
          "type",
          "cloud"
        ],
        "properties": {
          "prefix": {
            "type": "string",
            "description": "The network block the address belongs to in this database."
          },
          "asn": {
            "type": "integer"
          },
          "org": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "cloud",
              "cdn",
              "hosting",
              "vpn",
              "mobile",
              "isp",
              "education",
              "government",
              "business",
              "unknown"
            ]
          },
          "cloud": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "gcp",
                      "oracle",
                      "cloudflare"
                    ]
                  },
                  "region": {
                    "type": "string"
                  },
                  "service": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        }
      },
      "Privacy": {
        "type": "object",
        "required": [
          "anonymous",
          "vpn",
          "tor",
          "relay",
          "hosting"
        ],
        "properties": {
          "anonymous": {
            "type": "boolean",
            "description": "vpn, tor or relay."
          },
          "vpn": {
            "type": "boolean",
            "description": "Network operated by a VPN provider."
          },
          "tor": {
            "type": "boolean",
            "description": "Tor exit relay."
          },
          "relay": {
            "type": "boolean",
            "description": "iCloud Private Relay egress (real Safari users; usually do not block)."
          },
          "hosting": {
            "type": "boolean",
            "description": "Cloud, hosting or CDN network (excluding Private Relay)."
          }
        }
      },
      "Risk": {
        "type": "object",
        "required": [
          "score",
          "level",
          "reasons"
        ],
        "properties": {
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "level": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "description": "low < 40 <= medium < 70 <= high."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "tor_exit",
                "threat_list",
                "vpn_provider",
                "hosting_network",
                "icloud_private_relay",
                "unknown_network",
                "verified_crawler"
              ]
            }
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "starter",
              "pro",
              "business",
              "enterprise"
            ]
          },
          "key_prefix": {
            "type": "string"
          },
          "quota": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer"
              },
              "used": {
                "type": "integer"
              },
              "remaining": {
                "type": "integer"
              },
              "hard_limit": {
                "type": "integer"
              },
              "period": {
                "type": "string"
              },
              "renews": {
                "type": "boolean"
              },
              "reset": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "features": {
            "type": "object",
            "properties": {
              "batch": {
                "type": "boolean"
              },
              "batch_max": {
                "type": "integer"
              }
            }
          }
        }
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "no_data"
            ]
          },
          "version": {
            "type": "string"
          },
          "data_date": {
            "type": "string"
          }
        }
      }
    }
  }
}