{
    "openapi": "3.1.0",
    "info": {
        "title": "IP Geolocation API",
        "version": "v1",
        "description": "Turn IP addresses into geographic information: city, country, time zone, currency and ISP, in German by default."
    },
    "servers": [
        {
            "url": "https://api.flowdata.one/v1",
            "description": "FlowData API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "single-ip",
            "description": "Single IP lookup"
        },
        {
            "name": "batch",
            "description": "Batch lookup"
        }
    ],
    "paths": {
        "/geolocation": {
            "get": {
                "operationId": "geolocation-client",
                "summary": "Look up your own IP",
                "description": "Determines the IP address of the requesting client and answers with its geolocation data. Only a response with status: success is billed.",
                "tags": [
                    "single-ip"
                ],
                "parameters": [
                    {
                        "name": "lang",
                        "in": "query",
                        "required": false,
                        "description": "Language of the geographic labels (default de, alternatively en)",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "status": "success",
                                    "continent": "Nordamerika",
                                    "continentCode": "NA",
                                    "country": "Vereinigte Staaten",
                                    "countryCode": "US",
                                    "region": "CA",
                                    "regionName": "Kalifornien",
                                    "city": "Mountain View",
                                    "district": null,
                                    "zip": "94043",
                                    "lat": 37.4192,
                                    "lon": -122.0574,
                                    "timezone": "America/Los_Angeles",
                                    "offset": -25200,
                                    "currency": "USD",
                                    "isp": "Google LLC",
                                    "org": "Google LLC",
                                    "as": "AS15169 Google LLC",
                                    "asname": "Google LLC",
                                    "reverse": null,
                                    "mobile": null,
                                    "proxy": null,
                                    "hosting": null,
                                    "query": "8.8.8.8"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/geolocation/{ip}": {
            "get": {
                "operationId": "geolocation-ip",
                "summary": "Look up a specific IP or domain",
                "description": "Retrieves geolocation data for a specific IPv4 or IPv6 address or domain. Only a response with status: success is billed.",
                "tags": [
                    "single-ip"
                ],
                "parameters": [
                    {
                        "name": "ip",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "IPv4, IPv6 or domain, for example 8.8.8.8 or google.com"
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "required": false,
                        "description": "Language (default de)",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/geolocation/batch": {
            "post": {
                "operationId": "geolocation-batch",
                "summary": "Batch geolocation",
                "description": "Looks up as many as 100 IP addresses or domains in one request. The request body is the JSON array itself: IP strings or objects of the form {\"query\":\"8.8.8.8\",\"lang\":\"de\"}.",
                "tags": [
                    "batch"
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": [
                                    {
                                        "status": "success",
                                        "query": "8.8.8.8",
                                        "country": "Vereinigte Staaten",
                                        "city": "Mountain View"
                                    },
                                    {
                                        "status": "success",
                                        "query": "1.1.1.1",
                                        "country": "Australien",
                                        "city": "Sydney"
                                    }
                                ]
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "array",
                                "maxItems": 100,
                                "items": {
                                    "oneOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "query": {
                                                    "type": "string"
                                                },
                                                "lang": {
                                                    "type": "string"
                                                },
                                                "fields": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "query"
                                            ]
                                        }
                                    ]
                                },
                                "example": [
                                    "8.8.8.8",
                                    "1.1.1.1"
                                ]
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "FlowData key as Authorization: Bearer fd_…"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            },
                            "type": {
                                "type": "string"
                            },
                            "details": {
                                "type": "object"
                            }
                        }
                    }
                }
            }
        }
    }
}