{
  "openapi": "3.1.0",
  "info": {
    "title": "upopip IP API",
    "version": "1.0.0",
    "description": "Your public IP address and network details. No key. Rate-limited per address (HTTP 429 with Retry-After). Responses are never cached and addresses are not logged."
  },
  "servers": [
    {
      "url": "https://upopip.com"
    },
    {
      "url": "https://ipv4.upopip.com",
      "description": "IPv4 only"
    },
    {
      "url": "https://ipv6.upopip.com",
      "description": "IPv6 only"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "summary": "Your IP as plain text (send a non-browser User-Agent or Accept: text/plain)",
        "operationId": "getIp",
        "responses": {
          "200": {
            "description": "IP address",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/ip4": {
      "get": {
        "summary": "Your IPv4 address",
        "operationId": "getIpv4",
        "responses": {
          "200": {
            "description": "IPv4 address",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Connected over IPv6",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/ip6": {
      "get": {
        "summary": "Your IPv6 address",
        "operationId": "getIpv6",
        "responses": {
          "200": {
            "description": "IPv6 address",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Connected over IPv4",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/asn": {
      "get": {
        "summary": "Your network number and provider, e.g. \"AS13335 Cloudflare, Inc.\"",
        "operationId": "getAsn",
        "responses": {
          "200": {
            "description": "ASN and organisation",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/json": {
      "get": {
        "summary": "Everything about your connection",
        "operationId": "getJson",
        "responses": {
          "200": {
            "description": "Connection details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ip"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Ip": {
        "type": "object",
        "properties": {
          "ip": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "enum": [
              "IPv4",
              "IPv6"
            ]
          },
          "asn": {
            "type": [
              "integer",
              "null"
            ]
          },
          "org": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "connection": {
            "type": "string",
            "enum": [
              "none",
              "vpn",
              "tor",
              "relay",
              "datacenter"
            ]
          },
          "rdns": {
            "type": [
              "string",
              "null"
            ]
          },
          "geo_source": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  }
}
