{
  "openapi": "3.1.0",
  "info": {
    "title": "IP Info by Shifter",
    "version": "1.0.0",
    "description": "Free public IP geolocation and ASN API. Maintained and supported by Shifter. No signup or API key.",
    "termsOfService": "https://ip-info.com/terms",
    "contact": {
      "name": "Shifter",
      "url": "https://shifter.io",
      "email": "hi@shifter.io"
    }
  },
  "servers": [
    {
      "url": "https://ip-info.com"
    },
    {
      "url": "http://ip-info.com"
    }
  ],
  "security": [],
  "paths": {
    "/json": {
      "get": {
        "operationId": "lookupIp",
        "summary": "Look up the caller or a supplied IP",
        "description": "Free, no API key. Caller detection returns the requesting machine or proxy exit, not necessarily the human user's IP.",
        "security": [],
        "parameters": [
          {
            "name": "ip",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Public IPv4 or IPv6 literal. Omit to detect caller. Must match path IP when both are supplied.",
            "example": "94.204.59.232"
          }
        ],
        "responses": {
          "200": {
            "description": "IP lookup result; missing attributes are null.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "example": "no-store"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IpInfo"
                },
                "example": {
                  "ip": "94.204.59.232",
                  "city": "Motor City",
                  "city_geoname_id": 13118429,
                  "region": "Dubai",
                  "region_code": "DU",
                  "region_geoname_id": 292224,
                  "district": "Central",
                  "district_code": null,
                  "district_geoname_id": 13060544,
                  "country": "AE",
                  "country_name": "United Arab Emirates",
                  "country_geoname_id": 290557,
                  "is_eu": false,
                  "continent": "AS",
                  "continent_name": "Asia",
                  "continent_geoname_id": 6255147,
                  "loc": "25.0459,55.241",
                  "latitude": 25.0459,
                  "longitude": 55.241,
                  "postal": null,
                  "timezone": "Asia/Dubai",
                  "weather_code": "AEXX0056",
                  "asn": 15802,
                  "as_name": "Emirates Integrated Telecommunications Company PJSC",
                  "isp": "Emirates Integrated Telecommunications Company PJSC",
                  "org": "Emirates Integrated Telecommunications Company",
                  "connection_type": "Corporate",
                  "user_type": "business",
                  "is_anycast": false
                }
              }
            }
          },
          "400": {
            "description": "Malformed, conflicting, non-public, or unsupported lookup input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_ip",
                    "message": "Malformed, conflicting, non-public, or unsupported lookup input."
                  }
                }
              }
            }
          },
          "404": {
            "description": "No record in the active database.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "ip_not_found",
                    "message": "No record in the active database."
                  }
                }
              }
            }
          },
          "405": {
            "description": "Use GET for lookups.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "method_not_allowed",
                    "message": "Use GET for lookups."
                  }
                }
              }
            }
          },
          "431": {
            "description": "Request headers exceed the configured limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "request_too_large",
                    "message": "Request headers exceed the configured limit."
                  }
                }
              }
            }
          },
          "503": {
            "description": "Database unavailable; retry later with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "database_unavailable",
                    "message": "Database unavailable; retry later with backoff."
                  }
                }
              }
            }
          },
          "504": {
            "description": "Request timed out; retry later with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "timeout",
                    "message": "Request timed out; retry later with backoff."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/{ip}/json": {
      "get": {
        "operationId": "lookupIpByPath",
        "summary": "Look up a supplied IP",
        "description": "Free, no API key. Caller detection returns the requesting machine or proxy exit, not necessarily the human user's IP.",
        "security": [],
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public IPv4 or IPv6 literal.",
            "example": "94.204.59.232"
          },
          {
            "name": "ip",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Public IPv4 or IPv6 literal. Omit to detect caller. Must match path IP when both are supplied.",
            "example": "94.204.59.232"
          }
        ],
        "responses": {
          "200": {
            "description": "IP lookup result; missing attributes are null.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "example": "no-store"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IpInfo"
                },
                "example": {
                  "ip": "94.204.59.232",
                  "city": "Motor City",
                  "city_geoname_id": 13118429,
                  "region": "Dubai",
                  "region_code": "DU",
                  "region_geoname_id": 292224,
                  "district": "Central",
                  "district_code": null,
                  "district_geoname_id": 13060544,
                  "country": "AE",
                  "country_name": "United Arab Emirates",
                  "country_geoname_id": 290557,
                  "is_eu": false,
                  "continent": "AS",
                  "continent_name": "Asia",
                  "continent_geoname_id": 6255147,
                  "loc": "25.0459,55.241",
                  "latitude": 25.0459,
                  "longitude": 55.241,
                  "postal": null,
                  "timezone": "Asia/Dubai",
                  "weather_code": "AEXX0056",
                  "asn": 15802,
                  "as_name": "Emirates Integrated Telecommunications Company PJSC",
                  "isp": "Emirates Integrated Telecommunications Company PJSC",
                  "org": "Emirates Integrated Telecommunications Company",
                  "connection_type": "Corporate",
                  "user_type": "business",
                  "is_anycast": false
                }
              }
            }
          },
          "400": {
            "description": "Malformed, conflicting, non-public, or unsupported lookup input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_ip",
                    "message": "Malformed, conflicting, non-public, or unsupported lookup input."
                  }
                }
              }
            }
          },
          "404": {
            "description": "No record in the active database.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "ip_not_found",
                    "message": "No record in the active database."
                  }
                }
              }
            }
          },
          "405": {
            "description": "Use GET for lookups.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "method_not_allowed",
                    "message": "Use GET for lookups."
                  }
                }
              }
            }
          },
          "431": {
            "description": "Request headers exceed the configured limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "request_too_large",
                    "message": "Request headers exceed the configured limit."
                  }
                }
              }
            }
          },
          "503": {
            "description": "Database unavailable; retry later with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "database_unavailable",
                    "message": "Database unavailable; retry later with backoff."
                  }
                }
              }
            }
          },
          "504": {
            "description": "Request timed out; retry later with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "timeout",
                    "message": "Request timed out; retry later with backoff."
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "IpInfo": {
        "type": "object",
        "required": [
          "ip",
          "city",
          "city_geoname_id",
          "region",
          "region_code",
          "region_geoname_id",
          "district",
          "district_code",
          "district_geoname_id",
          "country",
          "country_name",
          "country_geoname_id",
          "is_eu",
          "continent",
          "continent_name",
          "continent_geoname_id",
          "loc",
          "latitude",
          "longitude",
          "postal",
          "timezone",
          "weather_code",
          "asn",
          "as_name",
          "isp",
          "org",
          "connection_type",
          "user_type",
          "is_anycast"
        ],
        "additionalProperties": false,
        "properties": {
          "ip": {
            "type": "string",
            "description": "Normalized public IP address that was looked up.",
            "examples": [
              "94.204.59.232"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ],
            "description": "City name in English.",
            "examples": [
              "Motor City"
            ]
          },
          "city_geoname_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "City GeoNames identifier.",
            "examples": [
              13118429
            ]
          },
          "region": {
            "type": [
              "string",
              "null"
            ],
            "description": "First administrative subdivision in English.",
            "examples": [
              "Dubai"
            ]
          },
          "region_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Subdivision code as stored in the database; not prefixed with country.",
            "examples": [
              "DU"
            ]
          },
          "region_geoname_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "First subdivision GeoNames identifier.",
            "examples": [
              292224
            ]
          },
          "district": {
            "type": [
              "string",
              "null"
            ],
            "description": "Second administrative subdivision in English.",
            "examples": [
              "Central"
            ]
          },
          "district_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Second subdivision code, where available.",
            "examples": [
              null
            ]
          },
          "district_geoname_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Second subdivision GeoNames identifier.",
            "examples": [
              13060544
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Two-letter ISO country code.",
            "examples": [
              "AE"
            ]
          },
          "country_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Country name in English.",
            "examples": [
              "United Arab Emirates"
            ]
          },
          "country_geoname_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Country GeoNames identifier.",
            "examples": [
              290557
            ]
          },
          "is_eu": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "European Union membership; null means unknown.",
            "examples": [
              false
            ]
          },
          "continent": {
            "type": [
              "string",
              "null"
            ],
            "description": "Two-letter continent code.",
            "examples": [
              "AS"
            ]
          },
          "continent_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Continent name in English.",
            "examples": [
              "Asia"
            ]
          },
          "continent_geoname_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Continent GeoNames identifier.",
            "examples": [
              6255147
            ]
          },
          "loc": {
            "type": [
              "string",
              "null"
            ],
            "description": "Approximate latitude,longitude pair; null if either coordinate is missing.",
            "examples": [
              "25.0459,55.241"
            ]
          },
          "latitude": {
            "type": [
              "number",
              "null"
            ],
            "description": "Approximate latitude in decimal degrees.",
            "examples": [
              25.0459
            ]
          },
          "longitude": {
            "type": [
              "number",
              "null"
            ],
            "description": "Approximate longitude in decimal degrees.",
            "examples": [
              55.241
            ]
          },
          "postal": {
            "type": [
              "string",
              "null"
            ],
            "description": "Postal code, where available.",
            "examples": [
              null
            ]
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "IANA time zone name.",
            "examples": [
              "Asia/Dubai"
            ]
          },
          "weather_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Nearest weather station code supplied by the database.",
            "examples": [
              "AEXX0056"
            ]
          },
          "asn": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Autonomous system number as a number, without AS prefix.",
            "examples": [
              15802
            ]
          },
          "as_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Autonomous system organization name.",
            "examples": [
              "Emirates Integrated Telecommunications Company PJSC"
            ]
          },
          "isp": {
            "type": [
              "string",
              "null"
            ],
            "description": "Internet service provider name.",
            "examples": [
              "Emirates Integrated Telecommunications Company PJSC"
            ]
          },
          "org": {
            "type": [
              "string",
              "null"
            ],
            "description": "Organization using the IP; separate from ASN and ISP.",
            "examples": [
              "Emirates Integrated Telecommunications Company"
            ]
          },
          "connection_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Network connection classification, such as Cable/DSL, Cellular, Corporate or Dialup.",
            "examples": [
              "Corporate"
            ]
          },
          "user_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Network usage classification, such as business, residential, cellular or hosting.",
            "examples": [
              "business"
            ]
          },
          "is_anycast": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Anycast classification; not a VPN or proxy detection flag.",
            "examples": [
              false
            ]
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
