API Documentation
Overview
This document outlines the API endpoints, request parameters, and response structure for retrieving geolocation information based on IP addresses or domains.
Endpoints
- GET /api: Retrieves general geolocation information.
- GET /api/{query}: Retrieves geolocation information for a specific IP or domain specified in the
query path parameter.
Request Parameters
- query (path parameter): Specifies the IP address or domain to query.
- lang (optional, query parameter): Specifies the language of the returned data. Supported values:
- de: German
- en: English
- es: Spanish
- fr: French
- ja: Japanese
- pt-BR: Portuguese (Brazil)
- ru: Russian
- zh-CN: Chinese (Simplified)
- source (optional, query parameter): Specifies the data source. Allowed values:
qqwry, meituan, ipapi. - callback (optional, query parameter): If provided, returns data in JSONP format.
Response
Status Code: 200
Content Type: application/json (default) or text/javascript (if callback parameter is provided)
Success Response
The API returns geolocation information for the specified IP or domain, including the following fields (all optional unless specified):
- ip: The IP address (required).
- hostname: The hostname associated with the IP.
- postal: Postal code.
- area_name: Name of the area.
- district_code: Code of the district.
- district_name: Name of the district.
- city_code: Code of the city.
- city_name: Name of the city.
- region_code: Code of the region.
- region_name: Name of the region.
- country_code: Code of the country.
- country_name: Name of the country.
- continent_code: Code of the continent.
- continent_name: Name of the continent.
- registered_country_code: Code of the registered country.
- registered_country_name: Name of the registered country.
- latitude: Latitude coordinate.
- longitude: Longitude coordinate.
- address: Full address.
- timezone: Timezone information.
- isp: Internet Service Provider.
- asn: Autonomous System Number.
- org: Organization name.
- user_agent: User agent information.
- isEU: Boolean indicating if the location is in the EU.
- source: Source of the data (
maxmind, geocn, qqwry, meituan) (required). - updatedAt: Timestamp of the last update.
Examples
Example 1: General Query
Request: GET /api?lang=en
Response: Returns geolocation information in JSON format based on the provided parameters.
Example 2: Specific IP Query
Request: GET /api/8.8.8.8?lang=en
Response: Returns geolocation information for the IP address 8.8.8.8 in JSON format.