{
  "openapi": "3.1.0",
  "info": {
    "title": "MyIPGo Public API",
    "version": "1.0.0",
    "description": "Free public IP, network, DNS and reverse DNS tools. The caller IP reflects the machine making the request; IP locations are approximate."
  },
  "servers": [
    {
      "url": "https://myipgo.com"
    }
  ],
  "externalDocs": {
    "description": "MCP and agent guide",
    "url": "https://myipgo.com/en/agents/"
  },
  "paths": {
    "/api/v1/me": {
      "get": {
        "summary": "Get caller's public IP and approximate network location",
        "operationId": "myIp",
        "responses": {
          "200": {
            "description": "Caller IP, IP version, approximate location and network",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/lookup": {
      "get": {
        "summary": "Look up country and ASN for an IPv4 or IPv6 address",
        "operationId": "lookupIp",
        "parameters": [
          {
            "name": "ip",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Public IPv4 or IPv6 address"
          }
        ],
        "responses": {
          "200": {
            "description": "Country and ASN when provider data is available; city is not provided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lookup"
                }
              }
            }
          },
          "400": {
            "description": "Invalid IP address"
          }
        }
      }
    },
    "/api/v1/dns": {
      "get": {
        "summary": "Resolve DNS records",
        "operationId": "dnsLookup",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "A",
                "AAAA",
                "CNAME",
                "MX",
                "NS",
                "TXT",
                "SOA",
                "PTR"
              ],
              "default": "A"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "DNS answers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "ttl": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query"
          }
        }
      }
    },
    "/api/v1/reverse": {
      "get": {
        "summary": "Resolve PTR records for an IP",
        "operationId": "reverseDns",
        "parameters": [
          {
            "name": "ip",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PTR DNS answers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "ttl": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid IP"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Me": {
        "type": "object",
        "required": [
          "ip",
          "version",
          "example"
        ],
        "properties": {
          "ip": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "enum": [
              "IPv4",
              "IPv6"
            ]
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "network": {
            "type": [
              "string",
              "null"
            ]
          },
          "asn": {
            "type": [
              "integer",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "latitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "longitude": {
            "type": [
              "number",
              "null"
            ]
          },
          "example": {
            "type": "boolean"
          }
        }
      },
      "Lookup": {
        "type": "object",
        "required": [
          "ip",
          "version",
          "source"
        ],
        "properties": {
          "ip": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "enum": [
              "IPv4",
              "IPv6"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "countryCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "network": {
            "type": [
              "string",
              "null"
            ]
          },
          "asn": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string"
          }
        }
      }
    }
  }
}
